[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Legal Match ?

Subject: Re: Legal Match ?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 14 Mar 2003 17:39:12 +0000
legal match
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.