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

Subject: Re: [xsl] xsl:for - Only for existing nodes, how?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 21 Feb 2006 17:37:11 GMT
>  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"/>

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.


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:

Current Thread