Re: [xsl] Combining two XBEL XML files

Subject: Re: [xsl] Combining two XBEL XML files
From: "Vladimir Nesterovsky" <vladimir@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 13 Jul 2008 20:33:01 -0700
> One may emulate
> 
> <xsl:for-each-group select="$folders"
group-by="title">
> <xsl:sort select="current-grouping-key()"/>
> ...
>
</xsl:for-each-group>
> 
> with
> 
> <xsl:for-each
select="$folders/title">
> <xsl:sort select="."/>
> 
> <xsl:for-each
select="$folders[title = current()]">
> ...
> </xsl:for-each>
>
</xsl:for-each>

To be more precise the code is:

<xsl:for-each
select="$folders/title">
  <xsl:sort select="."/>

  <xsl:variable
name="key" select="."/>
  <xsl:variable name="group" select="$folders[title =
$key]"/>

  <xsl:if select="generate-id($key) =
generate-id($group[1]/title)">
    ... $key, $group ...
  </xsl:if>
</xsl:for-each>

--
Vladimir Nesterovsky

> > Aaron Gray wrote:
> > 
>
>> Whats the differences that stop it running on 1.0 ?
> > 
> > Doing it
with XSLT 1.0 is more difficult, with XSLT 2.0 and 
> > xsl:for-each-group
you can easily group folder and bookmark elements 
> > from different
documents while Muenchian grouping in XSLT 1.0 is key 
> > based and keys are
built for each document only. So with XSLT 1.0 you 
> > might want to do two
transformations, the first one merging the two 
> > documents into one, the
second one doing grouping to get rid of 
> > duplicates and sorting.
> > --
> > Martin Honnen
> > http://JavaScript.FAQTs.com/

Current Thread