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 318612 - xsltproc should not serialize unused namespaces
xsltproc should not serialize unused namespaces
Status: RESOLVED INVALID
Product: libxslt
Classification: Platform
Component: general
1.1.14
Other All
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-10-11 20:35 UTC by haui
Modified: 2005-10-12 14:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description haui 2005-10-11 20:35:55 UTC
Assume, you want to write a transformation that removes all attributes and
elements that belong to a certain namespace from a given document, you would
expect that the namespace declarations, which cannot be controlled from within
XSLT, will also disappear. This is not the case.

It is especially not possible to use xsltproc for testing, whether a document is
conforming SVG. This test requires removing all elements not from the SVG
namespace and then checking against the specified DTD. This test fails, because
the namespace declarations from foreign namespace are not removed. Since DTD is
not aware of namespaces, the resulting document is not a valid SVG document. 

BTW, xmllint --nsclean also fails to remove completely unused namespaces.

Other information:
Comment 1 Daniel Veillard 2005-10-11 20:55:29 UTC
The XSLT spec states that any namespace in scope of a dumped element must be
issued. I have no idea what you meant by "cannot be controlled from within
XSLT". You can explicitely express from XSLT 1.0 that some namespaces must not be
saved unless used by the output document structure. Otherwise any in-scope 
namespaces are dumped because they may be used *outside* of the document structure
(in text or attribute content) and the processor will not try to guess if this
is the case or not. 
In absence of further information (reproductable test case) I think this bug
is in error, though I'm very confused by your terminology.

Daniel
Comment 2 haui 2005-10-11 21:10:40 UTC
Of cause you are right. This bug report has at least the wrong receiver. My
problem cannot be generally solved with XSLT 1.0, because one can only express
that some explicitely enumerated namespaces should not be saved. It is not
possible to express that "none *expect* some explicitely enumerated namespaces"
should be saved. Am I wrong again?

Bernhard
Comment 3 haui 2005-10-11 21:34:17 UTC
Ok, I'm wrong again. :-)

Just not <copy> a namespace node then it'll not be saved in the result document....

Sorry for the noise
Bernhard
Comment 4 Daniel Veillard 2005-10-12 14:09:44 UTC
yes basically instead of using xsl:copy-of , just use xsl:element with the
name , add the attributes and namespace you want and recurse, you should be
able to control the namespaces emitted in this fashion

Daniel