This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Understanding difficulties with call-template
- To: <xsl-list at mulberrytech dot com>
- Subject: Re: Understanding difficulties with call-template
- From: "Benoit Cerrina" <benoit dot cerrina at writeme dot com>
- Date: Thu, 26 Oct 2000 08:55:13 +0200
- References: <Pine.BSF.4.21.0010251836080.17290-100000@shell8.ba.best.com>
- Reply-To: xsl-list at mulberrytech dot com
Hi don't see the need for the param, doesn't this work:
<xsl:template name="comma-block">
<xsl:for-each select="preferred-location">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="preferred-locations">
<xsl:element name="p">
Preferred Locations:
<xsl:call-template name="comma-block"/>
</xsl:element>
</xsl:template>
of course you probably wanted it in order to have a more resusable template
which would make sense.
Benoit
> OK got it working here this works.
>
> <xsl:template name="comma-block">
> <xsl:param name="nodes"/>
> <xsl:for-each select="$nodes">
> <xsl:value-of select="."/>
> <xsl:if test="position() != last()">, </xsl:if>
> </xsl:for-each>
> </xsl:template>
>
> <xsl:template match="preferred-locations">
> <xsl:element name="p">
> Preferred Locations:
> <xsl:call-template name="comma-block">
> <xsl:with-param name="nodes" select="preferred-location"/>
> </xsl:call-template>
> </xsl:element>
> </xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list