xsl-list
[Top] [All Lists]

Comparing One element's text to multiple elements' text

2004-05-06 20:48:56
Hi,

I would like to compare one element's text value to a group of multiple
elements' text values. I tried, but I think I am not comparing the text
portion correctly.

Simplified XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<root>
  <value1>ABC</value1>
  <value2>
    <option>ABC</option>
    <option>DEF</option>
    <option>HIJ</option>
  </value2>
</root>

Simplified XSL:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:template match="/">
    <xsl:if test="value1 = value2/option[*]">
      <xsl:text>true</xsl:text>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>


Regards,
Daniel