N
n.phelge
I'm trying to validate XML which doesn't include a namespace, so I've
written a schema and I'm attempting to add a namespace to the original
XML using XSLT. The original XML looks like this:
<orderlist>
<order>
<header>
<ordernum>1313</ordernum>
</header>
</order>
<order>
<header>
<ordernum>1314</ordernum>
</header>
</order>
</orderlist>
and I would like to be transformed to the following:
<orderlist xmlns="urn:MyOrder-schema">
<order>
<header>
<ordernum>1313</ordernum>
</header>
</order>
<order>
<header>
<ordernum>1314</ordernum>
</header>
</order>
</orderlist>
However, every approach I've taken to writing an XSLT to do this
results in a blank namespace for the next-level elements, such as the
following:
<orderlist xmlns="urn:MyOrder-schema">
<order xmlns="">
<header>
<ordernum>1313</ordernum>
</header>
</order>
<order xmlns="">
<header>
<ordernum>1314</ordernum>
</header>
</order>
</orderlist>
This empty namespace results in a failed validation. Is there an
approach to adding a namespace to the top-most element of an XML
fragment using XSL such that the namespace of the next-level elements
aren't affected? I really need to be able to validate this XML, so any
help is greatly appreciated.
Thanks in advance
written a schema and I'm attempting to add a namespace to the original
XML using XSLT. The original XML looks like this:
<orderlist>
<order>
<header>
<ordernum>1313</ordernum>
</header>
</order>
<order>
<header>
<ordernum>1314</ordernum>
</header>
</order>
</orderlist>
and I would like to be transformed to the following:
<orderlist xmlns="urn:MyOrder-schema">
<order>
<header>
<ordernum>1313</ordernum>
</header>
</order>
<order>
<header>
<ordernum>1314</ordernum>
</header>
</order>
</orderlist>
However, every approach I've taken to writing an XSLT to do this
results in a blank namespace for the next-level elements, such as the
following:
<orderlist xmlns="urn:MyOrder-schema">
<order xmlns="">
<header>
<ordernum>1313</ordernum>
</header>
</order>
<order xmlns="">
<header>
<ordernum>1314</ordernum>
</header>
</order>
</orderlist>
This empty namespace results in a failed validation. Is there an
approach to adding a namespace to the top-most element of an XML
fragment using XSL such that the namespace of the next-level elements
aren't affected? I really need to be able to validate this XML, so any
help is greatly appreciated.
Thanks in advance