[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] sort a node across a dynamic group of files


Subject: Re: [xsl] sort a node across a dynamic group of files
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 22 Nov 2009 15:06:20 -0500

BTW, I prematurely sent my example without explaining why I put the items in a variable.

At 2009-11-22 14:57 -0500, I wrote:
      <!--$docs is ready with all documents-->
      <!--sort by name-->
      <xsl:variable name="names" select="$docs/doc/name"/>
      <xsl:for-each select="$names">
        <xsl:sort select="."/>
        <xsl:text>
</xsl:text>
        <xsl:value-of select="."/>
      </xsl:for-each>

Of course you don't need the variable above, you can just work with:


     <xsl:for-each select="$docs/doc/name">
        <xsl:sort select="."/>
        ...

But I had it in my mind you were asking about *grouping* across files and not just *sorting* across files. If you needed to group by common names, then putting them in a variable would allow you to find the common names and group under them as common headings.

Here are posts from 2004 and 2006 that show what you can do for grouping once you have the variable loaded from multiple files:

 http://www.biglist.com/lists/xsl-list/archives/200410/msg00412.html
 http://www.stylusstudio.com/xsllist/200603/post70000.html

But in the end I realized you weren't asking for grouping and I failed to undo the preparations I had made.

I hope this helps.

. . . . . . . . . Ken

--
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


Current Thread
Keywords
xml