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

Re: Comparing nodes in axis

Subject: Re: Comparing nodes in axis
From: xptm <xptm@xxxxxxx>
Date: Fri, 17 Dec 2004 19:40:06 +0000
Re:  Comparing nodes in axis
Well, the "else" part is cut&paste, so i'm not writing more code... but
the important here is the execution of code without necessity, so i'll
change to the choose/when/otherwise.

Your sugestion of using

<xsl:value-of select="number(parent::menu=(//menu)[$pos])"/>

is very neat. However i cant use it cause the "otherwise" is not 0 but
instead the prior value of the node, that could be 1 or 0.

But ofcourse, you could not guess that...

Thanks again.


Michael Kay wrote:


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?



Yes, you're writing more code and the XSLT processor is executing more code.


In fact, assuming you've got the boolean condition right, you could replace
this whole thing by

<xsl:value-of select="number(parent::menu=(//menu)[$pos])"/>

Michael Kay
http://www.saxonica.com/

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.