Project

Profile

Help

base-uri() returns incorrect Base URI

Added by Anonymous almost 13 years ago

Legacy ID: #10596995 Legacy Poster: Nick Van den Bleeken (nvdbleek42)

We are using Saxon's XPath API directly (XPathEvaluator). It appears that the expression base-uri() is compiled as base-uri(ItemChecker(.)) and therefore doesn't returns the base URI of the static context but the base URI of the current context item. According to the spec [1]: [b]fn:base-uri() as xs:string[/b] Summary: This version of the function returns the value of the base-uri property from the static context using the preceding rules. The static context is discussed in Section 2.1.1 Static Context. I would have expected the result of base-uri() to be the base URI that was provided to the saxon StaticQueryContext object associated with the queries XPathEvaluator. What is the error in my reasoning? We need access to the base URI provided to the StaticQueryContext, could this be accessed in any other way? Kind regards, Nick Van den Bleeken 1: http://www.w3.org/TR/2003/WD-xpath-functions-20031112/#func-base-uri


Replies (2)

RE: base-uri() returns incorrect Base URI - Added by Anonymous almost 13 years ago

Legacy ID: #10597704 Legacy Poster: Michael Kay (mhkay)

Your link is to a 2003 working draft of the XPath functions and operators specification. Please consult the final recommendation at http://www.w3.org/TR/xpath-functions/#func-base-uri. To get the base URI from the static context, you need to use the function static-base-uri().

RE: base-uri() returns incorrect Base URI - Added by Anonymous almost 13 years ago

Legacy ID: #10598908 Legacy Poster: Nick Van den Bleeken (nvdbleek42)

Thank you for the reply, sorry that I wasn't looking at the latest version of the spec. Having two differently named functions is much clearer, because it makes sense to have the current item as the default value if the argument is provided (most of the time you need this behavior anyway).

    (1-2/2)

    Please register to reply