Re: [xsl] Merging lines of 3 words or less

Subject: Re: [xsl] Merging lines of 3 words or less
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 8 Sep 2005 11:53:12 +0100
> Then inside the recreated line for each of the current group (which is
> what at this point?)

current-group() return the sequence of items (that is things selcted by the 
xsl:for-each-group select="l") that are um in the current group (which
in this case means a group of adjacent line with just the first one
having a 4th word.

position() positions the groups (rather than teh items as it would in a
xsl:for-each) so
 <l n="{position()}">
does the right thing, then to get the content of the lines
<xsl:copy-of select="current-group()"/>
would actually give you back each of the l elements in the group, which
you don't want, you just want the contents of each of those lines so

<xsl:copy-of select="current-group()/node()"/>

would almost work but I wasn't sure if you needed to put a space at the
point that you joined the lines back so I did

<xsl:for-each select="current-group()">
<xsl:copy-of select="(node(),' ')"/>

which for each of the original lines copies all the children then adds a

that puts a space at the end as well so perhaps

<xsl:for-each select="current-group()[position()!=last()]">
<xsl:copy-of select="(node(),' ')"/>
<xsl:copy-of select="current-group()[position()=last()]/node()"/>

or something.

If you know that <lg n="44.6"><l n="3" and > <lg n="100.8"><l n="4">
really are short lines, then you can change things to

         <xsl:for-each-group select="l" group-starting-with="
 l[w[4]] |
 lg[@n='44.6']/l[@n='3'] |


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread