adding multiple name spaces

Discussion in 'XML' started by Rolf Kemper, Sep 13, 2004.

  1. Rolf Kemper

    Rolf Kemper Guest

    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
     
    Rolf Kemper, Sep 13, 2004
    #1
    1. Advertising

  2. Rolf Kemper

    Mukul Gandhi Guest

    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

    (Rolf Kemper) wrote in message news:<>...
    > 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, Sep 14, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bobby Chamness
    Replies:
    2
    Views:
    2,440
    Joe Smith
    Apr 22, 2007
  2. John B. Matthews
    Replies:
    4
    Views:
    694
    John B. Matthews
    Sep 12, 2008
  3. Roedy Green
    Replies:
    3
    Views:
    658
  4. Tomasz Chmielewski

    [CSS] how can I show spaces as spaces?

    Tomasz Chmielewski, Sep 5, 2009, in forum: HTML
    Replies:
    21
    Views:
    1,679
    Jan C. Faerber
    Sep 10, 2009
  5. Tomasz Chmielewski

    how can I show spaces as spaces, part 2

    Tomasz Chmielewski, Sep 9, 2009, in forum: HTML
    Replies:
    14
    Views:
    908
    Jan C. Faerber
    Sep 10, 2009
Loading...

Share This Page