When a URIResolver returns a DOMSource that wraps a
tree built using Saxon, attributes that were
classified as ID attributes in the supplied tree will
not be usable as ID attributes using the id() function.
(Reported by Evan Lenz)
There is code in the transform() method of the
Controller/Transformer that says "if a DOMSource is
supplied, and the DOM implementation is a Saxon tree,
and the stylesheet is not asking for whitespace
stripping, then use the tree as supplied, rather than
stripping it down and rebuilding it". This logic is
not present in the document() function: it should be
added (or preferably, it should use the same code).
Stripping down the tree and rebuilding it loses the
attribute type information.
I will also look at whether it is possible to retain
ID attributes in those cases when the tree does have
to be rebuilt.
Meanwhile, there is a circumvention. Instead of
returning the DOMSource from the URIResolver, return
the DocumentInfo node itself. Saxon's NodeInfo
interface extends the JAXP Source interface, so you
can supply any NodeInfo (including, of course, a
DocumentInfo) directly as the result of the
URIResolver, without wrapping it in a DOMSource object.
Of course, another circumvention is to use <xsl:key>.