Advertisement

05.06.2008 at 09:30AM PDT, ID: 23380022 | Points: 500
[x]
Attachment Details

Convert XML to XML with XSLT Add namespace problem

Tags: XSLT, XML,XSLT
I need to convert one XML into another XML document using xslt and add a namespace to an element.

I need to be able to add the xmlns="http://www.opentravel.org/OTA/2003/05" to the POS element to produce the following:

<OTA_HotelDescriptiveInfoRQ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" EchoToken="Test" PrimaryLangID="en" xmlns="http://www.opentravel.org/OTA/2003/05">
<POS xmlns="http://www.opentravel.org/OTA/2003/05">
<Source>
<RequestorId ID="999" ID_Context="Me" />
</Source>
</POS>

Here is what I thought would work in the xslt document:

                  <xsl:element name="POS" namespace="http://www.opentravel.org/OTA/2003/05">
                        <xsl:element name="Source">
                              <xsl:element name="RequestorId" use-attribute-sets="requestor" />
                        </xsl:element>
                  </xsl:element>

However the resulting xml document comes out without the namespace as:

      <POS>
            <Source>
                  <RequestorId ID="999" ID_Context="Me"/>
            </Source>
      </POS>

I also need to insert the same namespace in another element further down the document, but obviously that fails too.

Any help would be really appreciated.
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: Bill_Harrison
Question Asked On: 05.06.2008
Participating Experts: 2
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.06.2008 at 10:06AM PDT, ID: 21509053

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 10:14AM PDT, ID: 21509121

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 10:17AM PDT, ID: 21509157

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 11:53AM PDT, ID: 21509881

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 11:59AM PDT, ID: 21509943

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 03:22PM PDT, ID: 21511553

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 05:14AM PDT, ID: 21515492

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628