Subject: Re: [xsl] Adding namespaces to output From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 23 Dec 2002 14:18:50 -0500 |
Hi Felix,
On Monday 23 Dec 2002 3:09 pm, hauser felix wrote:
> Question: Do you know how to add a prefixed namespace > ('xmlns:p="URI"', where URI is not known in advance) > to an output element ('<a>...</a>') WITHOUT producing > an additional dummy-Attribute > ('p:dummy-for-xmlns=""')? One Solution would be to > transform the output document again and just remove > the dummy-Attribute, but this doesn't seem to be very > ellegant.
You can get the same effect by using a temporary tree and then copying the namespace out of it.
<xsl:variable name="dummy"> <xsl:element name="p:a" namespace="something"/> </xsl:variable>
<a> <xsl:copy-of select="$dummy/*/namespace::*[1]"/> </a>
You will need to use your processors nodeset function to access $dummy in the copy-of.
There may be a minor portability issue here in that a processor is not required to respect your choice of prefix, i.e. the 'p' may be changed to something else, although that is unlikely unless you have used 'p' for something else.
-- Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO: - North America: Feb 3 - Feb 7,2003
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-10-1 Practical Formatting Using XSL-FO Next conference training: 2003-03-03,06
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Adding namespaces to outp, Kevin Jones | Thread | Re: [xsl] Adding namespaces to outp, Kevin Jones |
Re: [xsl] Adding namespaces to outp, Kevin Jones | Date | Re: [xsl] accessing CDATA from XSL, Mike Brown |
Month |