XSLT/XPath: How to display single node occurence
I'm working on a for-each element that will display only one occurrence of a name node, even if there are several occurences of that name in the XML doc. Here's an example of what I need:
XSLT FOR-EACH ELEMENT:
<xsl:for-each select="root/name"><!-- <<<<---something is missing here -->
<xsl:value-of select="." /><br />
I'll continue to work on a possible solution until/if I hear get from someone else. Thanks for any help.
I was able to come up with a solution that works in 1.0, and here it is:
<xsl:for-each select="root/name[not(text() = ../preceding-sibling::name/text())]">
Another user noted that if I was using 2.0, I could use the distinct-values function. Just another reason why I need to upgrade soon. Anyway, thanks.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)