[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: parameter problems
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|