Avatar of vvsrk76
vvsrk76
 asked on

Change prefix in xml document

This is the generated xml . I want to change the prefix .

<?xml version="1.0" encoding="UTF-8"?>
<oagis_1:AddRequestForQuote xmlns:oagis="http://www.openapplications.org/oagis" xmlns:oagis_1="http://www.aftermarket.org/oagis" >
  <oagis:ApplicationArea>
    <oagis:Sender>
      <oagis:LogicalId>NEXPART</oagis:LogicalId>
      <oagis:ReferenceId>3BA23E0C-B942-E7C1-C3CC-C7FE50A68046</oagis:ReferenceId>
      <oagis:Confirmation>0</oagis:Confirmation>
    </oagis:Sender>
    <oagis:CreationDateTime>2008-12-18T21:23:10Z</oagis:CreationDateTime>
    <oagis:BODId>3BA23E0C-B942-E7C1-C3CC-C7FE50A680</oagis:BODId>
  </oagis:ApplicationArea>
  <oagis:DataArea>
    <oagis:Add confirm="Always"/>
    <oagis:RequestForQuote>
      <oagis_1:Header>
        <oagis:Parties>
          <oagis:BillToParty>
            <oagis:PartyId>
              <oagis:Id>6595</oagis:Id>
            </oagis:PartyId>
          </oagis:BillToParty>
          <oagis:ShipFromParty>
            <oagis:PartyId>
              <oagis:Id>8</oagis:Id>
            </oagis:PartyId>
          </oagis:ShipFromParty>
          <oagis:ShipFromParty>
            <oagis:PartyId>
              <oagis:Id>7</oagis:Id>
            </oagis:PartyId>
          </oagis:ShipFromParty>
        </oagis:Parties>
      </oagis_1:Header>
      <oagis_1:Line>
        <oagis:LineNumber>1</oagis:LineNumber>
        <oagis_1:OrderItem>
          <oagis_1:ItemIds>
            <oagis_1:SupplierItemId>
              <oagis:Id>13 427</oagis:Id>
            </oagis_1:SupplierItemId>
            <oagis_1:SupplierCode>IMC</oagis_1:SupplierCode>
          </oagis_1:ItemIds>
        </oagis_1:OrderItem>
        <oagis:OrderQuantity uom="EACH">1</oagis:OrderQuantity>
      </oagis_1:Line>
    </oagis:RequestForQuote>
  </oagis:DataArea>
</oagis_1:AddRequestForQuote>
 
I would like the Xml to look like the following
 
<?xml version="1.0" encoding="UTF-8"?>
<aaia:AddRequestForQuote xsi:schemaLocation="http://www.aftermarket.org/oagis AddRequestForQuote.xsd" xmlns:oa="http://www.openapplications.org/oagis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aaia="http://www.aftermarket.org/oagis">
 <oa:ApplicationArea>
  <oa:Sender>
   <oa:LogicalId>NEXPART</oa:LogicalId>
   <oa:ReferenceId>3BA23E0C-B942-E7C1-C3CC-C7FE50A68036</oa:ReferenceId>
   <oa:Confirmation>0</oa:Confirmation>
  </oa:Sender>
  <oa:CreationDateTime>2008-12-18T21:23:10Z</oa:CreationDateTime>
  <oa:BODId>3BA23E0C-B942-E7C1-C3CC-C7FE50A68036</oa:BODId>
 </oa:ApplicationArea>
 <oa:DataArea>
  <oa:Add confirm="Always"/>
  <oa:RequestForQuote>
   <aaia:Header>
    <oa:Parties>
     <oa:BillToParty>
      <oa:PartyId>
       <oa:Id>6595</oa:Id>  
      </oa:PartyId>  
     </oa:BillToParty>  
     <oa:ShipFromParty>  
      <oa:PartyId>  
       <oa:Id>8</oa:Id>  
      </oa:PartyId>  
     </oa:ShipFromParty>  
     <oa:ShipFromParty>  
      <oa:PartyId>  
       <oa:Id>7</oa:Id>  
      </oa:PartyId>  
     </oa:ShipFromParty>  
    </oa:Parties>  
   </aaia:Header>  
   <aaia:Line>  
    <oa:LineNumber>1</oa:LineNumber>  
    <aaia:OrderItem>  
     <aaia:ItemIds>  
      <aaia:SupplierItemId>  
       <oa:Id>13 427</oa:Id>  
      </aaia:SupplierItemId>  
      <aaia:SupplierCode>IMC</aaia:SupplierCode>  
     </aaia:ItemIds>  
    </aaia:OrderItem>  
    <oa:OrderQuantity uom="EACH">1</oa:OrderQuantity>  
   </aaia:Line>  
  </oa:RequestForQuote>  
 </oa:DataArea>  
</aaia:AddRequestForQuote>

Thanks
XML

Avatar of undefined
Last Comment
abel

8/22/2022 - Mon
abel

Can you use XSLT? It should be a breeze with that. Hold on, I'll show you.
abel

If you use this XSLT stylesheet, you'll get the output as shown in the next post of mine, which is the same as in your post:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="node() | @*">
        <xsl:copy>
            <xsl:apply-templates select="node() | @*" />
        </xsl:copy>
    </xsl:template>
    
    
 
    <xsl:template match="*[not(*) and not(text())]">
        <xsl:copy>
            <xsl:attribute 
                name="xsi:nil"                 
                namespace="http://www.w3.org/2000/10/XMLSchema-instance" >
                
                <xsl:text>True</xsl:text>
            </xsl:attribute>
            <xsl:variable name="value" select="3" />
            <test x="ttt{$value}" />
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

Open in new window

abel

This is the output from my test environment, using your source. It easy to amend the prefixes and/or to parameterize them if you want that:

<?xml version="1.0" encoding="utf-8"?>
<aaia:AddRequestForQuote xmlns:aaia="http://www.aftermarket.org/oagis">
    <oa:ApplicationArea xmlns:oa="http://www.openapplications.org/oagis">
        <oa:Sender>
            <oa:LogicalId>NEXPART</oa:LogicalId>
            <oa:ReferenceId>3BA23E0C-B942-E7C1-C3CC-C7FE50A68046</oa:ReferenceId>
            <oa:Confirmation>0</oa:Confirmation>
        </oa:Sender>
        <oa:CreationDateTime>2008-12-18T21:23:10Z</oa:CreationDateTime>
        <oa:BODId>3BA23E0C-B942-E7C1-C3CC-C7FE50A680</oa:BODId>
    </oa:ApplicationArea>
    <oa:DataArea xmlns:oa="http://www.openapplications.org/oagis">
        <oa:Add confirm="Always" />
        <oa:RequestForQuote>
            <aaia:Header>
                <oa:Parties>
                    <oa:BillToParty>
                        <oa:PartyId>
                            <oa:Id>6595</oa:Id>
                        </oa:PartyId>
                    </oa:BillToParty>
                    <oa:ShipFromParty>
                        <oa:PartyId>
                            <oa:Id>8</oa:Id>
                        </oa:PartyId>
                    </oa:ShipFromParty>
                    <oa:ShipFromParty>
                        <oa:PartyId>
                            <oa:Id>7</oa:Id>
                        </oa:PartyId>
                    </oa:ShipFromParty>
                </oa:Parties>
            </aaia:Header>
            <aaia:Line>
                <oa:LineNumber>1</oa:LineNumber>
                <aaia:OrderItem>
                    <aaia:ItemIds>
                        <aaia:SupplierItemId>
                            <oa:Id>13 427</oa:Id>
                        </aaia:SupplierItemId>
                        <aaia:SupplierCode>IMC</aaia:SupplierCode>
                    </aaia:ItemIds>
                </aaia:OrderItem>
                <oa:OrderQuantity uom="EACH">1</oa:OrderQuantity>
            </aaia:Line>
        </oa:RequestForQuote>
    </oa:DataArea>
</aaia:AddRequestForQuote>

Open in new window

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
abel

Hey, that's weird, that's an old copy popping up in the original source. Don't use that (!), it is of a different post, also by my hand. Use this. The comments I posted remain the same:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="node() | @*">
        <xsl:copy>
            <xsl:apply-templates select="node() | @*" />
        </xsl:copy>
    </xsl:template>
 
    <xsl:template match="*">
        <xsl:variable name="prefix">
            <xsl:if test="namespace-uri() = 'http://www.openapplications.org/oagis'">
                <xsl:text>oa</xsl:text>
            </xsl:if>
            <xsl:if test="namespace-uri() = 'http://www.aftermarket.org/oagis'">
                <xsl:text>aaia</xsl:text>
            </xsl:if>
        </xsl:variable>
        <xsl:element name="{$prefix}:{local-name()}" namespace="{namespace-uri()}">
            <xsl:apply-templates select="node() | @*"/>
        </xsl:element>
    </xsl:template>
 
</xsl:stylesheet>

Open in new window

vvsrk76

ASKER
Thank you. I will test it on my env.

Thank you
abel

(make sure you use that last xslt post of mine, that earlier xslt-post has little to do with your problem)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
vvsrk76

ASKER
I got this exception

 Exception while parsing BOD : com.imc.bod.model.BODParseException: nu.xom.xslt.XSLException: Ambiguous rule match for /oagis_1:AddRequestForQuote
Matches both "node()" on line 0 of
and "element()" on line 0 of

Exception Msg   :   nu.xom.xslt.XSLException: Ambiguous rule match for /oagis_1:AddRequestForQuote
Matches both "node()" on line 0 of
and "element()" on line 0 of

Below is my code:



 java.io.InputStream in = com.imc.bod.model.BODReader.class.getClassLoader().getResourceAsStream("com/imc/bod/model/IPO_xslt.xsl");
                Document result;
/* 120*/        try
                {
/* 120*/            System.err.println(xml.toString());
/* 122*/            Builder builder = nonValidatingBuilder;
/* 123*/            Document doc = builder.build(xml.toString(), null);
/* 125*/            Document stylesheet = builder.build(in);
/* 126*/            XSLTransform transform = new XSLTransform(stylesheet);
/* 127*/            Nodes output = transform.transform(doc);
/* 128*/            result = XSLTransform.toDocument(output);
                }

Open in new window

vvsrk76

ASKER
Please help me in this.

Thank you
vvsrk76

ASKER
My generated xml contains schema location

schemaLocation=" http://www.aftermarket.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/AAIA/BODs/AddRequestForQuote.xsd

<?xml version="1.0" encoding="UTF-8"?>  
<oagis_1:AddRequestForQuote xmlns:oagis="http://www.openapplications.org/oagis" xmlns:oagis_1="http://www.aftermarket.org/oagis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation=" http://www.aftermarket.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/AAIA/BODs/AddRequestForQuote.xsd http://www.openapplications.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/OAGIS/BODs/AddRequestForQuote.xsd" >  
  <oagis:ApplicationArea>  
    <oagis:Sender>  
      <oagis:LogicalId>NEXPART</oagis:LogicalId>  
      <oagis:ReferenceId>3BA23E0C-B942-E7C1-C3CC-C7FE50A68094</oagis:ReferenceId>  
      <oagis:Confirmation>0</oagis:Confirmation>  
    </oagis:Sender>  
    <oagis:CreationDateTime>2008-12-18T21:23:10Z</oagis:CreationDateTime>  
    <oagis:BODId>3BA23E0C-B942-E7C1-C3CC-C7FE50A694</oagis:BODId>  
  </oagis:ApplicationArea>  
  <oagis:DataArea>  
    <oagis:Add confirm="Always"/>  
    <oagis:RequestForQuote>  
      <oagis_1:Header>  
        <oagis:Parties>  
          <oagis:BillToParty>  
            <oagis:PartyId>  
              <oagis:Id>6595</oagis:Id>  
            </oagis:PartyId>  
          </oagis:BillToParty>  
          <oagis:ShipFromParty>  
            <oagis:PartyId>  
              <oagis:Id>8</oagis:Id>  
            </oagis:PartyId>  
          </oagis:ShipFromParty>  
          <oagis:ShipFromParty>  
            <oagis:PartyId>  
              <oagis:Id>7</oagis:Id>  
            </oagis:PartyId>  
          </oagis:ShipFromParty>  
        </oagis:Parties>  
      </oagis_1:Header>  
      <oagis_1:Line>  
        <oagis:LineNumber>1</oagis:LineNumber>  
        <oagis_1:OrderItem>  
          <oagis_1:ItemIds>  
            <oagis_1:SupplierItemId>  
              <oagis:Id>13 427</oagis:Id>  
            </oagis_1:SupplierItemId>  
            <oagis_1:SupplierCode>IMC</oagis_1:SupplierCode>  
          </oagis_1:ItemIds>  
        </oagis_1:OrderItem>  
        <oagis:OrderQuantity uom="EACH">1</oagis:OrderQuantity>  
      </oagis_1:Line>  
    </oagis:RequestForQuote>  
  </oagis:DataArea>  
</oagis_1:AddRequestForQuote>  

Open in new window

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
abel

Looks like a bug in the XSLT parser you use, at least if you did not change the XSLT. You used my last version? According to the XSLT specs there's no ambiguous rule match (node() has a lower priority than *).

But you can do something about that. Raise the priority of the element match:

<xsl:template match="*" priority="5">

If you now still get the error, I'd love to have a chat with the creator of that parser ;-)
abel

If I run it with the schemaLocation in place, I get the correct output. Here's the line with the schema location:

<aaia:AddRequestForQuote schemaLocation=" http://www.aftermarket.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/AAIA/BODs/AddRequestForQuote.xsd http://www.openapplications.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/OAGIS/BODs/AddRequestForQuote.xsd" xmlns:aaia="http://www.aftermarket.org/oagis">

Open in new window

vvsrk76

ASKER
is this correct xsl?
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="*" priority="5">
        <xsl:copy>
            <xsl:apply-templates select="node() | @*" />
        </xsl:copy>
    </xsl:template>
 
    <xsl:template match="*">
        <xsl:variable name="prefix">
            <xsl:if test="namespace-uri() = 'http://www.openapplications.org/oagis'">
                <xsl:text>oa</xsl:text>
            </xsl:if>
            <xsl:if test="namespace-uri() = 'http://www.aftermarket.org/oagis'">
                <xsl:text>aaia</xsl:text>
            </xsl:if>
        </xsl:variable>
        <xsl:element name="{$prefix}:{local-name()}" namespace="{namespace-uri()}">
            <xsl:apply-templates select="node() | @*"/>
        </xsl:element>
    </xsl:template> 
</xsl:stylesheet>

Open in new window

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
vvsrk76

ASKER
can you please send the modified xsl file?

Thank you.
abel

No, that's not correct, I meant the other line. Sorry. Here you go (any number above 2 would do):

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="node() | @*">
        <xsl:copy>
            <xsl:apply-templates select="node() | @*" />
        </xsl:copy>
    </xsl:template>
 
    <xsl:template match="*" priority="5">
        <xsl:variable name="prefix">
            <xsl:if test="namespace-uri() = 'http://www.openapplications.org/oagis'">
                <xsl:text>oa</xsl:text>
            </xsl:if>
            <xsl:if test="namespace-uri() = 'http://www.aftermarket.org/oagis'">
                <xsl:text>aaia</xsl:text>
            </xsl:if>
        </xsl:variable>
        <xsl:element name="{$prefix}:{local-name()}" namespace="{namespace-uri()}">
            <xsl:apply-templates select="node() | @*"/>
        </xsl:element>
    </xsl:template>
 
</xsl:stylesheet>

Open in new window

vvsrk76

ASKER
I am using xom 1.1 version
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
abel

Does the new file work well for you? Or does it still give errors on XOM?
abel

If you use XOM, then it is nothing more then an interface to an XSLT processor. It can be Saxon, xalan, Oracle: http://xom.nu/apidocs/nu/xom/xslt/XSLTransform.html
vvsrk76

ASKER
Yes I used the same XSL

But I am getting below result.
<?xml version="1.0" encoding="UTF-8"?> 
<oagis_1:AddRequestForQuote xmlns:oagis="http://www.openapplications.org/oagis" xmlns:oagis_1="http://www.aftermarket.org/oagis"> 
 <oa:ApplicationArea xmlns:oa="http://www.openapplications.org/oagis"> 
  <oa:Sender> 
   <oa:LogicalId>NEXPART</oa:LogicalId> 
   <oa:ReferenceId>3BA23E0C-B942-E7C1-C3CC-C7FE50A68095</oa:ReferenceId> 
   <oa:Confirmation>0</oa:Confirmation> 
  </oa:Sender> 
  <oa:CreationDateTime>2008-12-18T21:23:10Z</oa:CreationDateTime> 
  <oa:BODId>3BA23E0C-B942-E7C1-C3CC-C7FE50A695</oa:BODId> 
 </oa:ApplicationArea> 
 <oa:DataArea xmlns:oa="http://www.openapplications.org/oagis"> 
  <oa:Add confirm="Always"/> 
  <oa:RequestForQuote> 
   <aaia:Header xmlns:aaia="http://www.aftermarket.org/oagis"> 
    <oa:Parties> 
     <oa:BillToParty> 
      <oa:PartyId> 
       <oa:Id>6595</oa:Id> 
      </oa:PartyId> 
     </oa:BillToParty> 
     <oa:ShipFromParty> 
      <oa:PartyId> 
       <oa:Id>8</oa:Id> 
      </oa:PartyId> 
     </oa:ShipFromParty> 
     <oa:ShipFromParty> 
      <oa:PartyId> 
       <oa:Id>7</oa:Id> 
      </oa:PartyId> 
     </oa:ShipFromParty> 
    </oa:Parties> 
   </aaia:Header> 
   <aaia:Line xmlns:aaia="http://www.aftermarket.org/oagis"> 
    <oa:LineNumber>1</oa:LineNumber> 
    <aaia:OrderItem> 
     <aaia:ItemIds> 
      <aaia:SupplierItemId> 
       <oa:Id>13427</oa:Id> 
      </aaia:SupplierItemId> 
      <aaia:SupplierCode>IMC</aaia:SupplierCode> 
     </aaia:ItemIds> 
    </aaia:OrderItem> 
    <oa:OrderQuantity uom="EACH">1</oa:OrderQuantity> 
   </aaia:Line> 
  </oa:RequestForQuote> 
 </oa:DataArea> 
</oagis_1:AddRequestForQuote> 

Open in new window

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
vvsrk76

ASKER
Still I am not able change the prefix of these lines

<oagis_1:AddRequestForQuote xmlns:oagis="http://www.openapplications.org/oagis" xmlns:oagis_1="http://www.aftermarket.org/oagis">

</oagis_1:AddRequestForQuote>
abel

It does for me... I have no idea why the processor you use makes these mistakes. XSLT 1.0 is so straightforward... If you say "run through all elements" then that means "run through all elements". That then includes the root element.

Well, you may try the following, see if that helps. I'm in real need of your processor: I need that to look up some bug reports to help you better (see my earlier post on how to find out if it isn't your code).

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="node() | @*">
        <xsl:copy>
            <xsl:apply-templates select="node() | @*" />
        </xsl:copy>
    </xsl:template>
 
    <xsl:template match="/ | *" priority="5">
        <xsl:variable name="prefix">
            <xsl:if test="namespace-uri() = 'http://www.openapplications.org/oagis'">
                <xsl:text>oa</xsl:text>
            </xsl:if>
            <xsl:if test="namespace-uri() = 'http://www.aftermarket.org/oagis'">
                <xsl:text>aaia</xsl:text>
            </xsl:if>
        </xsl:variable>
        <xsl:element name="{$prefix}:{local-name()}" namespace="{namespace-uri()}">
            <xsl:apply-templates select="node() | @*"/>
        </xsl:element>
    </xsl:template>
 
</xsl:stylesheet>

Open in new window

vvsrk76

ASKER
Thank you I will try this one.

Thanks for your time
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
vvsrk76

ASKER
I am getting the result but namespace is added in other elemnt.

<oa:ApplicationArea xmlns:oa="http://www.openapplications.org/oagis">

xmlns:oa="http://www.openapplications.org/oagis" shoud be in this root element

<aaia:AddRequestForQuote xmlns:aaia="http://www.aftermarket.org/oagis" schemaLocation=" http://www.aftermarket.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/AAIA/BODs/AddRequestForQuote.xsd http://www.openapplications.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/OAGIS/BODs/AddRequestForQuote.xsd">

Below is my result


<?xml version="1.0"?>
<aaia:AddRequestForQuote xmlns:aaia="http://www.aftermarket.org/oagis" schemaLocation=" http://www.aftermarket.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/AAIA/BODs/AddRequestForQuote.xsd http://www.openapplications.org/oagis wsjar:file:/home/wasadmin/profiles/imc_managed/installedApps/imc/OMSTest.ear/IPORuntime.jar!/OAGIS/BODs/AddRequestForQuote.xsd">
  <oa:ApplicationArea xmlns:oa="http://www.openapplications.org/oagis">
    <oa:Sender>
      <oa:LogicalId>NEXPART</oa:LogicalId>
      <oa:ReferenceId>3BA23E0C-B942-E7C1-C3CC-C7FE50A68097</oa:ReferenceId>
      <oa:Confirmation>0</oa:Confirmation>
    </oa:Sender>
    <oa:CreationDateTime>2008-12-18T21:23:10Z</oa:CreationDateTime>
    <oa:BODId>3BA23E0C-B942-E7C1-C3CC-C7FE50A697</oa:BODId>
  </oa:ApplicationArea>
  <oa:DataArea xmlns:oa="http://www.openapplications.org/oagis">
    <oa:Add confirm="Always" />
    <oa:RequestForQuote>
      <aaia:Header>
        <oa:Parties>
          <oa:BillToParty>
            <oa:PartyId>
              <oa:Id>6595</oa:Id>
            </oa:PartyId>
          </oa:BillToParty>
          <oa:ShipFromParty>
            <oa:PartyId>
              <oa:Id>8</oa:Id>
            </oa:PartyId>
          </oa:ShipFromParty>
          <oa:ShipFromParty>
            <oa:PartyId>
              <oa:Id>7</oa:Id>
            </oa:PartyId>
          </oa:ShipFromParty>
        </oa:Parties>
      </aaia:Header>
      <aaia:Line>
        <oa:LineNumber>1</oa:LineNumber>
        <aaia:OrderItem>
          <aaia:ItemIds>
            <aaia:SupplierItemId>
              <oa:Id>13 427</oa:Id>
            </aaia:SupplierItemId>
            <aaia:SupplierCode>IMC</aaia:SupplierCode>
          </aaia:ItemIds>
        </aaia:OrderItem>
        <oa:OrderQuantity uom="EACH">1</oa:OrderQuantity>
      </aaia:Line>
    </oa:RequestForQuote>
  </oa:DataArea>
</aaia:AddRequestForQuote>

Open in new window

abel

> I am getting the result but namespace is added in other elemnt.

That is a common misunderstanding when it comes to XML. Technically it doesn't matter. The XML Namespace specification and the XSLT specification specifically state that it the namespace should be in place, but not necessarily on the root element. As it is, it would be equally legal to put the namespace uris on every node.

XML is meant for automatic processing. No XML processor should moan about that. So the place of the namespace is purely cosmetic.

Nevertheless, I'll have a look at it to see if I can do something about it regardless.
ASKER CERTIFIED SOLUTION
abel

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
vvsrk76

ASKER

XSL is working fine.
Thank you for your time.
I am not good in XSLT. I implemented one java class also.
Let me test both for performance on my test env.

Thanks for your valuable time.


⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
abel

You're welcome, glad it's working out so far :)