4

I am using one xslt file for count the number of elements in an XML file that have a particular value (to verify uniqueness) and stored in xsl variable name. This xml file is created programatically and value of the number of the elements sometimes may exceed 1 million.

Due to this high level range, I am little afraid about range limit of xsl:variable or count attribute.

I don’t know whether xsl:variable or count attribute has limited range (Starting range and ending range) or not?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Saravanan
  • 11,372
  • 43
  • 143
  • 213

4 Answers4

4

With most XSLT processors, you're likely to run out of memory for storing the XML document long before you exceed the limit of the count() function. About 1Gb is about the maximum you're likely to be able to handle, and that's unlikely to be more than about 10M nodes.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
4

XPath 2.0 uses the type xs:integer defined in the XML Schema specification:

3.3.13 integer

[Definition:] integer is ·derived· from decimal by fixing the value of ·fractionDigits· to be 0and disallowing the trailing decimal point. This results in the standard mathematical concept of the integer numbers. The ·value space· of integer is the infinite set {...,-2,-1,0,1,2,...}. The ·base type· of integer is decimal.

Therefore, only the specific implementation of an XSLT processor can potentially define any upper limit for the value space of the xs:integer type that it implements.

For example, the Saxon XSLT 2.0 processor implements a "Big Integer" type (and Big Integer arithmetics). It is reasonable to expect that any integer, whose representation fits in the available memory, can be represented and used in Saxon.

Dimitre Novatchev
  • 240,661
  • 26
  • 293
  • 431
3

Look at this section of specification: http://www.w3.org/TR/xpath/#numbers

Kirill Polishchuk
  • 54,804
  • 11
  • 122
  • 125
2

At the very least most implementations will be able to handle signed 32-bit numbers (about 214 or so crore), so 10 lakh will work just fine.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358