Schematron & XPath 2.0 string/numeric comparisons
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 13
- Joined: Mon May 24, 2010 7:20 pm
Schematron & XPath 2.0 string/numeric comparisons
I recently added queryBinding="xslt2" to my Schematron so I could use XPath 2.0. After doing so, it seems all of my assertion tests containing comparisons of > or < are having issues (reporting incorrectly.) It seems inequality tests are not working out.
e.g.
schema:
samples:
fails
passes
passes
Specifying the attributes as numbers seems to resolve the issue:
All previous examples pass.
I understand the notion of string vs. numeric comparison, but I thought this was taken care of for you since it worked before adding xslt2 to the schema. Is this a bug, am I missing something, or must I add number() all over my schema?
cheers,
-X
e.g.
schema:
Code: Select all
<pattern id="limit_order">
<rule context="foo" role="error">
<assert test="not(@l_lim > @h_lim)">
Limits must be in high/low order.</assert>
</rule>
</pattern>
Code: Select all
<foo l_lim="50" h_lim="255" />
Code: Select all
<foo l_lim="200" h_lim="255" />
Code: Select all
<foo l_lim="050" h_lim="255" />
Specifying the attributes as numbers seems to resolve the issue:
Code: Select all
<pattern id="limit_order">
<rule context="foo" role="error">
<assert test="not(number(@l_lim) > number(@h_lim))">
Limits must be in high/low order.</assert>
</rule>
</pattern>
I understand the notion of string vs. numeric comparison, but I thought this was taken care of for you since it worked before adding xslt2 to the schema. Is this a bug, am I missing something, or must I add number() all over my schema?
cheers,
-X
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Schematron & XPath 2.0 string/numeric comparisons
This is how it works in XPath 2.0.
See http://www.w3.org/TR/xpath20/#id-general-comparisons
The case when XPath 1.0 compatibility mode is false
***
a. If both atomic values are instances of xs:untypedAtomic, then the values are cast to the type xs:string.
***
Best Regards,
George
See http://www.w3.org/TR/xpath20/#id-general-comparisons
The case when XPath 1.0 compatibility mode is false
***
a. If both atomic values are instances of xs:untypedAtomic, then the values are cast to the type xs:string.
***
Best Regards,
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service