Subject: Re: [xsl] XPath for all of an element type prior to context node? From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Thu, 1 Mar 2001 10:10:41 +0000 |
Hi Michael, > When the context node is any of those with an id attribute, I want a way to > get the list of resources nodes that occur: > > - before the context node; or > - after the context node. >From the source you posted, it looks as though the resource elements aren't the ancestors or descendants of any of the nodes with id attributes, so you should just be able to use: preceding::resource (to get those before the context node) following::resource (to get those after it) If you're doing this a lot and have a long document, you may or may not find it more efficient to use a couple of keys that index the resource elements according to the nodes with id attributes that they're before or after: <xsl:key name="resources-before" match="resource" use="following::*/@id" /> <xsl:key name="resources-after" match="resource" use="preceding::*/@id" /> and then use: key('resources-before', @id) (to get those before the context node) key('resources-after', @id) (to get those after it) I hope that was what you were after, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XPath for all of an element t, Michael Strasser | Thread | Re: [xsl] XPath for all of an eleme, Francis Norton |
RE: [xsl] Path for a DTD : proposit, DPawson | Date | Re: [xsl] [exsl] Draft 0.1 - call f, Jeni Tennison |
Month |