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


    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"/>[/indent] [Broken]

    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' [Broken] cast as xsd:anyURI"/>​

    but that is not satisfying.

    How do you enter a URI in XSLT as an XPath expression?​
    Last edited by a moderator: May 2, 2017
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted