xsl-list
[Top] [All Lists]

Re: Aw: [xsl] Which is less expensive group by or select distinct-values

2016-07-15 15:18:33
On 15.07.2016 22:12, Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de wrote:
On 15.07.2016 21:39, dvint dvint(_at_)dvint(_dot_)com wrote:
I need a formated and sorted string

Yes, I understand, but the result of distinct-values() can be sorted
directly with e.g


<data type="topicreport" name="WDTermList">
  <xsl:for-each select="distinct-values(.//term[not(@keyref)])">
    <xsl:sort select="." />
    <xsl:value-of select="."/>
         <xsl:if test="position() != last()">, </xsl:if>
   </xsl:for-each>
</data>

or if you want a variable with e.g.

<xsl:variable name="TermList"
select="distinct-values(.//term[not(@keyref)])" />

<data type="topicreport" name="WDTermList">
  <xsl:for-each select="$TermList">
    <xsl:sort select="." />
    <xsl:value-of select="."/>
         <xsl:if test="position() != last()">, </xsl:if>
   </xsl:for-each>
</data>



Or directly with perform-sort.

Like this:

                <xsl:value-of separator=",">
                        <xsl:perform-sort 
select="distinct-values(.//term[not(@keyref)])">
                                <xsl:sort select="."></xsl:sort>
                        </xsl:perform-sort>
                </xsl:value-of>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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