[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Legal Match ?
Subject: Re: [xsl] Legal Match ? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 14 Mar 2003 17:39:12 +0000 |
Hi Karl, > Is this a legal match? > <xsl:apply-templates select="z:row[@CreditStatus='$CREDIT_STATUS;']"/> > > Where $CREDIT_STATUS is a global variable. It wouldn't matter whether you had a $CREDIT_STATUS global variable or not -- the 's around $CREDIT_STATUS mean that you're just selecting those z:row elements whose CreditStatus attribute has the string value "$CREDIT_STATUS;". If you meant: <xsl:apply-templates select="z:row[@CreditStatus = $CREDIT_STATUS]"/> then yes, that's legal, and it *selects* (not matches) those z:row elements whose CreditStatus attribute's value is the same as the value of the $CREDIT_STATUS variable. > If so... what does the template rule look like? Something like: > > <xsl:template match="z:row[@CreditStatus='$CREDIT_STATUS;']> > .... > </xsl:template match> You're not allowed to refer to variables within the match attribute of <xsl:template> in XSLT 1.0 (XSLT 2.0 lifts this restriction). But as long as you only apply templates to the z:row elements that you're interested in, that shouldn't matter; you can match them with a variety of templates, but it's most likely that you'll want to do: <!-- match all z:row elements --> <xsl:template match="z:row">...</xsl:template> or: <!-- match those z:row elements with a CreditStatus attribute --> <xsl:template match="z:row[@CreditStatus]">...</xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Legal Match ?, David Carlisle | Thread | [xsl] Choose Test for Emtpy element, Karl Stubsjoen |
Re: [xsl] Legal Match ?, David Carlisle | Date | Re: [xsl] Cold Fusion, Mike Brown |
Month |
Keywords