Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

AnyURI as an XPath expression?

  1. Mar 2, 2007 #1

    honestrosewater

    User Avatar
    Gold Member

    This question is extremely annoying but not worth the time to properly investigate, so here is my best attempt to find an answer.

    I'm writing something in XSLT and XPath (both 2.0). I want to declare a URI parameter.

    <xsl:param name="foo" as="xsd:anyURI" select="http://foo.bar"/>​

    But Saxon complains about that being a parse error (XPST0003: "QName cannot end with a colon {http:}"). So I thought maybe it wants me to enter the URI as a string. But no, that is also bad, a type error, as you would initially expect (XPTE0600). So what is a girl to do?

    The value of select must be an XPath expression, but I cannot for the life of me figure out what kind of expression it is. It's not a quantified, conditional, for, comparison, arithmetic, or sequence expression. And of the primary expressions, the only one I can imagine it might be is a string literal, but that doesn't really even make sense. It's not a path expression, is it? URIs are atomic values, surely, right? xsd:anyURI is an atomic type. Bah.

    I have solved this for now by just entering the URI as a string and casting it as a URI,

    <xsl:param name="foo" as="xsd:anyURI" select="'http://foo.bar' cast as xsd:anyURI"/>​

    but that is not satisfying.

    How do you enter a URI in XSLT as an XPath expression?
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: AnyURI as an XPath expression?
Loading...