I was not aware of the difference between lt and <. The latter does
indeed allow me to bypass converting referenced node attribute values
to double. I see that it is explained in the spec for XPath 2.0 >
3.5.2 General Comparisons
(http://www.w3.org/TR/xpath20/#id-general-comparisons).
In what case one might prefer lt to <? When one wants to enforce
error checking in case of potential unexpected values, for instance?
On Wed, Jul 29, 2015 at 10:49 PM, Michael Kay mike(_at_)saxonica(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
On 29 Jul 2015, at 19:54, Jorge .
chocolate(_dot_)camera(_at_)gmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
When comparing numeric values of node attributes to a double, I have
to explicitly convert those attribute values too into a double or else
Saxon complains that I cannot compare an untyped value to a double.
Saxon of course is only doing what the XSLT 2.0 specification requires….
The general comparison operators like “<“ (unlike “lt”) convert an untyped
operand to the type of the other operand. This is often handy, but it does
make optimization more difficult (for example, Saxon-EE isn’t able to use
hashing and indexing unless it can infer the types of the operands
statically).
Considering that the input tree actually is generated some steps above
via an identity copy and stored into a variable, is there a way to
create it so that Saxon does know that those attribute values are
doubles
Yes, you can make the stylesheet schema-aware, in which case the numeric
attributes will be labelled as numeric rather than being untyped.
Michael Kay
Saxonica
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--