Re: [xsl] numbers and XPath

Subject: Re: [xsl] numbers and XPath
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Mon, 25 Nov 2002 00:01:08 +0100
It looks extremely like a bug, I even had to laugh about the processor's logic ;-) I don't know how to solve it, maybe reduce the number 5000000. Why do you use the 5000000 in general? The numbers are also unique without it.

Furthermore you can shorten the expression and remove some conversions:
number('1000') is a conversion from the string '1000' to a number. If you remove '' or completely number the result shell be the same. position() also returns a number. So removing all useless number()s and conversions will result in:


concat('id', string(number($assoc_pos) * 1000 + 500000 + position()))

And removing the implicite conversions:

concat('id', $assoc_pos * 1000 + 500000 + position())

Maybe this solves the problem with the processor too. Which processor is used in XMLSpy 5.2? I assume it's MSXML by default - but in which version?

Regards,

Joerg

Endre, MAGYARI wrote:
Dear list,


Thank you all for your replies regarding my attribute question.


I have an other problem, this is an expression which gives value to an attribute inline, inside the element definition:

"{concat('id',string(number($assoc_pos)*number('1000') + number('500000') + number(position())))}"

This is inside an <xsl:for-each> loop and we may assume that all the for-each loop will loop exactly two times.

The $assoc_pos variable will have different values, it will start from 5 and it will have an incremented value whenever the processor enters this template.

So, the output attribute should be stg. like:
id5005001, id5005002
id5006001, id5006002
....
id5009001, id5009002

and so on. And this is how it work, but, it's very strange, when the variable $assoc_pos reaches the value 10, the generated attributes will be

id51, id51

I have no idea how could this happen. Is this a bug ? Or I have done stg wrong?

I'm using XmlSPY 5.2

Thank you,
Endre


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread