This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
problem accessing parameters in templates without an <xsl:param> in Xalan 2.0
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] problem accessing parameters in templates without an <xsl:param> in Xalan 2.0
- From: "Durgavarjhula, Vasu" <vasud at ingenuity dot com>
- Date: Wed, 7 Feb 2001 14:50:39 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
In Xalan 1.2, i could pass a parameter from one template to another and then
call a 3rd template with
<xsl:with-param> without having another <xsl:param> in the 2nd template. it
used to work in Xalan 1.2. but in Xalan 2.0, i have to first define an
<xsl:param> and then pass it down. Is this a feature or a bug ? I know the
XSLT spec
says, parameters are ignored when there is no explcit <xsl:param> in a
template. but i liked the default feature in
previous version of Xalan.
eg
this works in Xalan 1.2.2 but not in Xalan 2.0
<xsl:template name="company" mode="process">
<xsl:param name="testVar" select="1"/>
<xsl:apply-templates select="person" mode="process">
<xsl:with-param name="testVar" select="$testVar"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template name="person" mode="process">
<xsl:apply-templates select="address" mode="process">
<xsl:with-param name="testVar" select="$testVar"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template name="address" mode="process">
<xsl:value-of select="$testVar"/>
</xsl:template>
to make the above code work in Xalan 2.0 I had to do this
<xsl:template name="person" mode="process">
<xsl:param name="testVar" select="$testVar"/>
<xsl:apply-templates select="address" mode="process">
<xsl:with-param name="testVar" select="$testVar"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template name="address" mode="process">
<xsl:param name="testVar" select="$testVar"/>
<xsl:value-of select="$testVar"/>
</xsl:template>
-Vasu
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list