This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: One nodeset, multiple branches


-- Wendell Piez [Wed, 19 Dec 2001 11:30:37 -0500]:

><xsl:variable name="usergroups"
>select="user[@username='evitiello']//group/@name"/>
>Gets the @name attributes on the groups belonging to your user (you)
>into a
>variable.

>Combining these two XPaths does everything you need except de-
>duplicating
>the list. To do that, I'm afraid you'll have to iterate over the
>node-sets
>and check each node's preceding:: or following:: axis. This will get
>expensive if your data set is large.
>
>Another approach, potentially much more efficient, is to use keys
>... and
>that will let you de-duplicate as well (maybe I'll tackle that later
>if
>Jeni doesn't first ;-).

excellent.  in the past while I'd gotten to the point of adding a variable, and getting the rights for the groups in that nodeset, but I am completely stumped now on combining the two resulting sets.

>I don't think this XPath is over your head; it's just a bit hard to
>see around corners until you learn to use other features of the language
>(node-sets bound to variables; keys) as mirrors.

I try to keep the term "over-my-head" as a very time-based term.  Keeping in my head that I can do whatever I put my mind to always helps... so this is only "over-my-head" for the period of time that I am stumped on it, or finally break down and ask others for help =)

I try to never let anything be permanently over my head... If I were to do that, why even bother to learn a new language to begin with? :)

oh, and using the // moniker in the middle of the XPath is something I hadn't thought of for some reason.  it does make long XPaths much simpler.  I wonder what the actual processing time cost is.

keys on the other hand is something I've not even messed with yet.  I'll have to start reading!

maybe Jeni will pop in and explain the deduplication process!

Thanks for the help!

---
Eric Vitiello
Perceive Designs
<www.perceive.net>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]