Check if a field matches "any" of a set of other entries

Subject: Check if a field matches "any" of a set of other entries
From: Gerard Berthet <gberthet@xxxxxxxxxxxxxxx>
Date: Wed, 03 May 2000 01:37:34 -0700
How can I check if a value matches any of a set of other values?
Here is an example XML:

<document>
  <references>
    <ref>a</ref>
    <ref>b</ref>
    <ref>c</ref>
  </references>
  <data>
    <entry>x</entry>
    <entry>b</entry>
    <entry>a</entry>
    <entry>z</entry>
  </data>
</document>

I want to print each entry in bold if it exists in the
list of references, otherwise I want to print it in italics.
Here is my pseudo-xml code:

<xsl:for-each select="/document/data/entry">
  if entry/text() equals any of the values in <references>
  set flag=true;
</xsl:for-each>

<xsl:if test(flag is true)>
   print the value in bold
otherwise
   print the value in italics
</xsl:if>

Can I do that in XSL?

Gerard Berthet


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread