[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Return position in for-each
Subject: RE: [xsl] Return position in for-each From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 22 Jul 2004 17:51:32 -0700 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Return position in for-ea, David Carlisle | Thread | [xsl] copy-of "canonicalization" b, Matthew McKennirey |
Re: [xsl] Return position in for-ea, David Carlisle | Date | Re: [xsl] Indent?, George Cristian Bina |
Month |