Subject: Re: [xsl] Which is less expensive group by or select distinct-values From: "Tony Graham tgraham@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 16 Jul 2016 11:53:50 -0000 |
So I have a large document that I need to pull a list of unique values from a given element. These are taxonomy and term tag values from a 4,000 topic collection of DITA content.
Without knowing how these are implemented, is there something I should be able to intuit just from the spec? This is some code that I inherited and it wouldn't have been how I would have attacked the problem:
<xsl:variable name="TermList"> <xsl:value-of select="distinct-values(.//term[not(@keyref)])" separator=", " /> </xsl:variable> <data type="topicreport" name="WDTermList"> <xsl:for-each select="tokenize(normalize-space($TermList), ', ')"> <xsl:sort select="." /> <xsl:value-of select="."/> <xsl:if test="position() != last()">, </xsl:if> </xsl:for-each> </data>
<data type="topicreport" name="WDTermList"> <xsl:value-of separator=", "> <xsl:perform-sort select="distinct-values(key('terms', true()))"> <xsl:sort select="." /> </xsl:perform-sort> </xsl:value-of> </data>
Tony Graham. -- Senior Architect XML Division Antenna House, Inc. ---- Skerries, Ireland tgraham@xxxxxxxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Which is less expensive g, Dan Vint dvint@xxxxx | Thread | Re: [xsl] Which is less expensive g, Dan Vint dvint@xxxxx |
Re: [xsl] Which is less expensive g, Dan Vint dvint@xxxxx | Date | Re: [xsl] Which is less expensive g, Dan Vint dvint@xxxxx |
Month |