xsl-list
[Top] [All Lists]

Re: Merging lines of 3 words or less

2005-09-08 03:53:12


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(),' ')"/>
</xsl:for-each>

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


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:for-each>
<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[(_at_)n='44.6']/l[(_at_)n='3'] |
 lg[(_at_)n='100.8']/l[(_at_)n='4'] 
">

David


________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

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