Re: [xsl] passing parameters from one template to the other

Subject: Re: [xsl] passing parameters from one template to the other
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Fri, 5 Apr 2002 08:49:33 +0200
<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


Current Thread