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

Matching on of many string literal values using XPath

Subject: Matching on of many string literal values using XPath
From: Richard Rowell <richard@xxxxxxxxxxxxxxxxx>
Date: 12 Sep 2002 17:02:06 -0500
xpath string literal
I would like to select all nodes from a particular set of elements that
matches one of several values.  Is there a simpler way of doing it then
what is below?

  <xsl:template match="client/race[text()='white'] |
		       client/race[text()='black'] |
		       client/race[text()='asian'] |
		       client/race[text()='hispanic'] |
		       agencies/race_served[text=()='white'] |
		       agencies/race_served[text=()='black'] |
		       agencies/race_served[text=()='asian'] |
		       agencies/race_served[text=()='hispanic'] 
">   
   <xml:element name="{name()}"><xsl:value-of
select="concat('HUD:',text())"/></xsl:element>
  </xsl:template>

I would like to define all of the string literals (white,black,etc) in
one place (a variable?) then just specify the paths I want to match (or
not match) so the above match pattern would have only two entries
instead of eight (one for client/race and another for
agencies/race_served).

Thanks in advance.



 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.