Subject: Re: [xsl] Keys Context Management From: "andrew welch" <andrew.j.welch@xxxxxxxxx> Date: Thu, 16 Mar 2006 09:03:24 +0000 |
On 3/16/06, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote: > I have a couple of keys which I have defined like this; > > <xsl:key name="key_athletes" > match="/ROOT/MeetResults/Meet/AthleteResults/Athlete" use="USAGNum"/> > <xsl:key name="athlete_driver" > match="/ROOT/NewDataSet[@Name='wbx_scoreupload']/Table" > use="usagnum"/> > > > Notice that I match right away off of ROOT. I do this because I am > not confident that the context for which the key belongs will be > preserved. I've written similar keys before where I am basically > going after the last node of the tree to which I am after. > > How does context work with keys? > Does the context of each key shift as you walk your XML? Yes - all the key does is index nodes in the tree so that you can select them faster... the nodes are still the same nodes in the same tree. You shouldn't really have a key that will only ever match one node, as the cost of building the key will outweigh the selection gains, you should use a variable instead. cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Keys Context Management, Karl Stubsjoen | Thread | [xsl] Outputting Doctype, Aaron Johnson |
[xsl] Keys Context Management, Karl Stubsjoen | Date | [xsl] Outputting Doctype, Aaron Johnson |
Month |