adding multiple name spaces

Rolf Kemper

Usenet Archive
Joined
Mar 26, 2003
Messages
35
Reaction score
0
Dear All,

I need some help on an XLST. I need to create an XML output from some xml document by XSLT. The top element must contain multiple name spaces.

I tried this as an example:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:eek:utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:element name="E1" namespace="urn:ns1name"> <xsl:attribute name="ns2name" namespace="xmlns">urn:ns2</xsl:attribute> <xsl:attribute name="ns3name" namespace="xmlns">urn:ns3</xsl:attribute> </xsl:element> </xsl:template> </xsl:stylesheet>

The output (created by ALTOVA XMLSPY with MSXML 4 ) looks like this

<?xml version="1.0" encoding="UTF-8"?>
<E1 auto-ns1:ns2name="urn:ns2" auto-ns1:ns3name="urn:ns3" xmlns:auto-ns1="xmlns" xmlns="urn:ns1name" />

I expected this:
<?xml version="1.0" encoding="UTF-8"?>
<E1 xmlns="urn:ns1" xmlns:ns2name="urn:ns2" xmlns:ns3name="urn:ns3"/>

Is the output I got equivalent to what I expected ??
How can I achieve the expected output ??

Thanks a lot for your help
Rolf
 

Mukul Gandhi

Usenet Archive
Joined
Sep 14, 2004
Messages
43
Reaction score
0
Hi Rolf,
You can write as this -

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:eek:utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">
<E1 xmlns="urn:ns1" xmlns:ns2name="urn:ns2" xmlns:ns3name="urn:ns3"> <!--anything else --> </E1> </xsl:template>

</xsl:stylesheet>

Regards,
Mukul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top