This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
passing and retrieving parameter to a template
- From: "Najmi, Jamal" <Jamal dot Najmi at Artesia dot com>
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 16 Apr 2002 13:00:54 -0400
- Subject: [xsl] passing and retrieving parameter to a template
- Reply-to: xsl-list at lists dot mulberrytech dot com
I have a variable defined in one template. This variable actually contains
the value of an attribute. I am passing the value of this variable as a
parameter to another template. But when I retrieve the value of the
variable it is empty.
I have been banging my head for a while on this. Please help!!
Thanks
Jamal
Following is the code snippet:
<xsl:template
match="/xs:schema/xs:element/xs:complexType/xs:sequence/xs:element">
<xsl:variable name="sectionShortName"><xsl:value-of
select="./@name"></xsl:value-of></xsl:variable> //assigning value
<h1><xsl:value-of
select="/xs:schema/xs:annotation/xs:appinfo/dne:template/dne:constrainedElem
ent[@name=$sectionShortName]/dne:constraint/@label"/></h1>
<blockquote>
<blockquote>
<blockquote>
<p> </p>
<table width="64%" border="0" align="center">
<xsl:value-of select = "$sectionShortName" />
<xsl:apply-templates>
<xsl:with-param name = "sectionShortNameParam"
select="$sectionShortName"/> // passing value
</xsl:apply-templates>
</table>
<p> </p>
</blockquote>
</blockquote>
</blockquote>
</xsl:template>
<xsl:template
match="/xs:schema/xs:element/xs:complexType/xs:sequence/xs:element/xs:comple
xType/xs:sequence/xs:element">
<xsl:param name = "sectionShortNameParam" /> // declaring
local parameter
<xsl:value-of select = "$sectionShortNameParam" /> // retrieving
value
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list