[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [XSLT 1.0] Strip unused namespaces, but retain na

Subject: Re: [XSLT 1.0] Strip unused namespaces, but retain namespace declarations for elements with QName values?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 30 Mar 2011 19:53:31 +0100
Re:  [XSLT 1.0] Strip unused namespaces
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.