xsl-list
[Top] [All Lists]

RE: [xsl] Multi-grouping with keys (back of book index)

2006-10-22 02:03:00
 
I am not sure how to go about it. Should I use a Key to index 
all the indexterms from all the XML files? 

xsl:key always works within a single document, but xsl:for-each-group works
on any sequence, including a sequence containing nodes from multiple
documents. So stick with for-each-group.

Here is my XSLT so far with the added Document function. All 
it does is loop through each XML but doesn't group all the 
indexterms into one:

<xsl:for-each select="$XML1">
      <xsl:for-each select="manual">
        <xsl:for-each select="title">
              <xsl:variable name="thetitle" select="."/>
                      <xsl:for-each-group
select="document($thetitle)//indexterm" 
group-by="substring(@name,1,1)">

Not sure of the details here, haven't got time to look into it: but you need
to move the for-each-group to the outer level, so it's processing a sequence
containing nodes from multiple documents. Something like

for-each-group select="$XML1/manual/title/document(.)//indexterm"

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
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>
--~--