Subject: RE: [xsl] How do you select all unique first-position characters? From: Jeff Beadle <Jbeadle@xxxxxxxx> Date: Wed, 20 Nov 2002 17:39:15 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How do you select all uni, Wendell Piez | Thread | RE: [xsl] How do you select all uni, Greg Faron |
Re: [xsl] Split XML and output to d, Niko Matsakis | Date | Re: [xsl] How do you select all uni, Wendell Piez |
Month |