This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: passing top level param?
- To: xsl-list at mulberrytech dot com
- Subject: Re: passing top level param?
- From: Michel CASABIANCA <casa at sdv dot fr>
- Date: 31 Mar 2000 11:01:50 +0200
- Cc: <XSL-List at mulberrytech dot com>
- References: <021001bf9ae7$8b68d750$1fc7080a@sursmurf>
- Reply-To: xsl-list at mulberrytech dot com
Hi
"Martin Algesten" <martin.algesten@ibfs.com> writes:
> The XSL Transformation v1.0 spec says about passing top level params:
> "XSLT does not define the mechanism by which parameters are passed to the
> stylesheet"
>
> Does anyone now if any xslt processors does this?
XT does. You can pass parameters to the processor with param=value
argument. You must have a top level xsl:param element with the same
name. Thus, this stylesheet :
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:param name="param">default</xsl:param>
<xsl:template match="/">
<xsl:call-template name="test"/>
</xsl:template>
<xsl:template name="test">
<xsl:value-of select="$param"/>
</xsl:template>
</xsl:stylesheet>
called with any xml file like this :
java com.jclark.xsl.sax.Driver test.xml test.xsl param=value
Will output "value".
--
+---------------------------+--------------------------------+
| Michel CASABIANCA | http://www.sdv.fr/pages/casa |
| mailto:casa@sdv.fr | Articles sur Java et XML |
| Développement Java et XML | Applications et Applets de Jeu |
+---------------------------+--------------------------------+
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list