Per the XSLT spec (http://www.w3.org/TR/xslt.html#local-variables),
xsl:param is allowed inside a template only at the beginning of the
template. Move it to right after the xsl:template element and you
should be fine.
Gary
Chris Garver wrote:
>
> To whom it may concern,
>
> My name is Chris Garver, and I'm relatively new with using Xalan. I'm
> currently attempting to use the Process.java program to transform a
> document using XLST. However, Process.java doesn't seem to accept the
> "xsl:param" tag when I use it. I've prepared a small example and provided
> the output that Process.java produces:
>
> <?xml version='1.0' encoding='utf-8' ?>
> <xsl:stylesheet version = "1.0" xmlns:xsl =
> "http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml"/>
>
> <xsl:template match="/">
> <xsl:element name="foo">
> <xsl:attribute name="name">
> <xsl:param name="theName">Bar</xsl:param>
> <xsl:value-of select="$theName"/>
> </xsl:attribute>
> </xsl:element>
> </xsl:template>
>
> </xsl:stylesheet>
>
> file:///C:/smallExample.xsl; Line14; Column 30;
> XSLT Error (javax.xml.transform.TransformerConfigurationException):
> xsl:param is not allowed in this position in the stylesheet!
>
> Line 14 corresponds with the "xsl:param" tag. Stylus Studio, which only
> tests XLST code and doesn't produce any output, runs this without a
> problem. What I would like to know is whether "xsl:param" is accepted by
> Process.java anymore. If it is, then I need to find out what I'm doing
> wrong in the above sample. If it isn't, I'd like to find out how I can
> pass variables into templates, similar to how "xsl:with-param" did within
> "xsl:call-template".
>
> At any rate, thanks in advance for any assistance I receive in this matter.
>
> Chris Garver