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]

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


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

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