[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Getting at namespace-prefix used in source document
Hello, is there a way in XSLT to determine the namespace prefix used in the source document for a given namespace name? The issue I need to solve is that I have a source document with namespaced elements, which I need to move to the null (or some other) namespace using XSLT. However, the source document also includes an embedded CSS 2.1 stylesheet, which of course is written in a way to match the prefixes used in the source. When porting the document to the null namespace, I have to remove the prefixes in the CSS 2.1 code too, see this conceptual example: --source-- <ns:document xmlns:ns="http://example.com" xmlns:html="http://the-usual-ns"> <ns:style type="text/css"> ns\:par { font-weight: bold; } html\:table { width: 10cm; } </style> <ns:par>A paragraph.</ns:par> ... </ns:document> --desired result-- <document xmlns:html="http://the-usual-ns"> <style type="text/css"> par { font-weight: bold; } html\:table { width: 10cm; } </style> <par>A paragraph.</par> ... </document> To make my stylesheet independent from the namespace prefix actually used in the source document, I think I need to know the namespace prefix used for "http://example.com" in the source document. Is there a way to get at this, or is the only solution to pass it as a parameter to my XSLT (and seeing how I can provide this info, e.g. by some custom code peeping into the XML with a little SAX parsing)? Regards, Christian.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|