|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Hierarchy problem
--- DPawson at rnib dot org dot uk wrote: > > With a structure such as > > > <bodymatter> > <level1 id='l1'> > <h1>Level1</h1> > <level2 id='l2'> > <h2>Level2</h2> <!-- bad navPoint 1 --> > <level3 id='l3'> <!-- good navPoint 2 --> > <h3>level3</h3> > <note id="noteId"> <!-- navLabel target --> > <p>Note content</p> > </note> > </level3> > </level2> > </level1> > > .... > > I need to check that the node with id=noteId > is (or is not) a direct descendant of another node (e.g. > level2[id='l2']) > or if there are intervening levelX elements. > Hi Dave, The following XPath expression will return the direct ancestor of the "note" element that is a "level2" element, or nothing, if the "note" element does not have a "level2" direct ancestor: $vNote/ancestor::*[starts-with(name(), 'level')][1][self::level2] Do I understand correctly that by "direct ancestor" you mean the first ancestor, whose name is levelX? ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com 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








