This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: passing parameters from one template to the other


<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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]