Re: [xsl] Xalan and command-line parameters

Subject: Re: [xsl] Xalan and command-line parameters
From: JBryant@xxxxxxxxx
Date: Tue, 14 Jun 2005 12:26:20 -0500
Hi, Dan,

I got it work with a slightly modified version of your XSL file like this:

java -cp /fop-0.20.5/lib/xalan-2.4.1.jar org.apache.xalan.xslt.Process -in 
path.xml -xsl paramtest.xsl -out paramtest.txt -param myParameter test

Naturally, you'll need to use the correct path to the xalan jar file on 
your computer.

Here's the XSL I used:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="text"/>

<xsl:param name="myParameter"/>

<xsl:template match="/">
  <xsl:text>You set the parameter to: </xsl:text><xsl:value-of 
select="$myParameter"/>
</xsl:template>

</xsl:stylesheet>

You had <text> rather than <xsl:text>. An XSL processor will try to 
process that as a literal result element and, since your output method is 
text, ignore it.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




Dan <dan@xxxxxxxxxxxxxxxx> 
06/14/2005 12:05 PM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc

Subject
[xsl] Xalan and command-line parameters






I'm having trouble passing command-line parameters to a stylesheet, but
I've searched your archives and I can't find anything wrong with it, so
maybe someone can point out the problem.

I invoke the stylesheet like this:

xalan -IN chapters.xml -XSL param.xsl -OUT foo.txt \
      -PARAM myParameter the-value

------ stylesheet -----

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="text"/>

<xsl:param name="myParameter"/>

<xsl:template match="/">
  <text>
You set the parameter to:
  </text>
<xsl:value-of select="$myParameter"/>
</xsl:template>

</xsl:stylesheet>

-- 
    People say I am ruthless. I am not ruthless. And if I find
    the man who is calling me ruthless, I shall destroy him.
         - Robert Kenedy, campaigning for the U.S. Senate in 1964

Current Thread