PHP: domxml_xslt_stylesheet - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

domxml_xslt_version domxml_xslt_stylesheet_file

Last updated: Fri, 26 Jan 2007

view this page in

# domxml_xslt_stylesheet

(PHP 4 >= 4.2.0, PECL)

domxml_xslt_stylesheet -- Creates a DomXsltStylesheet object from an XSL document in a string

## Описание

DomXsltStylesheet domxml_xslt_stylesheet ( string xsl_buf )

Creates a DomXsltStylesheet object from the given XSL buffer.

## Список параметров

`xsl_buf`

  The XSL document, as a string.

## Возвращаемые значения

Returns a new instance of DomXsltStylesheet.

## Migrating to PHP 5

Call XSLTProcessor->importStylesheet() with `DOMDocument::loadXML($xsl_buf)` as parameter.

## Смотрите также

DomXsltStylesheet->process()
domxml_xslt_stylesheet_file()
domxml_xslt_stylesheet_doc()

add a note User Contributed Notes
domxml_xslt_stylesheet
mdn at heokieng dot com
16-Feb-2003 03:04
`This is an exemple to change from XML to HTML by XSL utilising XML_DOM
File XML : Reunions.xml
<?xml version="1.0"?>
<reunions prev_id_reunion="2">
<reunion id_reunion="0">
<organisateur>Organisateur 1</organisateur>
<date>Date 1</date>
<heure>Heure 1</heure>
<lieu>Lieu 1</lieu>
<sujets>
<sujet>Sujet 11</sujet>
<sujet>Sujet 12</sujet>
</sujets>
<participants>
<participant>Participant11</participant>
<participant>Participant12</participant>
</participants>
</reunion>
<reunion id_reunion="1">
<organisateur>Organisateur 2</organisateur>
<date>Date 2</date>
<heure>Heure 2</heure>
<lieu>Lieu 2</lieu>
<sujets>
<sujet>Sujet21</sujet>
<sujet>Sujet22</sujet>
</sujets>
<participants>
<participant>Participant21</participant>
<participant>Participant22</participant>
</participants>
</reunion>
</reunions>
File PHP : Reunions.PhP
<?php
$StrXsl = '<?xml version="1.0" encoding="ISO-8859-1"?>'.
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">'.
'<xsl:template match="/">'.
'<html>'.
'<head>'.
'<title></title>'.
'</head>'.
'<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">'.
'<div align="center">'.
'<font face="Verdana" color="#4682b4" size="+2">La liste des reunions</font>'.
'<table border="0" cellpadding="0" cellspacing="0" width="300" bgcolor="#f5fffa">'.
'<tr>'.
'<th>'.
'<div align="center">'.
'<font face="Verdana" color="#4682b4" size="-1">Organisateur</font>'.
'</div>'.
'</th>'.
'<th>'.
'<div align="center">'.
'<font face="Verdana" color="#4682b4" size="-1">Date</font>'.
'</div>'.
'</th>'.
'<th>'.
'<div align="center">'.
'<font face="Verdana" color="#4682b4" size="-1">Heure</font>'.
'</div>'.
'</th>'.
'<th>'.
'<div align="center">'.
'<font face="Verdana" color="#4682b4" size="-1">Lieu</font>'.
'</div>'.
'</th>'.
'</tr>'.
'<xsl:apply-templates select="reunions/reunion">'.
'<xsl:sort select="organisateur" order="ascending"/>'.
'</xsl:apply-templates>'.
'</table>'.
'</div>'.
'</body>'.
'</html>'.
'</xsl:template>'.
'<xsl:template match="reunion">'.
'<tr>'.
'<td bgcolor="white">'.
'<font face="Verdana" color="#4682b4" size="-1"><xsl:value-of select="organisateur"/></font>'.
'</td>'.
'<td bgcolor="white">'.
'<font face="Verdana" color="#4682b4" size="-1"><xsl:value-of select="date"/></font>'.
'</td>'.
'<td bgcolor="white">'.
'<font face="Verdana" color="#4682b4" size="-1"><xsl:value-of select="heure"/></font>'.
'</td>'.
'<td bgcolor="white">'.
'<font face="Verdana" color="#4682b4" size="-1"><xsl:value-of select="lieu"/></font>'.
'</td>'.
'</tr>'.
'</xsl:template>'.
'</xsl:stylesheet>';
//Transformer XML -> HTML par XSL
$CurrentDir = dirname(__FILE__);
$xmldoc = domxml_open_file("$CurrentDir\\Reunions.xml");
$xsldoc = domxml_xslt_stylesheet ($StrXsl);
$result = $xsldoc->process($xmldoc);
print $xsldoc->result_dump_mem($result);
?>`
add a note
domxml_xslt_version domxml_xslt_stylesheet_file

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 09:32:46 2007 PST