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

RE: How to find parent's-parent's-sibling-sibling name

Subject: RE: How to find parent's-parent's-sibling-sibling name
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 19 Sep 2002 15:06:50 +0100
find parent xml msxml
> You could use variable:
> <xsl:variable name="FOO">
>    <xsl:value-of select="BehaviourInfo/Trap/Name"/>
> </xsl:variable>
> 

An xsl:variable that contains a single xsl:value-of is almost always bad
coding. Use

<xsl:variable name="FOO" select="string(BehaviourInfo/Trap/Name)"/>

Apart from the fact that it's one line of code instead of three, it also
defines the variable as a string rather than as a tree. The only useful
thing you can do with this kind of tree in practice is to convert it to
a string, so it's much simpler and more efficient to create it as a
string in the first place.

I thought it worth mentioning because I'm seeing more and more examples
of this bad coding style.

Of course,

<xsl:variable name="FOO">
   <xsl:copy-of select="BehaviourInfo/Trap/Name"/>
</xsl:variable>

is even worse, and also very common.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.