On Dec 5, 2006, at 9:29 AM, Simone Gianni wrote:
Yep, the problem with this approach is that you manage to know if a
namespace declaration has been used only when you reach the end of the
document (after checking that no element used it)
Yeah, it takes two passes. Better to declare up-front which namespaces
to preserve...
What i was proposing would be simply to enable it by default (already
too many options in cocoon, and if a page containing a i18n namespace
declaration is not visualized by IE, by default cocoon should not send
it), but limit it's influence on a set of namespaces (all namespaces
http://cocoon.apache.org for example) and eventually have this set
configurable by the user so that there will be no need in the future
for
remove-that-certain-unwanted-ns.xsl files :D
I'm not keen on magic or specialness based on either (a) IE
misbehavior, or (b) cocoon URIs. Anyway, like you have said, this
thing is starting to have too many options for "common feature of
XML/HTML serializers"... I'm now leaning back toward the idea of a
transformer. The objection that it's onerous to include this
transformer "in every pipeline" is weak, because (a) it doesn't have to
be "in every pipeline", only in final presentation pipelines, and (b)
you'd naturally factor that and the serializer into a <map:resource>
anyway.
How about a NamspaceTransformer, configured with
<namespaces>
<null-namespace/>
<namespace prefix="prefix">URI</namespace>
.
.
.
<namespaces>
Where:
1) If <null-namespace> is present, then the null NS is the default NS
2) Otherwise, the NS with @default="true" is the default NS (more than
1 such = error, or > 0 if we have <null-namespace/>
3) @prefix is optional; if not set, then use the first prefix found for
the NS
4) The transformer writes all the namespace declarations into the root
element, deletes them from any descendant elements
5) If a namespace is found that is not in the configured <namespaces>,
throw an error
How does that sound?
—ml—