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]

Matching on of many string literal values using XPath


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


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