[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Merging lines of 3 words or less

Subject: Re: Merging lines of 3 words or less
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 8 Sep 2005 11:53:12 +0100
xsl return n words
> 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[@n='44.6']/l[@n='3'] |
 lg[@n='100.8']/l[@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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.