- #1
honestrosewater
Gold Member
- 2,143
- 6
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.
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]
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,
but that is not satisfying.
How do you enter a URI in XSLT as an XPath expression?
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?
Last edited by a moderator: