[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: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jul 2004 17:51:32 -0700
xsl parents position
David,
My exising loop is working.  However, it loops through (considers) all 50
elements rather than limiting to those which match in Browser Vars.  I am
doing what it is you are suggesting with the IF test.  But this is where I
have a problem with using the Loops position() as a number for the table
result.  Check out my example, give the first few competitors some
information, then skip a couple of rows and fill in a couple more
competitors.  You'll see the numbering result on the "Printer Friendly" page
and it might number something like:

1.
2.
6.
7.

Work in Progres:
http://www.meetscoresonline.com/entry/

Complete XSLT Source:
http://www.meetscoresonline.com/entry/documents/entry_template.xsl

Karl


PS  Thanks for the input on parameters... I got that all screwed up!

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Thursday, July 22, 2004 5:39 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Return position in for-each



> 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.