|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: selecting the nearest preceding sibling
De : Mukul [mailto:mukulw3@xxxxxxxxx] > My XML file is below [snip] > I want to write **a XPATH expression which will select > the nearest preceding sibling , which contains a > particular element ( <a> in this example) ** . I do > not want preceding sibling which do not contain the > <a> tag (also the tag <a> should be nearest to the > context node) > > for e.g. if the context node is node 5 , the XPATH > expression which will select node 3(because it > contains element <a>) or for e.g. if the context node > is node 2 , the XPATH expression will select node > 1(because it contains element <a>) OK - the node set of all the preceding siblings which fit the criterium is given by preceding-sibling::tag[a] The nearest preceding sibling fitting the criterium is the last one in that nodeset (the nodes are always in document order)... that is, preceding-sibling::tag[a and last()] Hope this works, Cheers, Dave. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








