Subject: [xsl] Getting at namespace-prefix used in source document From: "Christian Roth" <roth@xxxxxxxxxxxxxx> Date: Sun, 10 Sep 2006 16:22:03 +0200 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Building a HTML checkbox , Ruben Trancoso | Thread | Re: [xsl] Getting at namespace-pref, David Carlisle |
Re: [xsl] Petri net to BPEL model t, stgn | Date | Re: [xsl] Getting at namespace-pref, David Carlisle |
Month |