What is the range of count attribute in xslt?
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?
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.
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.
Look at this section of specification: http://www.w3.org/TR/xpath/#numbers
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.
精彩评论