Re: No-fail `document` Function Spec
Mike Brown <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
John L. Clark wrote:
> Does it bother anyone else that
> there is no direct way for the user to actually input the default value
> for the second argument explicitly? This is orthogonal, but I think
> there ought to be an EXSLT function that allows us to access this value.
> Perhaps it would be called something like `uri:caller-base-uri`.
The second argument is not a URI, though; it is a node-set from which the URI
is derived (base URI of the set's first node in document order). All you have
to do is reference any node in the document that contains the function call.
This would work, I believe:
generate-id(res:document("foo.xml"))=generate-id(res:document("foo.xml", document(""), 1))
BTW, I also overlooked that you misplaced some parentheses in those
generate-id examples.
> > Also in reference to the second argument, the document() function says:
> >
> > "It is an error if the second argument node-set is empty and the URI
> > reference is relative; the XSLT processor may signal the error; if
> > it does not signal an error, it must recover by returning an empty
> > node-set."
> >
> > Do you want res:document() to return an empty node-set in this case,
> > or a result:error element? If result:error, then what should the uri
> > attribute contain?
>
> Good catch; I totally overlooked this case. I think that the `uri`
> attribute should contain the relative reference that triggered the error
> in this case; I've also expanded the
> result:error/result:failed/result:category values to account for this
> case. Do you think that's sufficient?
Probably, yeah. I hope I'm not the only one looking at it though :).