After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 114360 - document(), base URI and entities
document(), base URI and entities
Status: RESOLVED OBSOLETE
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2003-06-03 20:02 UTC by stephane.bidoul
Modified: 2021-07-05 11:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (tgz, directories are important) (512 bytes, application/octet-stream)
2003-06-03 20:04 UTC, stephane.bidoul
Details

Description stephane.bidoul 2003-06-03 20:02:52 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
Comment 1 stephane.bidoul 2003-06-03 20:04:06 UTC
Created attachment 17103 [details]
test case (tgz, directories are important)
Comment 2 Daniel Veillard 2003-06-09 10:48:09 UTC
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
Comment 3 Vjacheslav 2008-07-01 16:57:18 UTC
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.
Comment 4 GNOME Infrastructure Team 2021-07-05 11:00:29 UTC
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.