Skip to Content
author's profile photo Former Member
Former Member

XSLT help needed namespaces

Hello all

I am trying to get rid of namespaces in the XML document. The document XI is producing looks liek this

http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="N/A">0018000562

2008-10-02http:// 2008-10-02" target="_blank">rep.oio.dk/ubl/xml/schemas/0p71/common/">2008-10-02>

PIEhttp:// PIE" target="_blank">rep.oio.dk/ubl/xml/schemas/0p71/common/">PIE>

USDhttp:// USD" target="_blank">rep.oio.dk/ubl/xml/schemas/0p71/maindoc/">USD>

http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="EAN">5790001330217 http://rep.oio.dk/ubl/xml/schemas/0p71/common/">

http://rep.oio.dk/ubl/xml/schemas/0p71/common/">

http://rep.oio.dk/ubl/xml/schemas/0p71/common/">

http://rep.oio.dk/ubl/xml/schemas/0p71/common/">

http://rep.oio.dk/ubl/xml/schemas/0p71/common/">

http://rep.oio.dk/ubl/xml/schemas/0p71/common/">

http://rep.oio.dk/ubl/xml/schemas/0p71/common/">

And I would like the document to look like this

<com:ID schemeID="N/A">0018000562</com:ID>

<com:IssueDate>2008-10-02</com:IssueDate>

<com:TypeCode>PIE</com:TypeCode>

<main:InvoiceCurrencyCode>USD</main:InvoiceCurrencyCode>

<com:BuyersReferenceID schemeID="EAN">5790001330217</com:BuyersReferenceID>

<com:ReferencedOrder>

<com:BuyerParty>

<com:DestinationParty>

<com:SellerParty>

<com:TaxTotal>

<com:LegalTotals>

<com:InvoiceLine>

Simply put , XI is including a namespcae for every node http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="N/A">0018000562

But i would liek just the node <com:ID schemeID="N/A">0018000562</com:ID>

How can we achieve this , XSLT code plz , or could we do this with mapping , adaopter modules etc ..

Thanks a lot

Sudheer

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2008 at 01:03 PM

    go to

    www.w3schools.com

    and search....

    otherwise if u r using any adapter and specifying documentnamespce...just leave that as blank....

    Regards

    Rams

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Use

      For

      <com:ID xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="N/A">0018000562</com:ID>
      
      into 
      
      <com:ID schemeID="N/A">0018000562</com:ID>

      XSL can do like

      <com:ID schemeID="N/A"><xsl:value-of select="//com:ID"/></com:ID>

      This will not bring the name space.

      in case of hierarchy use

      <com:ID schemeID="N/A"><xsl:value-of select="//level1/level2/com:ID"/></com:ID>

      where level1 , level 2 are nesting of source XML

      Thanks

      Gaurav

      Edited by: Gaurav Bhargava on Oct 25, 2008 6:49 AM

  • Posted on Oct 23, 2008 at 11:16 AM

    another option wud be this approach - http://www.tei-c.org/wiki/index.php/Remove-Namespaces.xsl

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 23, 2008 at 11:11 AM

    Open the message type of ur source structure. There make the option "XML Namespace" as blank and try again.

    Regards,

    Prateek

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 27, 2008 at 03:19 PM

    Hello Guys , I have another strange problem here ,

    If I am manually constructing the file with XSLT , then how can I handle dynamic elements in the file , Fr example say there were 3 InvoiceLine nodes instead of 2 , how can i handle this situation.

    Cheers

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Igor Kozak

      Igor , Your solution works no doubt , just wondered if there was an easier way , maybe functions like replace prefix or something in XSLT to achive this , I am not an XSLT expert , Thanks a lot Igor , I will start the time consuming XSLT construction then ,

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 03:49 PM

    Thank you

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.