Subject: Re: XPath query to recurse up the tree From: Miloslav Nic <nicmila@xxxxxxxxx> Date: Thu, 17 Aug 2000 16:45:47 +0200 |
use axes: http://www.zvon.org/xxl/XSLTreference/Output/index.html http://www.zvon.org/xxl/XPathTutorial/General/examples.html http://www.zvon.org/cgi-bin/xlab/bin/xpathAxes.py Ian Sutton wrote: > > Am I missing something, or is the current definition of XPath queries (or > whatever the current name is) limited to recursion down the tree? > As an example, consider an XML document representing a file system with > <directory> nodes which can contain either <file> nodes or further > <directory> nodes. (Case I have is actually nothing to do with filesystems > but this seems the simplest way to represent the issue.) > > Given a current context of a directory, I could find all child file nodes > recursively with > > <xsl:apply-templates select=".//file" /> > > and a corresponding template rule. > > I have a case where my <directory> nodes have certain additional attributes > (lets say optional TYPE=something) and I wish to find the first parent which > has say TYPE=X. Is there any way to do this? > > I kind of half guess it may be possible to do something like a recursive > call with an apply templates select=".." mode="myUpwardRecursion" and write > a specific template match rule which tests the attribute and either returns > or recurses up, but this seems fairly painful if indeed it would work at > all. > > Any answers/ideas gratefuly received ;-> > > Ian > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list -- ****************************************** <firstName> Miloslav </firstName> <surname> Nic </surname> <mail> nicmila@xxxxxxxxx </mail> <support> http://www.zvon.org </support> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
XPath query to recurse up the tree, Ian Sutton | Thread | RE: XPath query to recurse up the t, Kevin Williams |
RE: "replies go to the list" policy, Paul Telesco | Date | RE: XPath query to recurse up the t, Kevin Williams |
Month |