laurentngu
laurentngu

Reputation: 367

How to write a query in XSLT2.0 using variables?

I want to use 2 variables called SOURCE and DEST. In that manner my perl script will use

SOURCE="Bonn";

DEST="Berlin";

Then I will call the xslt2.0 transformation from my perl script.

<xsl:param name="SOURCE"/>
<xsl:param name="DEST"/>

<xsl:variable name="start" select="//S[@id=$SOURCE]/T[@id=$DEST]"/>

<!--<xsl:variable name="start" select="//S[@id='Paris']/T[@id='London']"/> -->

It happens that I do not write correctly the line (as this xslt foes not return any rows):

<xsl:variable name="start" select="//S[@id=$SOURCE]/T[@id=$DEST]"/>

Could you kindly correct my XSLT syntax ?

Upvotes: 0

Views: 172

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167706

I think the problem is simply calling Saxon the right way, if you use the command line interface then I think you need to use e.g. transform.exe -s:file.xml -xsl:sheet.xsl -o:result.xml SOURCE=Bonn DEST=Berlin.

Upvotes: 2

Related Questions