This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: passing parameters from one template to the other
- From: "Joerg Heinicke" <joerg dot heinicke at gmx dot de>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 5 Apr 2002 08:49:33 +0200
- Subject: Re: [xsl] passing parameters from one template to the other
- References: <5.1.0.14.0.20020404214727.009fcec0@mail.unique.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
<xsl:apply-templates
select="document(concat('C:\ralph\xml schemas\itn\', $name, '.xml'))">
<xsl:with-param name="title">
<xsl:value-of select="text" />
</xsl:with-param>
</xsl:apply-templates>
I think the error is in the code above (in the first template). You apply
templates on the document or more exactly: on the root node of the document.
But the second template matches on newsdoc element. So in which way the
title-param shell come from template matching / to template matching
newsdoc? I think you should change the select attribute of apply-templates
to
select="document(concat('C:\ralph\xml schemas\itn\', $name,
'.xml'))/newsdoc"
, if newsdoc is the root element of the document.
The general way:
<xsl:template match="foo">
<xsl:apply-templates select="bar">
<xsl:with-param name="test" select="'ABC'"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="bar">
<xsl:param name="test"/>
<xsl:value-of select="$test"/>
</xsl:template>
Hope this helps,
Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list