This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: passing top level param?


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]