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

Problem with index-position in for-each

Subject: Problem with index-position in for-each
From: Timothy Marc <timothymarc@xxxxxxxxxx>
Date: Tue, 18 Dec 2007 18:39:33 +0100
 Problem with index-position in for-each
Hi all,

i've a strange problem. I want to select some elements by their index
via predicate expression. The source looks like:
<root>
<tree>
<statics mapTo="xyz">...</statics>
<statics mapTo="xyz">...</statics>
<dynamics mapTo="xyz">...</dynamics>
<statics mapTo="xyz">...</statics>
...
</tree>
...
</root>

Now, i want to iterate over all statics-child elements, depending on
their position. Therefore, i have created an for-each-loop like this:

<xsl:for-each select="1 to count($staticParts/tree/statics)">

and inside the loop, i want to get the value of @mapTo with

<xsl:value-of select="$staticParts/tree/statics[position()]/@mapTo"/>

I want to do this with the explicit position, because i generate some
sql insert statements, where @mapTo defines the sql rowname and the
value of the element defines the column data. But the result is really
unexpected. I allways get the values of all @mapTo in this tree-element,
like this:

page tree location locationdescription ...

I 'm wondering because when i replace the position() function with an
static integer like [1] i only get the @mapTo value i want.
Hope, that somebody could help me.

thx
mfw

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.