G
Gendag
Hi all,
I have a simple xml file:
<imgs>
<img name="1"/>
<img name="2"/>
<img name="3"/>
<img name="4"/>
</imgs>
And i have the following (simplified) XSLT:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/imgs>
<for-each select="img">
<for-each select="../img">
<xsl:choose>
<xsl:when test="???">
<span style="color: red;">
<xsl:value-of select="@name"/>
</span>
</xsl:when>
<xsltherwise>
<xsl:value-of select="@name"/>
</xsltherwise>
</xsl:choose>
</for-each>
</for-each>
</xsl:template>
</xsl:stylesheet>
What I want to do is: for each IMG, print _all_ the IMG and if the IMG
in the second for-each is equal to the IMG in the first for-each, color
it of red. But how can I say with XPath "if the IMG name in equal to the
name of the IMG in the outer for-each"? I remember that there is the
possibility to express it with XPath, but i don't remember how.
Thx!
Gendag
I have a simple xml file:
<imgs>
<img name="1"/>
<img name="2"/>
<img name="3"/>
<img name="4"/>
</imgs>
And i have the following (simplified) XSLT:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/imgs>
<for-each select="img">
<for-each select="../img">
<xsl:choose>
<xsl:when test="???">
<span style="color: red;">
<xsl:value-of select="@name"/>
</span>
</xsl:when>
<xsltherwise>
<xsl:value-of select="@name"/>
</xsltherwise>
</xsl:choose>
</for-each>
</for-each>
</xsl:template>
</xsl:stylesheet>
What I want to do is: for each IMG, print _all_ the IMG and if the IMG
in the second for-each is equal to the IMG in the first for-each, color
it of red. But how can I say with XPath "if the IMG name in equal to the
name of the IMG in the outer for-each"? I remember that there is the
possibility to express it with XPath, but i don't remember how.
Thx!
Gendag