I tried to get the unique node names, but its not working properly...Am attaching my xslt here for ref... please have a look on the below provided and help me to find a solution asap.
Guys, Finally I Found the Solution for this any way this post helped me to find the solution http://goo.gl/XvvwN
also am pasting the codes here for ref.
<xsl:param name="currentPage"/> <!-- set variables --> <xsl:variable name="categoryNode" select="$currentPage/ancestor-or-self::*[@isDoc]" /> <xsl:variable name="categoryN" select="$categoryNode//*[@isDoc and @level=4 and name()='CategoryArea']" /> <!-- 'bunch' all of the categories together into one variable (comma delimited)... --> <xsl:variable name="cty"> <xsl:for-each select="$categoryN"> <xsl:value-of select="@nodeName"/> <xsl:if test="position()!=count($categoryN)">,</xsl:if> </xsl:for-each> </xsl:variable>
<xsl:template match="/"> <!-- output all the 'unique' values from the above list... --> <xsl:for-each select="umbraco.library:Split($cty,',')//value[not(.=following::value)]"> <xsl:sort select="current()"/> <xsl:if test="current()!=''"> <!-- this is to avoid getting the 'blank' tag from the dataType --> <a href="/c/{Exslt.ExsltStrings:replace(current(), ' ', '-')}.aspx" rel="{current()}"> <xsl:value-of select="current()"/> </a><br/> </xsl:if> </xsl:for-each> </xsl:template>
Select DISTINCT or Getting A Unique List
Hey,
I tried to get the unique node names, but its not working properly...Am attaching my xslt here for ref... please have a look on the below provided and help me to find a solution asap.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:key name="uniqCategory" match="node" use="@nodeName"/>
<xsl:template match="/">
<xsl:variable name="categoryNode" select="$currentPage/ancestor-or-self::*[@isDoc]" />
<xsl:variable name="categoryN" select="$categoryNode//*[@isDoc and @level=4 and name()='CategoryArea']" />
<xsl:for-each select="$categoryN/node [generate-id() = generate-id(key('uniqCategory', @nodeName)[1])]">
- <xsl:value-of select="@nodeName"/><br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Guys, Finally I Found the Solution for this any way this post helped me to find the solution http://goo.gl/XvvwN
also am pasting the codes here for ref.
<xsl:param name="currentPage"/>
<!-- set variables -->
<xsl:variable name="categoryNode" select="$currentPage/ancestor-or-self::*[@isDoc]" />
<xsl:variable name="categoryN" select="$categoryNode//*[@isDoc and @level=4 and name()='CategoryArea']" />
<!-- 'bunch' all of the categories together into one variable (comma delimited)... -->
<xsl:variable name="cty">
<xsl:for-each select="$categoryN">
<xsl:value-of select="@nodeName"/>
<xsl:if test="position()!=count($categoryN)">,</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:template match="/">
<!-- output all the 'unique' values from the above list... -->
<xsl:for-each select="umbraco.library:Split($cty,',')//value[not(.=following::value)]">
<xsl:sort select="current()"/>
<xsl:if test="current()!=''"> <!-- this is to avoid getting the 'blank' tag from the dataType -->
<a href="/c/{Exslt.ExsltStrings:replace(current(), ' ', '-')}.aspx" rel="{current()}">
<xsl:value-of select="current()"/>
</a><br/>
</xsl:if>
</xsl:for-each>
</xsl:template>
is working on a reply...