document('') fails to return stylesheets parsed from memory
authorJason Viers <bean@beanalby.net>
Thu, 16 Aug 2012 09:41:00 +0000 (17:41 +0800)
committerDaniel Veillard <veillard@redhat.com>
Thu, 16 Aug 2012 09:41:00 +0000 (17:41 +0800)
commit5e184e7154e8aa466e988f17c8b97b65196f94bf
treee5ab5fb09a31c5d79ffe839bc7dcde792fb52443
parent2d6e741ed9a5e54d48d394060590d151a3417dd7
document('') fails to return stylesheets parsed from memory

If an XSL stylesheet is from memory (e.g. xmlParseMemory), then xpath
expressions referencing "document('')" will never return a match.

When getting down into it, I understand the logic "document() is resolved
relative to the XSL's location, reading from memory has no location, therefore
buzz off", but the XSL spec seems to address this:

http://www.w3.org/TR/xslt#document
"Note that a zero-length URI reference is a reference to the document relative
to which the URI reference is being resolved; thus document("") refers to the
root node of the stylesheet; the tree representation of the stylesheet is
exactly the same as if the XML document containing the stylesheet was the
initial source document."

The fact that the behavior differs in this case between fromFile & fromMemory
definitely caught me off guard, and IMHO fixing that scenario is worth the
one-off-ness of the fix.
libxslt/functions.c