xsl-list
[Top] [All Lists]

Re: tokenize(), grouping problem

2005-04-22 15:23:35
On 4/22/05, Jon Crump <jjcrump(_at_)u(_dot_)washington(_dot_)edu> wrote:

I can use tokenize() to split the strings at the semicolon, but how can I
then use the result in a for-each-group group-by procedure to output the
unique values?

I've still not managed to work out my grouping problem, but this is at
least most a solution for your's:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0">
    <xsl:template match="data">
        <data>
            <xsl:for-each-group select="record/subjects"
group-by="tokenize(., '; ')">
                <subject>
                    <xsl:value-of select="current-grouping-key()"/>
                </subject>
            </xsl:for-each-group>
        </data>
    </xsl:template>
</xsl:stylesheet>

Bruce

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>