xsl-list
[Top] [All Lists]

Re: [xsl] Easy Key-grammar Question

2006-09-26 11:45:54
Aw, fiddle. You guys showed me how to collect items with variables, too.

Thank you, Michael. :-)

BobP

On 9/26/06, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
If you need to find the items with @group != 0 frequently, use a global
variable:

<xsl:variable name="nonzeroitems" select="//item[(_at_)group != 0]"/>

If you don't need them frequently, then you don't need a key.

If "0" is actually a variable, then a key isn't going to help.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Bob Portnell [mailto:simply(_dot_)bobp(_at_)gmail(_dot_)com]
> Sent: 26 September 2006 19:08
> To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
> Subject: [xsl] Easy Key-grammar Question
>
> (And yet I don't see it clearly in the FAQ)
>
> So, I've been handed
>
> <xsl:for-each select="//item[(_at_)group != 0]">
>
> The structure cries out for a key, and conveniently I already
> have established <xsl:key name="ItemByGrp" match="item"
> use="@group" />
>
> Now, if I wanted the <item>s with @group='0', I'd use the
> function key('ItemByGrp', 0). No fuss.
>
> How do I opposite? *Can* I do the opposite, or am I better
> off leaving it alone? Should I create a more refined key
> definition thus?
>
> <xsl:key name="GroupedItems" match="item[(_at_)group !=0]" use="@group" />
>
> Curiosity abounds!
>
> Bob Portnell
> simply(_dot_)bobp(_at_)gmail(_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>
> --~--
>


--~------------------------------------------------------------------
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>