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

Re: Is there a way to sometimes bypass a nested for-ea

Subject: Re: Is there a way to sometimes bypass a nested for-each group?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 24 Jul 2008 14:41:09 +0100
Re:  Is there a way to sometimes bypass a nested for-ea
> " you were telling me to replace a non-existent sequence with an empty 
> sequence?


No to replace sequences of o-or-1 element nodes, by sequence of strings
of length 1.

You were selecting on SubHeading which selects elemets (an arbitrary
number, but I think that you know from the context that there will be 0
or 1 items in each case.

for-each group (conceptually) first finds all the distinct values  for
the group-by expression and then makes a group for each putting into
each group every item for which the group-by expression includes this
key value. This means that items for which the group--by expression
yields the emptysequence end up in no group.

If instead you do
string(SubHeading)
the the situation is rather different. Firstly if some item has two
subheadings you get an error (from string) rather than the item being
put in two groups. Secondly (and more importantly here) if there is no
subheading you now generate a grouping key (that is a sequence (of
length 1) of values) it's just that the value in this case is "".
this is a perfectly good value for xsl:for-each-group to group on so it
puts all the items that return "" into one 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-2013 All Rights Reserved.