xsl-list
[Top] [All Lists]

Re: [xsl] Including node in group when grouping key is null

2014-01-09 11:11:17
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(_dot_)imsieke(_at_)le-tex(_dot_)de> wrote:


On 09.01.2014 08:11, Steve Fogel wrote:

<xsl:for-each-group select="author" group-by="@type">


group-by="(@type, 'primary')[1]"


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>