[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
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]"
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|