Strange error message for XPath 2.0
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 10
- Joined: Mon Sep 05, 2005 12:50 pm
Strange error message for XPath 2.0
Hi,
I just used the following expression to find all elements whose textual content starts with "LV_EVAL".
This works for XPath 1.0. With XPath 2.0 I get the message:
Regards,
Oliver
I just used the following expression to find all elements whose textual content starts with "LV_EVAL".
Code: Select all
//*[starts-with(text(),"LV_EVAL")]
I did not look up XPath 2.0 syntax, but just guessed the above expression. Is what I experience correct behaviour?A sequence of more than one item is not allowed as the first argument of starts-with()
Regards,
Oliver
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Oliver,
The fist argument of starts-with in XPath 2.0 is xs:string
http://www.w3.org/TR/xquery-operators/#func-starts-with
When you say text() in XPath that returns a sequence containing all the text nodes inside the context element (if the context node is an element). If you have multiple nodes in the retuned sequence (this is the case when you use mixed content models for instance) then you will get more nodes thus the error.
You should use something like
or
Best Regards,
George
The fist argument of starts-with in XPath 2.0 is xs:string
http://www.w3.org/TR/xquery-operators/#func-starts-with
When you say text() in XPath that returns a sequence containing all the text nodes inside the context element (if the context node is an element). If you have multiple nodes in the retuned sequence (this is the case when you use mixed content models for instance) then you will get more nodes thus the error.
You should use something like
Code: Select all
//*[starts-with(text()[1],"x")]
Code: Select all
//*[starts-with(string-join(text(), ""),"x")
George
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