GNOME Bugzilla – Bug 114360
document(), base URI and entities
Last modified: 2021-07-05 11:00:29 UTC
This is against a fresh libxslt from CVS. I believe there is a problem with the base URI used by the document function when the node referred to by the second argument is inside an entity. running "xsltproc test.xslt test.xml" reports warning: failed to load external entity "doc.xml" I think it's a bug (after scratching my head reading the specs), but I'm not 100% sure (msxsl and saxon don't complain, however). -sbi
Created attachment 17103 [details] test case (tgz, directories are important)
Hum, hard problem. The base is not saved in the tree when entities substitution at the parser level is asked as required by XPath/XSLT (gdb) 305 base = xmlNodeGetBase(target->doc, target); (gdb) p target $1 = 0x8119e28 (gdb) p *target $2 = {_private = 0x0, type = XML_ELEMENT_NODE, name = 0x8119df8 "docref", children = 0x0, last = 0x0, parent = 0x810f3f8, next = 0x8119f88, prev = 0x810f180, doc = 0x810ef98, ns = 0x0, content = 0xfffffffe <Address 0xfffffffe out of bounds>, properties = 0x8119eb0, nsDef = 0x0} (gdb) n 318 URI = xmlBuildURI(obj->stringval, base); (gdb) p base $3 = (xmlChar *) 0x81156b8 "test.xml" (gdb) The XSLT code does the right thing but the base has been lost at the parser level in that case. Annoying, I don't know exactly how to handle this without breaking too much stuff and making custom extensions, it's not simple ... Daniel
Hi. May be this the same bug: b.xsl: <?xml version='1.0' encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="c/c.xsl"/> <xsl:template match="/"> <xsl:call-template name="c"/> <b>b</b> </xsl:template> </xsl:stylesheet> c/c.xsl: <?xml version='1.0' encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template name="c"> <xsl:param name="cc" select="document('d.xml')/d"/> <xsl:value-of select="$cc"/> <c>c</c> </xsl:template> </xsl:stylesheet> c/d.xml: <?xml version='1.0' encoding="utf-8"?> <d>d</d> Please pay attention that two last in subdirectory "с". Then: [fva@fva]$ xsltproc b.xsl a.xml warning: failed to load external entity "d.xml" <?xml version="1.0"?> <c>c</c><b>b</b> This style of coding is widely used in modern DITA stylesheets.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxslt/-/issues/ Thank you for your understanding and your help.