GNOME Bugzilla – Bug 519887
Does not appear to handle xml:base correctly (GRDDL related)
Last modified: 2021-07-05 10:59:43 UTC
Please describe the problem: See http://www.w3.org/TR/grddl/#base_misc libxslt is not retaining the xml:base attribute in this test case. Transforming http://www.w3.org/2001/sw/grddl-wg/td/inline-rdf5.xml with http://www.w3.org/2003/g/inline-rdf.xsl does not produce http://www.w3.org/2001/sw/grddl-wg/td/embedded-rdf5-output.rdf Steps to reproduce: G:\work>xsltproc.exe http://www.w3.org/2003/g/inline-rdf.xsl http://www.w3.org/2001/sw/grddl-wg/td/inline-rdf5.xml Actual results: <?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:data-view="http://www.w3.org/2003/g/data-view#" xmlns:xa="http://www.w3.org/2003/g/xml-attributes#"> <rdf:Description rdf:about="" rdf:value="one"/> </rdf:RDF> Expected results: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:data-view="http://www.w3.org/2003/g/data-view#"> <rdf:Description rdf:about="" xml:base="http://example.org/"> <rdf:value>one</rdf:value> </rdf:Description> </rdf:RDF> Does this happen every time? Yes Other information: This blocks libxslt based GRDDL implementations From http://www.w3.org/TR/grddl-tests/ more xml:base related failures * Embedded RDF using a relative xml:base * An XHTML profile using a base element
As far as I know XSLT-1.0 does not say anything about xml:base (and for a good reason it went to REC years before xml:base !). So any xml:base processing you can expect from libxslt has to come from explicit template, I don't see this being defined in inline-rdf.xsl . I don't really have the time to dig out what is really happening, I suggest you use xsltproc -v to see what is going on and provide a specific test case exhibiting the problem with xsltproc. Or explain what is not working more precisely. thanks, Daniel
C:\>xsltproc -v http://www.w3.org/2003/g/inline-rdf.xsl http://www.w3.org/2001/sw/grddl-wg/td/inline-rdf5.xml inline-rdf.xml <embedded xml:base="http://example.org/" xmlns:data-view="http://www.w3.org/2003/g/data-view#" data-view:transformation="http://www.w3.org/2003/g/inline-rdf.xsl"> <a> <b/> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" rdf:value="one"/> </rdf:RDF> </a> </embedded> Should produce: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:data-view="http://www.w3.org/2003/g/data-view#"> <rdf:Description rdf:about="" xml:base="http://example.org/"> <rdf:value>one</rdf:value> </rdf:Description> </rdf:RDF> By: Applying xa:base-and-lang ... and then calling the template xa:base ... which should apply xa:base-sub-template I believe its getting this test wrong, and therefor not applying xa:base-sub-template (Approx line 155 of output): xsltIf: test $node/ancestor-or-self::*[/xhtml:html or position()!=last()][@xml:base] or $node-used-by-ancestor/ancestor-or-self::*[/xhtml:html or position()!=last()][@xml:base] Lookup variable 'node' Lookup variable 'node-used-by-ancestor' xsltIf: test evaluate to 0 See template xa:base http://www.w3.org/2003/g/xml-attributes# (Line 431) Output: C:\>xsltproc -v http://www.w3.org/2003/g/inline-rdf.xsl http://www.w3.org/2001/sw/grddl-wg/td/inline-rdf5.xml creating dictionary for stylesheet reusing dictionary from http://www.w3.org/2003/g/inline-rdf.xsl for stylesheet xsltParseStylesheetProcess : found stylesheet xsltPrecomputeStylesheet: removing ignorable blank node Reusing dictionary for document creating dictionary for stylesheet reusing dictionary from http://www.w3.org/2003/g/xml-attributes for stylesheet xsltParseStylesheetProcess : found stylesheet xsltPrecomputeStylesheet: removing ignorable blank node xsltParseStylesheetTop : found foreign element html Registering global variable use-xml-base-in-xhtml Defining global variable use-xml-base-in-xhtml Registering global variable default-node-used-by-ancestor Defining global variable default-node-used-by-ancestor template has 3 inherited namespaces template has 3 inherited namespaces template has 3 inherited namespaces template has 3 inherited namespaces template has 3 inherited namespaces template has 3 inherited namespaces template has 3 inherited namespaces xsltParseTemplateContent: removing text template has 3 inherited namespaces template has 3 inherited namespaces xsltParseTemplateContent: removing text parsed 9 templates Registering global variable use-xml-base-in-xhtml Defining global variable use-xml-base-in-xhtml xsltParseStylesheetTop : found foreign element html template has 3 inherited namespaces xsltCompilePattern : parsing '/' xsltCompilePattern : parsed /, default priority 0.500000 added pattern : '/' priority 0.500000 template has 3 inherited namespaces xsltCompilePattern : parsing 'rdf:RDF' xsltCompilePattern : parsed rdf:RDF, default priority 0.000000 added pattern : 'rdf:RDF' priority 0.000000 template has 3 inherited namespaces xsltParseStylesheetTemplate: mode rdfTopLevel xsltCompilePattern : parsing '*' xsltCompilePattern : parsed *, default priority -0.500000 added pattern : '*' mode 'rdfTopLevel' priority 1.000000 template has 3 inherited namespaces xsltCompilePattern : parsing 'text()' xsltCompilePattern : parsed text(), default priority -0.500000 xsltCompilePattern : parsing '@*' xsltCompilePattern : parsed @*, default priority -0.500000 added pattern : 'text()' priority -0.500000 added pattern : '@*' priority -0.500000 parsed 4 templates Resolving attribute sets references Creating sub-dictionary from stylesheet for transformation Registered 0 modules reusing transformation dict for output Registering global variables Registering global variables from http://www.w3.org/2003/g/inline-rdf.xsl Registering global variables from http://www.w3.org/2003/g/xml-attributes Evaluating global variable default-node-used-by-ancestor Lookup variable 'use-xml-base-in-xhtml' Evaluating global variable use-xml-base-in-xhtml Object is a Boolean : true found variable 'use-xml-base-in-xhtml' Object is a Node Set : Set contains 1 nodes: 1 ELEMENT embedded namespace data-view href=http://www.w3.org/2003/g/data-view# ATTRIBUTE base TEXT content=http://example.org/ ATTRIBUTE transformation TEXT content=http://www.w3.org/2003/g/inline-rdf.xsl xsltProcessOneNode: applying template '/' for / xsltApplySequenceConstructor: copy node RDF xsltApplyTemplates: list of 2 nodes xsltProcessOneNode: no template found for comment xsltProcessOneNode: no template found for embedded xsltDefaultProcessOneNode: applying template for text xsltProcessOneNode: no template found for a xsltDefaultProcessOneNode: applying template for text xsltProcessOneNode: no template found for b xsltDefaultProcessOneNode: applying template for text xsltProcessOneNode: applying template 'rdf:RDF' for RDF xsltApplyTemplates: node: 'RDF' xsltApplyTemplates: select * xsltApplyTemplates: list of 1 nodes xsltProcessOneNode: applying template '*' for Description xsltCopy: node Description xsltCopyOf: select @* xsltCopyOf: result is a node set call-template: name base-and-lang applying xsl:template 'base-and-lang' Registering param node Building variable node select current() Evaluating variable 'node' Object is a Node Set : Set contains 1 nodes: 1 ELEMENT rdf:Description ATTRIBUTE about TEXT content= ATTRIBUTE value TEXT content=one Registering param node-used-by-ancestor Building variable node-used-by-ancestor select $xa:default-node-used-by-ancestor Evaluating variable 'node-used-by-ancestor' Lookup variable 'default-node-used-by-ancestor' found variable 'default-node-used-by-ancestor' Object is a Node Set : Set contains 1 nodes: 1 ELEMENT embedded namespace data-view href=http://www.w3.org/2003/g/data-view# ATTRIBUTE base TEXT content=http://example.org/ ATTRIBUTE transformation TEXT content=http://www.w3.org/2003/g/inline-rdf.xsl call-template: name base Handling xsl:with-param node select $node Building variable node select $node Evaluating variable 'node' Lookup variable 'node' Object is a Node Set : Set contains 1 nodes: 1 ELEMENT rdf:Description ATTRIBUTE about TEXT content= ATTRIBUTE value TEXT content=one Handling xsl:with-param node-used-by-ancestor select $node-used-by-ancestor Building variable node-used-by-ancestor select $node-used-by-ancestor Evaluating variable 'node-used-by-ancestor' Lookup variable 'node-used-by-ancestor' Object is a Node Set : Set contains 1 nodes: 1 ELEMENT embedded namespace data-view href=http://www.w3.org/2003/g/data-view# ATTRIBUTE base TEXT content=http://example.org/ ATTRIBUTE transformation TEXT content=http://www.w3.org/2003/g/inline-rdf.xsl applying xsl:template 'base' xsltIf: test not(/xhtml:html) or $xa:use-xml-base-in-xhtml xsltIf: test evaluate to 1 xsltIf: test $node/ancestor-or-self::*[/xhtml:html or position()!=last()][@xml:base] or $node-used-by-ancestor/ancestor-or-self::*[/xhtml:html or position()!=last()][@xml:base] Lookup variable 'node' Lookup variable 'node-used-by-ancestor' xsltIf: test evaluate to 0 call-template returned: name base call-template: name lang Handling xsl:with-param node select $node Building variable node select $node Evaluating variable 'node' Lookup variable 'node' Object is a Node Set : Set contains 1 nodes: 1 ELEMENT rdf:Description ATTRIBUTE about TEXT content= ATTRIBUTE value TEXT content=one applying xsl:template 'lang' xsltIf: test $node/ancestor-or-self::*[@xml:lang] or not(/xhtml:html) Lookup variable 'node' xsltIf: test evaluate to 1 xsltIf: test $node/ancestor-or-self::*[@xml:lang] Lookup variable 'node' xsltIf: test evaluate to 0 xsltIf: test /xhtml:html and not($node/ancestor-or-self::*[@xml:lang]) xsltIf: test evaluate to 0 call-template returned: name lang call-template returned: name base-and-lang xsltCopyOf: select node() xsltCopyOf: result is a node set xsltDefaultProcessOneNode: applying template for text xsltDefaultProcessOneNode: applying template for text freeing transformation dictionary freeing dictionary from stylesheet freeing dictionary from stylesheet C:\>
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.