GNOME Bugzilla – Bug 598624
XSLT does not resolve relative URLs correctly when using HTMLParser
Last modified: 2021-07-05 13:21:31 UTC
The second parameter of function document( 'path', . ) is node-set used to resolve relative URLs. When loading an external document using the XMLParser, this works as expected: $ xsltproc --load-trace test.xsl scratch/doc.html Loaded URL="test.xsl" ID="(null)" Loaded URL="scratch/doc.html" ID="(null)" warning: failed to load external entity "scratch/path" However, when using the HTMLParser, the relative url is not being calculated: $ xsltproc --load-trace --html test.xsl scratch/doc.html Loaded URL="test.xsl" ID="(null)" Loaded URL="scratch/doc.html" ID="(null)" warning: failed to load external entity "path" Here are the source documents used above: $ cat test.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:copy-of select="document('path', . )"/> </xsl:template> </xsl:stylesheet> $ cat scratch/doc.html <html><body>content</body></html> And the versions: $ xsltproc --version Using libxml 20703-SVN3827, libxslt 10124-SVN1494 and libexslt 813 xsltproc was compiled against libxml 20703, libxslt 10124 and libexslt 813 libxslt 10124 was compiled against libxml 20703 libexslt 813 was compiled against libxml 20703 I see the same problem when doing this through python lxml.
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/libxml2/-/issues/ Thank you for your understanding and your help.