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

Re: if a condition is not met

Subject: Re: if a condition is not met
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 15 May 2007 17:29:41 +0100
Re:  if a condition is not met
> Can someone, btw, elaborate on the following: Why is it that a statement 
> like current-group()[some-predicate]/following-sibling::* will return 
> *all* following sibling and not only the elements that are part of the 
> current group?

because (as you guessed) current_group() returrns original nodes, not
copies.

this is just the same as in xslt1, 

<xsl:for-each select="a">
  <xsl:copy-of select="following-sibling::*"/>

following-sibling::* here would select all siblings of the current (a)
node, the way that node was selected (in the for-each)  is irrelevant.

> To workaround this, I know that you can treat the current-group() 
> results as a document-node when you copy it into a variable and go from 
> there.

copyig (might) be expensive, an alternative if you want to ensure that a
path expression only returns elements in the current group is to go

(pathexpression) intersect current-group()


But if you are doing
current-group()[some-predicate]/following-sibling::*  then it looks like
you are doing some further grouping on the current group so often it is
more natural to do

<xsl:for-each-group select="current-group()"
group-starting-with="node()[some-predicate]">
...

Then it is automatically constrained to just work within the current
group.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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