Vadim Gritsenko wrote:

Sylvain Wallez wrote:

Vadim Gritsenko wrote:

As a side note, the refactored NamespacesTable I committed yesterday is a killer tool to cleanly handle namespaces (see RedundantNamespacesFilter). I plan to use it in some transformers that "consume" namespaces such as i18n, xinclude, etc to ensure the consumed namespaces never passes through the transformer.


If transformer consumes its namespace completely, it's way more efficient to simply filter out the namespace completely.


It's not always that easy, as you have to remove the startPrefixMapping and the endPrefixMapping. The start is easy because you've got the URI, but the end isn't so easy as you have to know which prefix to filter out, and several prefixes can be used for the same URI (or the same prefix can also hide a previous one).


I know. Won't simplier use of NamespacesTable solve this [1]?


Yes, that's exactly that! However, some components have to deal with more complex combinations of namespaces and require more than what's in XIncludeTransformer. One such component is JXTG where we may have start/endPrefixMapping with no elements inbetween (macro declarations) and prefixes we want to exclude from the result, like XSL's exlude-result-prefixes. In such cases, the enterScope/leaveScope feature of NamespacesTable is useful.

Sylvain

[1] http://svn.apache.org/repos/asf/cocoon/trunk/src/java/org/apache/cocoon/transformation/IncludeTransformer.java



--
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director

Reply via email to