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

for-each over sequences of sequences

Subject: for-each over sequences of sequences
From: Stefan Krause <stf@xxxxxxxx>
Date: Sun, 01 Mar 2009 13:59:43 +0100
 for-each over sequences of sequences
Hello,

I run in an issue with for-each over sequences of sequences:

<xsl:for-each select="(1,2),3">
	<a>
		<xsl:for-each select=".">
			<b><xsl:value-of select="."/></b>
		</xsl:for-each>
	</a>
</xsl:for-each>

returns

<a><b>1</b></a>
<a><b>2</b></a>
<a><b>3</b></a>

and not - as I supposed -

<a><b>1</b><b>2</b></a>
<a><b>3</b></a>

How can I suppress this "flattening" of the original sequence?

The use case is defining a variable with xsl:for-each-group and
iterating over the groups (which consists of sequences of elements):

<xsl:variable name="Chunks" as="node()+">
	<xsl:for-each-group select="//body" group-ending-with="div">
		<xsl:sequence select="current-group()"/>
	</xsl:for-each-group>
</xsl:variable>
<xsl:for-each select="$Chunks">... do something ...</xsl_for-each>
with input

<body>
	<h1>Headline</h1>
	<div> ... </div>
	<div> ... </div>
</body>

I've found a workaround for this issue by wrapping the current-group()
in a <group/>-element, but I was wondering if someone can provide a more
straight-forward solution.

Thanks,

Stefan

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-2007 All Rights Reserved.