xsl-list
[Top] [All Lists]

Re: Return position in for-each

2004-07-22 17:38:45

I thought I was writing these variables out correctly.  I believed that your
suggestion was for when you were passing XML document fragments around (not
sure how to express that properly), where y might be of the source:

no, your form,using xsl:variable with content rather than select creates
a result tree fragment with a document node a text node and string
value, teh value you want. If you use select= then the variable holds
the string directly, which is more efficient for the system and less
typing for you.


      Element/@name + '_' + parent::/position()
   (on another note, is it possible to get the position of the parent node 
like
that?)

no. you can onlyuse node tests after an axis, also nodes do not have a
position position() is not a property of the node it's a property of the
current node list, so for example if you select a node with the parent::
axis it will _always_ have position() 1 as the parrent axis only has one
node in its current node list so the selected node must always be the
first in that list.

The number you arelooking for is probably
count(../preceding-sibling::*)+1


Loop for (consider) each ABC/Entry where the corresponding
BROWSER_VARS//Element @name has a value...

something like

<xsl:for-each select="ABC/Entry/Element">
 <xsl:if test="$VARS/FORMVARS/Element[(_at_)name=current()/@name] != ''">
  something

where $VARS holds your vars document
  
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
________________________________________________________________________


<Prev in Thread] Current Thread [Next in Thread>