xsl-list
[Top] [All Lists]

Re: [xsl] [XSLT 1.0] Strip unused namespaces, but retain namespace declarations for elements with QName values?

2011-03-30 13:53:49

3. Retain a namespace declaration if it declares a namespace prefix that is 
used in an element QName value, e.g.,

    Retain this: xmlns:soap="..."

    because the prefix is used in this element's 
value:<faultcode>SOAP:client</faultcode>


Well, the prefix isn't used in the value. SOAP and soap are quite different prefixes.

If prefixes are used only as part of element values that are QNames, you might be able to do this. If prefixes can also appear, as they do in XSLT, in contexts like exclude-result-prefixes="a b c d" then you are out of luck, unless you have knowledge of the semantics of the vocabulary.

You could for example find all the namespace prefixes that are in use in QNames in content as

//*[contains(., ':) and . castable as xs:QName]/substring-before(., ':')

and then ensure that namespace declarations for this prefix are copied.

Michael Kay
Saxonica

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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