xsl-list
[Top] [All Lists]

Re: [xsl] Excluding Namespaces from the Result Tree

2015-06-30 05:44:03
Heiko Niemann kontakt(_at_)heiko-niemann(_dot_)de wrote:

using XSLT 2.0 there is the value #all for the attribute
exclude-result-prefixes. I try to find cases where you would NOT want to
use it, in other words why would you want to keep namespaces in the
result
tree that are not used there? Which leads to the question why cleaning
up
namespaces is not a default behavior.

With XML ou can use qualified names not only as names for nodes but also
in element or attribute values, for instance if you want to construct an
XSD schema with XSLT, and in that case if you want for instance to have

   <xs:element ref="pf1:foo"/>

in your result then, even if the prefix 'pf1' is not used in element or
attribute names, you want to preserve its declaration.


Thanks Martin,

now it came back to my mind. Some years ago I actually had to deal with
cleaning up namespaces but keeping the ones that were used in qualified
names as values in elements or attributes - which caused lots of
frustration as I remember. I still think that this is a confusing aspect
of XSLT/XML that there is not a real connection of parts in one context
(XSLT) that are meant to be connected in a different context (XSD schema).
So one pitfall could be using #all with exclude-result-prefixes another
one using copy-namespaces="no" within copy-of.

I do understand that for XSLT element or attribute values are just plain
values/strings although they might be qualified names. Would a
schema-aware processor solve this problem? I have never used one...

Heiko
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>