This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How do you specify multiple attributes when using for-each?
- From: Kathryn dot Grant at freight dot fedex dot com
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 26 Jul 2002 16:52:12 -0700
- Subject: [xsl] How do you specify multiple attributes when using for-each?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi all,
Here's a snippet from a simple xml file, which contains records for the US,
Canada, and Mexico:
<statecodes>
<coderec country="us">
<descr>ALABAMA</descr>
<code>AL</code>
<tndm_code>AL</tndm_code>
<nbr>01</nbr>
</coderec>
<coderec country="us">
<descr>ALASKA</descr>
<code>AK</code>
<tndm_code>AK</tndm_code>
<nbr>02</nbr>
</coderec><coderec country="canada">
<descr>SASKATCHEWAN</descr>
<code>SK</code>
<tndm_code>SW</tndm_code>
<nbr>59</nbr>
</coderec>
<coderec country="mex">
<descr>TLAXCALA</descr>
<code>TL</code>
<tndm_code>TL</tndm_code>
<nbr>NA</nbr>
</coderec>
</statecodes>
I have an XSL style sheet that selects only US records with the following
for-each statement.
<xsl:for-each select="//statecodes/coderec[@country='us']">
Now I need to create a new transformation that selects both US and Canadian
records. I have been looking for several hours for the way to specify
multiple attributes, but have been unsuccessful. I tried
<xsl:for-each select="//statecodes/coderec[@country='us' | 'canada']">
thinking that a Boolean "or" might work--but it didn't. Any help would be
appreciated!
Kathryn
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list