Subject: Re: [xsl] traversing the tree from an arbitrary node From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Thu, 16 Aug 2001 09:42:19 +0100 |
Hi Chris, > I am using XT on a Windows NT platform. When I run this line, I get > the error message of "expected node test": > > <xsl:when test="id('$id')/from-ancestors(*[position() > =$elementDepth][self::rootTag])"> > > $id contains the ID of the tag I want, and $elementDepth contains > the number of steps down from the <rootTag> I expect to be. What I > am trying to say for that node test is "from the node that has this > id, go up $elementDepth ancestor nodes and see if that node is > <rootTag>." What am I doing wrong? You're basically there except that you need the ancestor axis rather than this from-ancestor() function. Also, I think you want to pass the id() function the value of the variable $id rather than the string '$id'. So the path you need is: id($id)/ancestor::*[position() = $elementDepth][self::rootTag] or (because numbers in predicates are tested against the position of the node in the node list): id($id)/ancestor::*[number($elementDepth)][self::rootTag] I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] traversing the tree from , Chris d'Aquin | Thread | Re: [xsl] traversing the tree from , Joerg Pietschmann |
RE: [xsl] XPath Query Builder, John Maughan | Date | [xsl] multiple output files in xslt, Bas Alberts |
Month |