amsathishkumar Posted June 6, 2013 Share Posted June 6, 2013 how to find the unique value based on the attributes substringExample<sample name="ao1_test"><sample name="ao2_test">I need the unique value of attribute name after underscore that'sOnly "test" Link to comment Share on other sites More sharing options...
Martin Honnen Posted June 6, 2013 Share Posted June 6, 2013 With XSLT 2.0: <xsl:value-of select="distinct-values(//sample/@name/substring-after(., '_'))"/> With XSLT 1.0 you can use Muenchian grouping: <xsl:key name="k1" match="sample/@name" use="substring-after(., '_')"/> <xsl:template match="/"> <xsl:apply-templates select="//sample/@name[generate-id() = generate-id(key('k1', substring-after(., '_'))[1])]"/></xsl:template> <xsl:template match="sample/@name"> <xsl:if test="position() > 1"><xsl:text> </xsl:text></xsl:if> <xsl:value-of select="substring-after(., '_')"/></xsl:template> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now