xsl-list
[Top] [All Lists]

[xsl] RE : RE: [xsl] root siblings contain xmlns=""

2006-06-12 03:18:12
christoph(_dot_)klocker(_at_)rcm(_dot_)at wrote:

  Hi

test.xml:
<test >
    <element1>test</element1>
    <element2>test</element2>
</test>

test.xsl:

[...]

output:
<?xml version="1.0" encoding="UTF-8"?><Fxml xmlns="a-namespace-uri"
Version="2_0_2">
    <element1 xmlns="">test</element1>
    <element2 xmlns="">test</element2>
</Fxml>

my desired output:
<?xml version="1.0" encoding="UTF-8"?><Fxml xmlns="a-namespace-uri"
Version="2_0_2">
    <element1>test</element1>
    <element2 >test</element2>
</Fxml>

  You are copying elements from no namespace, and want to have them in
a specific namespace.  So you have to make something more than just
copy them.  For example (depending on the exact semantics of your
transformation):

    <xsl:template match="@*|node()" piority="0">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>

    <xsl:template match="*">
      <xsl:element name="{local-name()}" namespace="...">
        <xsl:apply-templates select="@*|node()"/>
      </xsl:element>
    </xsl:template>

  Not tested.

  Regards,

--drkm























__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible 
contre les messages non sollicités 
http://mail.yahoo.fr Yahoo! Mail 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>