|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How do you select all unique first-position charac
I'm not sure if this what your going for, but the template below can either retrieve you a text list (see comments) or a nodelist containing the nodes of the all unique first letters where the assumption is which person node it is doesn't matter. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <report-data> <xsl:variable name="slist"> <xsl:for-each select="//person"> <xsl:sort data-type="text" order="ascending" case-order="upper-first" select="@name"/> <xsl:choose> <xsl:when test="position()=1"> <xsl:copy-of select="."/> <!--<xsl:value-of select="substring(@name,1,1)"/>--> </xsl:when> <xsl:when test="position() < last()"> <xsl:if test="substring(@name,1,1) != substring(preceding-sibling::*[1]/@name,1,1) and substring(@name,1,1) != substring(following-sibling::*[1]/@name,1,1)"> <xsl:copy-of select="."/> <!--<xsl:value-of select="substring(@name,1,1)"/>--> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="substring(@name,1,1) != substring(preceding-sibling::*[1]/@name,1,1)"> <xsl:copy-of select="."/> <!--<xsl:value-of select="substring(@name,1,1)"/>--> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:variable> <xsl:copy-of select="$slist"/> </report-data> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






