[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] position() function in loop provides only 1


Subject: Re: [xsl] position() function in loop provides only 1
From: henry human <henry_human@xxxxxxxx>
Date: Thu, 12 Apr 2012 06:37:48 +0100 (BST)

Hi all
I did following change and it works fine:
old) xsl:for-each
select="InvoiceLine">
B B  <xsl:for-each select="taxtotal">
new):
<xsl:for-each select="InvoiceLine/taxtotal">
(Let see ifB ONE loop covers
allB requirenmentsB in this scenario)
Thanks for your hints
Henry

-----
UrsprC<ngliche Message -----
Von: Michael Kay <mike@xxxxxxxxxxxx>
An:
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
CC: 
Gesendet: 15:20 Mittwoch, 11.April 2012
Betreff: Re: [xsl] position() function in loop provides only 1

If you'd like
to supply a small but complete sample source document and 
stylesheet, rather
than incomplete fragments, then I'm sure we'll be 
able to tell you what's
going on.

Michael Kay
Saxonica

On 11/04/2012 14:08, henry human wrote:
> I
now that the position() reset after a loop is ended and I am not expecting
some thing else .
> In my case the position () provides correctly the POSITION
for each loop in the FIRST loop but
> in the other loop (xsl:for-each
select="taxtotal) the position() function provides ever ONE and does not
increment!!!
> Regarding number function I do not now how to use it here. and
I think you are wrong, in XSLT you canbt save value to a variable and use it
global!
> Kind regards
>
>
>B  
> ----- UrsprC<ngliche Message -----
> Von:
Michel Hendriksen<michel.hendriksen@xxxxx>
> An:
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> CC:
> Gesendet: 14:06 Mittwoch, 11.April
2012
> Betreff: Re: [xsl] position() function in loop provides only 1
>
> In
for each the context will switch, so position will be reset inside
> You could
keep position in a variable if you need it.
>
> Michel
>
> On Wed, Apr 11,
2012 at 1:57 PM, henry human<henry_human@xxxxxxxx>B  wrote:
>> Hi all
>> I use
the positon() funciton to build a counter.
>> I use it in a for-each loop
under another for-each. The result is but ever 1.
>> Strange, but in the same
document in the first for-each loop it works fine (bellow is first loop,
for-each select="Item)
>> sample document look like this:
>>
>>
>>
<xsl:for-each select="Item">
>> <it>
>> <xsl:value-of select=" position()">
>>
>> </it><it>
>> <xsl:value-of select=" position()">
>> </it>
>> ........
>>
<it>
>> //positionB  = 113
>> </it>
>> </xsll:for-each>
>> <xsl:for-each
select="InvoiceLine">
>>B  B  <xsl:for-each select="taxtotal">
>> ....
>>
<xsl:value-of select=" position()">
>>B  B  </xsll:for-each>
>>B  B 
</xsll:for-each>
>> ------
>>
>> <invoiceLine>
>> <taxtoatl>
>> </taxtoal>
>>
>> <taxtotal>
>> </taxtotal>
>> ...........
>> </invoiceLine>
>> kind regards
>> Henry
>>
>>
--~------------------------------------------------------------------
>>
XSL-List info and archive:B  http://www.mulberrytech.com/xsl/xsl-list
>> To
unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>> or
e-mail:<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
>> --~--
>>
>
--~------------------------------------------------------------------
>
XSL-List info and archive:B  http://www.mulberrytech.com/xsl/xsl-list
> To
unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or
e-mail:<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --~--
>
>
--~------------------------------------------------------------------
>
XSL-List info and archive:B  http://www.mulberrytech.com/xsl/xsl-list
> To
unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or
e-mail:<mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --~--


Current Thread
Keywords