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

Group problem with blank elements

Subject: Group problem with blank elements
From: "Ed Yau" <eyau@xxxxxxxxxxxxxxx>
Date: Thu, 30 Jun 2005 18:30:32 +0100
ed yau
Hiya,

Having loads of trouble with this.  On the face of it a really easy
problem.
I have a bunch of elements like so:

<statement-message>Your account is now seriously in arrears.
To</statement-message>

<statement-message>avoid further action a payment of</statement-message>

<statement-message>$82.00 is required immediately.
Any</statement-message>

<statement-message>purchases will now be declined.</statement-message>

<statement-message>
</statement-message>

<statement-message>  More text </statement-message>

<statement-message>
</statement-message>

<statement-message>
</statement-message>

<statement-message>
</statement-message>

I want to strip out the empty tags and merge adjacent elements as
follows:

<statement-message> Your account is now seriously in arrears. To avoid
further action a payment of
82.00 is required immediately. Any purchases will now be
declined.</statement-message>

<statement-message>  More text </statement-message>

My code at the moment is:
<xsl:for-each-group select="statement-message"
group-ending-with="statement-message[string-length(normalize-space(follo
wing-sibling::statement-message[1]))=0]">
	<statement-message>
		<xsl:value-of select="."/>
	</statement-message>
</xsl:for-each-group>

My understanding of this is that it should start grouping from the 1st
statement message, with the groups ending as soon as an empty element is
reached.  The empty tags at the end would still be there, but at least
it should do the merge.  However, the result looks like:

     <statement-message>Your account is now seriously in arrears.
To</statement-message>
     <statement-message>
     </statement-message>
     <statement-message>  More text </statement-message>
     <statement-message>
     </statement-message>
     <statement-message>
     </statement-message>
     <statement-message>
     </statement-message>

So where am I going wrong?

Ed

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.