[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Comparing nodes in axis

Subject: Comparing nodes in axis
From: xptm <xptm@xxxxxxx>
Date: Fri, 17 Dec 2004 16:43:00 +0000
xsl comparing nodes
Is it correct to use expressions like these ones:

                       <xsl:if test="parent::menu=(//menu)[$pos]">
                           <xsl:text>1</xsl:text>
                       </xsl:if>

                      <xsl:if test="ancestor::menu=(//menu)[$pos]">
                           <xsl:text>0</xsl:text>
                       </xsl:if>

to compare the context node with another known node?

In the first example i'm saying

"If the context node, the one now being processed, is the parent of the menu node at absolute position $pos"

and

"If the the menu node at absolute position $pos is one of the ancestors of the context node"?

It is apparently working OK, but i never saw such comparisons being made...


As a side question, i tend to make things like


                       <xsl:if test="parent::menu=(//menu)[$pos]">
                           <xsl:text>1</xsl:text>
                       </xsl:if>
                       <xsl:if test="not(parent::menu=(//menu)[$pos])">
                           <xsl:text>0</xsl:text>
                       </xsl:if>

Is there any drawback in doing this insted of choose/when/otherwise?

Thanks.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.