Subject: RE: parameter problems
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Sat, 7 Jul 2001 11:13:47 +0100
|
You need to include
<xsl:param name="fmt"> at the start of the second template rule.
However, it would be much cleaner to use modes: declare two template rules
<xsl:template match="faq" mode="format">
<xsl:template match="faq" mode="no-format">
and call them by specifying the appropriate mode in the
<xsl:apply-templates> call.
Mike Kay
Software AG
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> Mark Edwards
> Sent: 07 July 2001 05:01
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: parameter problems
>
>
> hi.
>
> I have a stylesheet fragment here....
>
> <xsl:template match="faqs">
> <table border="2" width="100%">
> <tr><td>
> <xsl:apply-templates select="faq">
> <xsl:with-param name="fmt">
> <xsl:value-of select="'yes'" />
> </xsl:with-param>
> </xsl:apply-templates>
> </td></tr>
> <tr><td>
> <xsl:apply-templates select="faq" >
> <xsl:with-param name="fmt">
> <xsl:value-of select="'no'" />
> </xsl:with-param>
> </xsl:apply-templates>
> </td></tr>
> </table>
> </xsl:template>
>
> <xsl:template match="faq">
> <xsl:choose>
> <xsl:when test="$fmt='yes'">
> <b><xsl:value-of select="question"/></b><br />
> </xsl:when>
> <xsl:otherwise>
> <b><xsl:value-of select="question"/></b><br />
> <xsl:value-of select="answer"/><br />
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
> however my XSLT transformer cannot recognise the variable '$fmt'.
> Please forgive what may be an obvious question - I'm new to
> this... but....
> Am I doing something wrong here?
>
> If have also tried:
>
> <xsl:with-param name="fmt" select="'yes'" />
>
> instead of
>
> <xsl:with-param name="fmt">
> <xsl:value-of select="'yes'" />
> </xsl:with-param>
>
>
> Any help would be much appreciated.
>
> Mark.
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|