

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in net.sourceforge.lists.saxon-help[saxon] function conversion rules for...| From | Sent On | Attachments |
|---|---|---|
| Matthew Rawlings | Dec 18, 2008 1:54 pm | |
| Michael Kay | Dec 18, 2008 4:36 pm | |
| Matthew Rawlings | Dec 19, 2008 2:29 am | |
| Michael Kay | Dec 19, 2008 3:46 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [saxon] function conversion rules for xs:QName to xs:string in fn:resolve-QName() | Actions |
|---|---|---|
| From: | Matthew Rawlings (matt...@stickledown.com) | |
| Date: | Dec 18, 2008 1:54:56 pm | |
| List: | net.sourceforge.lists.saxon-help | |
I am getting an error when passing an xs:QName as the first parameter to the fn:resolve-QName() function.
I expected, according to the XQuery Function Conversion rules, that the xs:QName could be cast to a xs:string, because xs:QName is a sub-type of xs:string.
The query is:
" xquery version "1.0";
declare default element namespace "http://www.fpml.org/2008/FpML-4-5"; declare namespace fpml="http://www.fpml.org/2008/FpML-4-5"; declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; declare namespace xs="http://www.w3.org/2001/XMLSchema";
element nnnn {count(/*[resolve-QName(@xsi:type, .) = xs:QName("ContractCreated")])} "
The command line and result is: " C:\working\ganny-ws\fpml-trunk\src\engine>java -cp C:\lib\saxonsa9-1-0-2j;C:\lib\saxonsa9-1-0-2j\saxon9sa.jar com.saxoni ca.Query -s:msg-ex51-contract-created.xml -s:msg-ex51-contract-created.xml -sa -val success.xq 2>&1 | more Error on line 8 XPTY0004: Required item type of first argument of resolve-QName() is xs:string; supplied value has item type xs:QName Query processing failed: Run-time errors were reported "
If I explicitly cast the xs:QName to a xs:string, then the query works fine. The query with the cast, and the command line and result are: " xquery version "1.0";
declare default element namespace "http://www.fpml.org/2008/FpML-4-5"; declare namespace fpml="http://www.fpml.org/2008/FpML-4-5"; declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; declare namespace xs="http://www.w3.org/2001/XMLSchema";
element nnnn {count(/*[resolve-QName(xs:string(@xsi:type), .) = xs:QName("ContractCreated")])} " " C:\working\ganny-ws\fpml-trunk\src\engine>java -cp C:\lib\saxonsa9-1-0-2j;C:\lib\saxonsa9-1-0-2j\saxon9sa.jar com.saxoni ca.Query -s:msg-ex51-contract-created.xml -s:msg-ex51-contract-created.xml -sa -val success.xq 2>&1 | more <?xml version="1.0" encoding="UTF-8"?> <nnnn xmlns="http://www.fpml.org/2008/FpML-4-5">1</nnnn> "
I am using Saxon-SA 9-1-0-2.
The example XML document is from FpML. The example query is from page 257 of Priscilla Walmsley's book "XQuery". The query works fine in a few other popular XQuery tools. " <?xml version="1.0" encoding="UTF-8"?> <FpML xmlns="http://www.fpml.org/2008/FpML-4-5" xmlns:fpml="http://www.fpml.org/2008/FpML-4-5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4-5" xsi:type="ContractCancelled" xsi:schemaLocation="http://www.fpml.org/2008/FpML-4-5 ../../../schema/fpml-main.xsd http://www.w3.org/2000/09/xmldsig# ../../../schema/xmldsig-core-schema.xsd"> <header> ... ... "
Why is the explicit cast to xs:string needed in Saxon, but not in other products?
------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxo...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help







