I am having trouble url paramaters into the document() function in SAXON. Am I doing something wrong or am I not allowed to pass url parameters into a document function?
You can pass whatever the underlying URIResolver can handle. Saxon's standard URIResolver doesn't recognize parameters passed that way; if you want to do that you need to write your own URIResolver and configure saxon to use it. However, saxon's standard URIResolver does recognize a fragment identifier, the piece that comes after a # symbol, and interprets it as an ID attribute in the XML document. So, if your id is an ID attribute, that is, if it is declared in the DTD as being of type ID, you should be able to write
I don't see any reason why Saxon's URIResolver shouldn't accept URI references with parameters, though I'm not sure I've ever tried it myself. All that Saxon does is (a) if the URI is relative it turns it into an absolute URI using the appropriate base URI, and (b) it then passes it to the Java VM to get the resource. If a URI can't be retrieved, it's basically a Java problem not a Saxon problem. Unless there's some hidden corner of the Java API that I need to invoke to make this work, of course....
Mike Kay
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am having trouble url paramaters into the document() function in SAXON. Am I doing something wrong or am I not allowed to pass url parameters into a document function?
Works!!!!!
<xsl:variable name="person" select="document('People.xml')"/>
Does not work!!!!!
<xsl:variable name="person" select="document('People.xml?id=1234')"/>
Any thoughts?
Mike
You can pass whatever the underlying URIResolver can handle. Saxon's standard URIResolver doesn't recognize parameters passed that way; if you want to do that you need to write your own URIResolver and configure saxon to use it. However, saxon's standard URIResolver does recognize a fragment identifier, the piece that comes after a # symbol, and interprets it as an ID attribute in the XML document. So, if your id is an ID attribute, that is, if it is declared in the DTD as being of type ID, you should be able to write
document('People.xml#1234')
Regards,
Daniel Parker
http://presentingxml.sourceforge.net/
I don't see any reason why Saxon's URIResolver shouldn't accept URI references with parameters, though I'm not sure I've ever tried it myself. All that Saxon does is (a) if the URI is relative it turns it into an absolute URI using the appropriate base URI, and (b) it then passes it to the Java VM to get the resource. If a URI can't be retrieved, it's basically a Java problem not a Saxon problem. Unless there's some hidden corner of the Java API that I need to invoke to make this work, of course....
Mike Kay