Re: passing top level param?

Subject: Re: passing top level param?
From: Michel CASABIANCA <casa@xxxxxx>
Date: 31 Mar 2000 11:01:50 +0200
Hi

"Martin Algesten" <martin.algesten@xxxxxxxx> 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@xxxxxx        | 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


Current Thread