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

Re: xsl:for - Only for existing nodes, how?

Subject: Re: xsl:for - Only for existing nodes, how?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 21 Feb 2006 17:37:11 GMT
Re:  xsl:for - Only for existing nodes
>  This was just an example and my real xml 
> file goes much deeper after "control". 

if the expressions in the test are more complex it may help  to stick
them in a variable.

<xsl:for-each select="/tree/controls/control">
<xsl:variable name="i1" select="ho/hum/ha"/>
<xsl:variable name="i2" select="fee/fi/fo/fum"/>
<xsl:if test="$i1 and $i2">
   <xsl:value-of select="$i1"/>
   <xsl:value-of select="$i2"/>
</xsl:if>
</xsl:for-each>

that way you don't have to repeat the expression both in the test and
the value of. On the other hand it may make no difference as your xslt
engine may spot repeated sub-expressions and effectively make them into
implicit internal variables anyway.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.