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

Re: Return position in for-each

Subject: Re: Return position in for-each
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 23 Jul 2004 01:38:45 +0100
get parent element
> 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[@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
________________________________________________________________________

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.