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

Re: Including node in group when grouping key is null

Subject: Re: Including node in group when grouping key is null
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxx>
Date: Thu, 9 Jan 2014 12:10:24 -0500
Re:  Including node in group when grouping key is null
Steve,

Gerrit offers an elegant solution provided your @type values are
controlled to avoid 'primary' in the data. :-)

More generally, you should find that group-by="@type" does not fail to
group nodes for which @type is empty. If you want to avoid those, you
need to select="author[exists(@type)". If you want to include them,
they'll be grouped with a key of '' (the empty string), along with
those that have @type=''. This is because the value returned by
@group-by is cast to a string, and string(()) is "".

Assuming @type will never be 'primary' (or whatever fallback value you
choose), Gerrit's solution succeeds in grouping authors with no @type
separately from authors with @type=''. Which is another reason to like
it.

Cheers, Wendell

Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^


On Thu, Jan 9, 2014 at 2:16 AM, Imsieke, Gerrit, le-tex
<gerrit.imsieke@xxxxxxxxx> wrote:
>
>
> On 09.01.2014 08:11, Steve Fogel wrote:
>>
>> <xsl:for-each-group select="author" group-by="@type">
>
>
> group-by="(@type, 'primary')[1]"

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.