This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How do you specify multiple attributes when using for-each?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]