|
Subject: RE: [xsl] Comparing One element's text to multiple elements' text From: "Kenny Akridge" <kenny@xxxxxxxxxxxxxxxxx> Date: Fri, 7 May 2004 00:09:18 -0400 |
The first problem you have is [*]. You should change this to value2/*. This
means it will check all children of value2.
The next problem is the context of your template. You are looking at "/".
In this case, you are testing value1 = value2/*. The problem is that "/" is
not the same as <root>. So you can do one of two things:
<xsl:template match="root">
<xsl:if test="value1 = value2/*">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:template>
or
<xsl:template match="/">
<xsl:if test="//value1 = //value2/*">
<xsl:text>true</xsl:text>
</xsl:if>
</xsl:template>
Good luck to you.
-Kenny Akridge
-----Original Message-----
From: Daniel Joshua [mailto:daniel.joshua@xxxxxxxxxxxx]
Sent: Thursday, May 06, 2004 11:49 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Comparing One element's text to multiple elements' text
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Comparing One element's text , Daniel Joshua | Thread | RE: [xsl] Comparing One element's t, Michael Kay |
| [xsl] Comparing One element's text , Daniel Joshua | Date | RE: [xsl] Comparing One element's t, Daniel Joshua |
| Month |