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

Re: template match : node-set paring through multiple-

Subject: Re: template match : node-set paring through multiple-axis relationships
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 4 Jun 2003 15:46:39 +0100
xslt for each multiple node


> I am glad you said something about the variables.  If I set a variable value
> through a select, and then test that variable, I had thought it would be the
> same as substituting the node-set that the variable represents.  Is this the
> case?

yes but a node set is a value, not an expression, so
if you go
<xsl:variable name="x" select="foo"/>

<xsl:for-each select="/a/b/c[$x]"/>

it is _not_ the same as going

<xsl:for-each select="/a/b/c[foo]"/>


which would evaluate the node set resulting from foo in the context of
each c node in turn.


<xsl:for-each select="/a/b/c[$x]"/>

is exactly the same as going

<xsl:if test="foo">
  <xsl:for-each select="/a/b/c">

as $x is a constant expression so can be factored out of the loop.


> The "[//" match is strange, but I do not think too strange for the purpose.
by starting the predicate with // you are making it independent of the
current node, so again it would be more readable if you took it out of
the path expression and moved it to an xsl:if on the outside, it has the
same effect.

> If you have any other suggestions or comments, I would appreciate them.  I
> confess it is a very difficult problem to explain (and - I think - to
> solve), but it should (in theory) be easier to so

A small input and a small expected output usually helps.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. 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
________________________________________________________________________

 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.