
16/06/2005, 05:01
|
| | Fecha de Ingreso: marzo-2005
Mensajes: 20
Antigüedad: 20 años Puntos: 0 | |
Lo tengo declarado con with-param:
Codigo XSL:
-------------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" indent="no"/>
<xsl:template match="collection">
Hey! Welcome to my sweet CD collection!
<xsl:apply-templates select="cd">
<xsl:with-param name="valor"/><xsl:value-of select="$tipo"/>
</xsl:with-param>
</xsl:apply-template>
</xsl:template>
<xsl:template match="cd">
<h1><xsl:value-of select="$valor"/></h1>
</xsl:template>
</xsl:stylesheet>
--------------------------------
Codigo XML:
------------------
<collection>
<cd>
<title>Titulo 1</title>
<artist>Artista 1</artist>
<year>2005</year>
</cd>
<cd>
<title>Titulo 2</title>
<artist>Artista 2</artist>
<year>2005</year>
</cd>
</collection>
-----------------------
Codigo PHP:
---------------------
<?php
$tipo=$HTTP_GET_VARS['tipo'];
/* Load the two XML sources */
$xml = new DomDocument; // from /ext/dom
$xml->load('example.xml');
$xsl = new DomDocument;
$xsl->load('example.xsl');
/* Configure the transformer */
$proc = new xsltprocessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
$proc->setParameter("",'tipo',$tipo);
echo $proc->transformToXML($xml); // actual transformation
?>
------------------ |