XSpec/XPath error
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 57
- Joined: Tue Jul 21, 2009 1:48 am
XSpec/XPath error
Hi, I'm getting a curious error when I run an Schematron XSpec script I have. It's basically complaining about a variable passing a sequence to a function (either lower-case() or matches()) and the use of a predicate [1] to select a single value doesn't seem to solve the problem. When I remove the possibility of a multiple value return from the XSpec context the problem goes away. Fortunately the XSpec context with multiples of the element is a contrived test scenario I would never see in production, however I'm curious about why this is happening.
The Schematron variable causing the problem is this (bold face is the problematic expression):
<sch:let name="REG_ALLOWED_STATUS_VALS" value="
if(lower-case(//status[1]/normalize-space()) = ('production','sample'))
then ('stable','deprecated') else ('unstable','stable','deprecated')" />
The element 'status' is actually allowed only once in tested document however if I have a XSpec context that contains two, I get this in the ANT [Run XSpec Test] result tab:
"A sequence of more than one item is not allowed as the first argument of fn:lower-case() . Found while atomizing the second operand of '='"
It seems like //status[1] should always return a single value, and thus not trigger this error - am I mistaken about that? Just wondering if I'm missing something simple here or if you have any thoughts.
Thanks, Scott
The Schematron variable causing the problem is this (bold face is the problematic expression):
<sch:let name="REG_ALLOWED_STATUS_VALS" value="
if(lower-case(//status[1]/normalize-space()) = ('production','sample'))
then ('stable','deprecated') else ('unstable','stable','deprecated')" />
The element 'status' is actually allowed only once in tested document however if I have a XSpec context that contains two, I get this in the ANT [Run XSpec Test] result tab:
"A sequence of more than one item is not allowed as the first argument of fn:lower-case() . Found while atomizing the second operand of '='"
It seems like //status[1] should always return a single value, and thus not trigger this error - am I mistaken about that? Just wondering if I'm missing something simple here or if you have any thoughts.
Thanks, Scott
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: XSpec/XPath error
Post by alex_jitianu »
Hello,
At first glance, I can't say I understand either why the error appears. It might help to have a look at the XSLT generated out of the XSpec file. For that:
- click the Configure transformation scenario and edit the Run XSpec Test scenario
- on the Parameters tab set the clean.output.dir parameter to false
- run the scenario
- open and inspect xspec/demo-sch-preprocessed.xsl
I suggest posting an issue on the XSpec GitHub project, as the people maintaining the project have more knowledge about the intermediate steps involved in running a Schematron test.
Best regards,
Alex
At first glance, I can't say I understand either why the error appears. It might help to have a look at the XSLT generated out of the XSpec file. For that:
- click the Configure transformation scenario and edit the Run XSpec Test scenario
- on the Parameters tab set the clean.output.dir parameter to false
- run the scenario
- open and inspect xspec/demo-sch-preprocessed.xsl
I suggest posting an issue on the XSpec GitHub project, as the people maintaining the project have more knowledge about the intermediate steps involved in running a Schematron test.
Best regards,
Alex
-
- Posts: 96
- Joined: Wed Feb 09, 2005 8:57 am
-
- Posts: 57
- Joined: Tue Jul 21, 2009 1:48 am
Re: XSpec/XPath error
Thanks HomeGoods. That is exactly what is happening - seems obvious now with your example. The predicate doesn't apply to the whole list of selected status elements, it applies to each context a status element is in.
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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