Subject: Re: [xsl] adding element in with general namespace prefix From: Michael Kay <mike@xxxxxxxxxxxx> Date: Wed, 08 Feb 2012 22:16:00 +0000 |
Michael Kay Saxonica
Ram,
Maybe you want to use xsl:copy, which may do better for you. Most processors, when copying an element, will use the same prefix as the input document uses.
Or it may not: as Ken says, processors are not obliged to respect prefixes since a prefix is not properly part of the name, as formally defined; it is only a (local) binding mechanism.
If you are answering a requirement from a partner who does not understand this, you can, in XSLT 2.0, go to considerably more work to construct elements with namespaces, names and their prefixes generated dynamically, using XPath functions such as name(), prefix-from-QName(), and namespace-uri-for-prefix(). An XSLT stylesheet could generate a new header using whatever prefix the input uses, whatever it is -- although such a stylesheet will look pretty mysterious to the uninitiated.
But this is not trivial to do, and a lot of trouble to go to for something that matters only because someone thinks it matters. Even worse, if you are addressing a set of requirements that have never been articulated, which you have only because someone at some point might be unhappy about something ... well. That's a difficult problem to solve.
Cheers, Wendell
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] adding element in with ge, Wendell Piez | Thread | [xsl] Parent Node recursion templat, Karl Stubsjoen |
Re: [xsl] adding element in with ge, Wendell Piez | Date | Re: [xsl] adding element in with ge, ram |
Month |