xsl-list
[Top] [All Lists]

RE: <xsl:with-param> does not work with <xsl:apply-templates>

2005-03-01 01:34:25
Hi,

I'm trying to use <xsl:with-param> together with 
<xsl:apply-templates>.

XML-File:
*<?xml version="1.0"?>
<Building>
    <Floor>
        <Room>
            <number>1</number>
            <wall_IDs>
                <wall_ID>123</wall_ID>
                <wall_ID>234</wall_ID>
                <wall_ID>345</wall_ID>
                <wall_ID>456</wall_ID>
            </wall_IDs>
        </Room>
        <Room>
            <number>2</number>
            <wall_IDs>
                <wall_ID>123</wall_ID>
                <wall_ID>678</wall_ID>
                <wall_ID>789</wall_ID>
                <wall_ID>901</wall_ID>
            </wall_IDs>
        </Room>
    </Floor>
    <Wall_List>
        <Wall ID="123">
            <width>2</width>
        </Wall>
        <Wall ID="234">
            <width>3</width>
        </Wall>
        <Wall ID="345">
            <width>2</width>
        </Wall>
        <Wall ID="456">
            <width>1</width>
        </Wall>
    </Wall_List>
</Building>

*XSL-File:
*<?xml version='1.0'?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template name="Room" match="Room">
    <!-- ... -->
    <xsl:for-each select="wall_IDs/wall_ID">
        <xsl:variable name="wall_ID" select="."/>
        <xsl:apply-templates select="/Building/Wall_List/Wall">
            <xsl:with-param name="wallID" select="$wall_ID"/>
        </xsl:apply-templates>
    </xsl:for-each>
</xsl:template>

<xsl:template name="Wall" match="Wall">
    <xsl:param name="wallID"/>
    <!-- ... -->
</xsl:template>

</xsl:stylesheet>

*In the "Room" Template I create a variable with the current 
wall-ID and 
I can view it by calling <xsl:value-of>. Then I use 
<xsl:with-param> to 
put the variable in the "Wall" template. And this doesn't 
work. In the 
"Wall" Template it has no value.
Why? I think <xsl:with-param> must work with <xsl:apply-templates>?!

Works for me, if I print out the string value of $wallID in the "Wall" 
template, I get the ID as expected. Is that the stylesheet that doesn't work, 
or is there something you're not showing us?

Cheers,

Jarno - Chris C: The Zurich Mix

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>