[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Test expression : Is Context Node an ancestor of n
Tempore 02:52:24, die 02/19/2005 AD, hinc in
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Adam J Knight
<adam@xxxxxxxxxxxxxxxxx>:
<xsl:choose> <xsl:when test="@id=$id | ancestor::tree_node[@id=$id]"> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> Hi, 1)The union operater '|' works only for node-sets, not boolean value. Use 'or' here. 2)'ancestor' should become 'descendant' Suppose you have this: <xsl:template select="foo"> <xsl:if test="ancestor::bar"> Hooray </xsl:if> </xsl:template> The 'xsl:if' will *not* test that the context node ('foo') is an ancestor of 'bar'. The oppposite is true: It will test wether 'foo' has an ancestor named 'bar'. This is because 'ancestor' is an axis (containing all ancestors of the context node), not a boolean test or something alike. I do hope this clears it a bit. If you did not understand at first reading, I advise you to read this again. I want to use a test expression to test whether the node currently matchedcorrect is an ancestor of a node with a specified id. <xsl:choose> <xsl:when test="descendant-or-self::tree_node[@id=$id]"> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Veni, vidi, wiki (http://www.wikipedia.org)
|
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
|