XSLT namespaces

Hi I am trying to get rid of the extra namespaces on each node . My input file look slike this
<com:ID xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="N/A">0018000562</com:ID>
     <com:IssueDate xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">2008-10-02</com:IssueDate>
     <com:TypeCode xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">PIE</com:TypeCode>
     <main:InvoiceCurrencyCode xmlns:main="http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/">USD</main:InvoiceCurrencyCode>
     <com:BuyersReferenceID xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="EAN">5790001330217</com:BuyersReferenceID>
I want to get rid of the xmlns:com="http....." namespace , but want to keep the prefix com on the node levels.  I also don't want to completely gey rid of all the namespaces and prefixes.
Could any one give me the XSLT transformation code to achive this please.
Thanks a lot

Hi Abhishek
Yes the code i Provided is my input file, I just gave a small snippet of my file , here is the whole file
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="C:\Documents and Settings\Kumar.Kamepalli\Desktop\ARLA EDI\RemovePrefix.xsl"?>
<Invoice xmlns:main="http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/" xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/" xmlns="http://rep.oio.dk/ubl/xml/schemas/0p71/pie/">
     <com:ID xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="N/A">0018000562</com:ID>
     <com:IssueDate xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">2008-10-02</com:IssueDate>
     <com:TypeCode xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">PIE</com:TypeCode>
     <main:InvoiceCurrencyCode xmlns:main="http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/">USD</main:InvoiceCurrencyCode>
     <com:BuyersReferenceID xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/" schemeID="EAN">5790001330217</com:BuyersReferenceID>
     <com:ReferencedOrder xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">
          <com:BuyersOrderID>sdfsdfsd</com:BuyersOrderID>
          <com:SellersOrderID>SalesOrder number</com:SellersOrderID>
          <com:IssueDate>2008-09-30</com:IssueDate>
     </com:ReferencedOrder>
     <com:BuyerParty xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">
          <com:ID schemeID="EAN">5790001330217</com:ID>
          <com:PartyName>
               <com:Name>Fred the sold to party</com:Name>
          </com:PartyName>
          <com:BuyerContact>
               <com:ID>contact person from ARLA</com:ID>
               <com:Name>contact person from ARLA</com:Name>
          </com:BuyerContact>
     </com:BuyerParty>
     <com:DestinationParty xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">
          <com:ID schemeID="EAN">5790001330217</com:ID>
          <com:PartyName>
               <com:Name>Fred the sold to party</com:Name>
          </com:PartyName>
          <com:Contact>
               <com:ID>ARLA contact person</com:ID>
               <com:Name>ARLA contact person</com:Name>
          </com:Contact>
          <com:Address>
               <com:ID>Levering</com:ID>
               <com:Street>14 Easy street</com:Street>
               <com:CityName>north Andover</com:CityName>
               <com:PostalZone>0184500</com:PostalZone>
               <com:Country>
                    <com:Code>NL</com:Code>
               </com:Country>
          </com:Address>
     </com:DestinationParty>
     <com:SellerParty xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">
          <com:ID schemeID="EAN">Vendor's EAN number not implemented</com:ID>
          <com:PartyName>
               <com:Name>APV SYSTEMS US COMMERCIAL</com:Name>
          </com:PartyName>
          <com:PartyTaxScheme>
               <com:CompanyTaxID schemeID="CVR">24730018</com:CompanyTaxID>
          </com:PartyTaxScheme>
     </com:SellerParty>
     <com:TaxTotal xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">
          <com:TaxTypeCode>VAT</com:TaxTypeCode>
          <com:TaxAmounts>
               <com:TaxableAmount currencyID="USD">101.53</com:TaxableAmount>
               <com:TaxAmount currencyID="DKK">60.00</com:TaxAmount>
          </com:TaxAmounts>
          <com:CategoryTotal>
               <com:RateCategoryCodeID>VAT</com:RateCategoryCodeID>
               <com:RatePercentNumeric>25</com:RatePercentNumeric>
               <com:TaxAmounts>
                    <com:TaxableAmount currencyID="USD">101.53</com:TaxableAmount>
                    <com:TaxAmount currencyID="DKK">60.00</com:TaxAmount>
               </com:TaxAmounts>
          </com:CategoryTotal>
     </com:TaxTotal>
     <com:LegalTotals xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">
          <com:LineExtensionTotalAmount currencyID="USD">101.53</com:LineExtensionTotalAmount>
          <com:ToBePaidTotalAmount currencyID="USD">101.53</com:ToBePaidTotalAmount>
     </com:LegalTotals>
     <com:InvoiceLine xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/">
          <com:ID>000010</com:ID>
          <com:InvoicedQuantity unitCode="ST">1.000</com:InvoicedQuantity>
          <com:LineExtensionAmount currencyID="DKK">1000.00</com:LineExtensionAmount>
          <com:Item>
               <com:ID schemeID="n/a">DS1234</com:ID>
               <com:Description>Test material for STO</com:Description>
               <com:BasePrice>
                    <com:PriceAmount currencyID="DKK">1000.00</com:PriceAmount>
               </com:BasePrice>
          </com:Item>
          <com:BasePrice>
               <com:PriceAmount currencyID="DKK">1000.00</com:PriceAmount>
               <com:BaseQuantity unitCode="ST" unitCodeListAgencyID="n/a">1.000</com:BaseQuantity>
          </com:BasePrice>
     </com:InvoiceLine>
</Invoice>
From this file I wanna get rid of namespace from the nodes , and i wanna keep the prefix .
Ex: my oputpu node should look liek this
<com:ID schemeID="N/A">0018000562</com:ID>
Hope its clear now . I tried with different codes of XSLT , but couldn't achieve the desired result.

Similar Messages

  • XSLT namespace issue (ns0 & ns1 tags to be removed without affectng Nmespc)

    Hi Friends ,
    I need some help in XSLT programming.
    My requirement is something like this:
    <b>Input XML:</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:GovTalkMessage xmlns:ns0="http://www.govtalk.gov.uk/CM/envelope">
         <ns0:EnvelopeVersion>2.0</ns0:EnvelopeVersion>
         <ns0:Header>
              <ns0:MessageDetails>
                   <ns0:Class>IR-PAYE-EOY</ns0:Class>
                   <ns0:Transformation>XML</ns0:Transformation>
                   <ns0:GatewayTest>1</ns0:GatewayTest>
              </ns0:MessageDetails>
         </ns0:Header>
         <ns0:Body>
              <ns1:IRenvelope xmlns:ns1="http://www.govtalk.gov.uk/taxation/EOY/06-07/1">
                   <ns1:IRheader>
                        <ns1:DefaultCurrency>GBP</ns1:DefaultCurrency>
                        <ns1:Sender>Company</ns1:Sender>
                   </ns1:IRheader>
               </ns1:IRenvelope>
         </ns0:Body>
    </ns0:GovTalkMessage>
    <b>I want the OUTPUT xml in the following format:</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
         <EnvelopeVersion>2.0</EnvelopeVersion>
         <Header>
              <MessageDetails>
                   <Class>IR-PAYE-EOY</Class>
                   <Qualifier>request</Qualifier>
                   <Function>submit</Function>
                   <CorrelationID/>
                   <Transformation>XML</Transformation>
                   <GatewayTest>1</GatewayTest>
              </MessageDetails>
         </Header>
         <Body>
              <IRenvelope xmlns="http://www.govtalk.gov.uk/taxation/EOY/06-07/1">
                   <IRheader>
                        <DefaultCurrency>GBP</DefaultCurrency>
                        <Sender>Company</Sender>
                   </IRheader>
               </IRenvelope>
         </Body>
    </GovTalkMessage>
    That is basically I need the ns0 and ns1 tags to be removed without affecting the Namespaces
    Looking forward for you reply.
    Best regards,
    Chandan
    Message was edited by:
            Chandan A C

    Try this stylesheet.....and let me know if this is OK
    <b><i>
    <?xml version='1.0' ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.govtalk.gov.uk/CM/envelope" xmlns:b="http://www.govtalk.gov.uk/taxation/EOY/06-07/1">
         <xsl:template match="/">
              <GovTalkMessage>
                   <EnvelopeVersion>
                        <xsl:value-of select="a:GovTalkMessage/a:EnvelopeVersion"/>
                   </EnvelopeVersion>
                   <Header>
                        <MessageDetails>
                             <Class>
                                  <xsl:value-of select="a:GovTalkMessage/a:Header/a:MessageDetails/a:Class"/>
                             </Class>
                             <Transformation>
                                  <xsl:value-of select="a:GovTalkMessage/a:Header/a:MessageDetails/a:Transformation"/>
                             </Transformation>
                             <GatewayTest>
                                  <xsl:value-of select="a:GovTalkMessage/a:Header/a:MessageDetails/a:GatewayTest"/>
                             </GatewayTest>
                        </MessageDetails>
                   </Header>
                   <Body>
                        <IRenvelope>
                             <IRheader>
                                  <DefaultCurrency>
                                       <xsl:value-of select="a:GovTalkMessage/a:Body/b:IRenvelope/b:IRheader/b:DefaultCurrency"/>
                                  </DefaultCurrency>
                                  <Sender>
                                       <xsl:value-of select="a:GovTalkMessage/a:Body/b:IRenvelope/b:IRheader/b:Sender"/>
                                  </Sender>
                             </IRheader>
                        </IRenvelope>
                   </Body>
              </GovTalkMessage>
         </xsl:template>
    </xsl:stylesheet></i></b>

  • XSLT, namespaces and DOM

    Hello,
    I am trying to do the following:
    - build a DOM/XML-tree from information in tables using my own namespace
    - Transform this tree to HTML using a XSL-stylesheet in a file.
    A simple example I created works when I first save the XML-tree in a file and parse the tree in this file. But that is extra overhead.
    Any element from a namespace is not transformed.
    Here is my java-class:
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import oracle.xml.parser.v2.*;
    import org.w3c.dom.*;
    public class MyXSLTClass extends Object
    public static void main(String[] args)
    Element rootElement, subElement;
    Element element;
    try
    XMLDocument html = new XMLDocument();
    XMLDocument document = new XMLDocument();
    document.setVersion("1.0");
    document.setStandalone("yes");
    rootElement = document.createElement("rootelement");
    rootElement.setAttribute("xmlns:myns", "http://www.cumquat.nl/myns");
    rootElement.setAttribute("attribute", "root");
    document.appendChild(rootElement);
    NodeFactory nodeFactory = new NodeFactory();
    subElement = nodeFactory.createElement("myns:subelement");
    subElement.setAttribute("attribute", "sub1");
    rootElement.appendChild(subElement);
    subElement = nodeFactory.createElement("myns:subelement");
    subElement.setAttribute("attribute", "sub2");
    rootElement.appendChild(subElement);
    subElement = nodeFactory.createElement("myns:subelement");
    subElement.setAttribute("attribute", "sub3");
    rootElement.appendChild(subElement);
    document.print(new FileOutputStream("c:\\temp\\my.xml"));
    DOMParser parser = new DOMParser();
    parser.setValidationMode(false);
    parser.parse(new FileInputStream("c:\\temp\\my.xml"));
    document = parser.getDocument();
    XSLStylesheet xsl = new XSLStylesheet(
    new FileInputStream("c:\\temp\\my.xsl")
    , null);
    XSLProcessor proc = new XSLProcessor();
    proc.showWarnings(true);
    proc.setErrorStream(System.err);
    // create an output document to hold the result
    html.appendChild(proc.processXSL(xsl,document));
    File file = new File("c:\\temp", "my.html");
    FileOutputStream stream = new FileOutputStream(file);
    html.print(stream);
    catch (Exception e)
    System.out.println(e);
    An this is my xsl-file
    <?xml version="1.0" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myns="http://www.cumquat.nl/myns">
    <xsl:output method="html" />
    <xsl:template match="/">
    <html>
    <body>
    <xsl:apply-templates select="rootelement" />
    </body>
    </html>
    </xsl:template>
    <xsl:template match="rootelement">
    <h1>
    <xsl:value-of select="@attribute" />
    </h1>
    <xsl:apply-templates select="myns:subelement" />
    </xsl:template>
    <xsl:template match="myns:subelement">
    <h3>
    <xsl:value-of select="@attribute" />
    </h3>
    </xsl:template>
    </xsl:stylesheet>
    I am using the Java parser v2.0.2.7
    In this example you will not see the three sub elements in the HTML. When you enable the lines for saving and parsing the xml, you will get the three sub elements in the HTML-document.
    What is causing this ??
    Thanks
    null

    Next release is planed to be out next week. We will annouced here when they are ready for download.

  • XSLT Namespaces URGENT

    Hello everyone:
    Can anyone give a brief description of the precautions to take when creating xsl's that handle xml documents with namespaces.
    Do translets handle namespaces? There is a code sample for my problem a couple of topics below.
    Thanks in advance
    Prashanth

    For people interested in the future, take a look at:
    http://forums.java.sun.com/thread.jsp?forum=34&thread=165308

  • XSLT Mapping and Namespace Issues

    I have been reading through similar threads on this topic, but have not found the right combination for my problem.  I am doing an XSLT map and it works fine in Stylus Studio.  When I take it to PI, I get a "Prefix 'ns0' is not mapped to a namespace" error.  I have a namespace that is within the XSD files I received from my partner (http://www.ups.com/XMLSchema/EBR/Billing/v1).  I also have the namespace I made in PI for the source (http://graybar.com/upsbilling/) and a different namespace in PI for the destination (http://graybar.com/cold/invoice/).
    <u><b>XSLT:</b></u>
    <?xml version='1.0' encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.ups.com/XMLSchema/EBR/Billing/v1" xmlns:ns1="http://graybar.com/cold/invoice/">
    <xsl:template match="/">
    <ns1:ColdInvoiceData>
      <Header>
      <RecordID>HDR</RecordID>
      <InvoiceDate>
      <xsl:value-of select="ns0:UPS_EBR_BILL/ns0:InvoiceDetails/ns0:Invoice/ns0:InvoiceDateCCYYMMDD"/>
      </InvoiceDate>
    <u><b>Source XML</b></u>
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <UPS_EBR_BILL xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ups.com/XMLSchema/EBR/Billing/v1" xsi:schemaLocation="http://www.ups.com/XMLSchema/EBR/Billing/v1 Billing_XML_Schema.xsd">
    <XMLBillFileVersion>1.0.1</XMLBillFileVersion>
    <Recipient>
    When I change the XSLT namespace from http://www.ups.com/XMLSchema/EBR/Billing/v1 to http://graybar.com/upsbilling/, the TransfromerException in PI goes away, but none of my referenced mappings work either (just my text hardcodes).
    Can someone tell me why this works in Stylus Studio, but not in PI?  Do I have too many namespaces?
    Message was edited by:
            Keith Wendel (to uncomment xsl:stylesheet line)

    > <ns1:ColdInvoiceData xmlns:ns1="http://graybar.com/cold/invoice/">
    This change did not affect anything.  Still works in Stylus Studio though.
    Did you mean to show any changes at the <xsl:value-of select> line?  I did not notice anything there.
    Can anyone explain what "not mapped to a namespace" means?  I have the declaration of ns0 at the top, so I don't see what else needs to be mapped.  Do I have to have my PI namespace where I store the partner's XSDs set as "http://www.ups.com/XMLSchema..." (partner's namespace)?

  • XSLT Mapping : RFC Lookup using java helper class

    Hi All,
    I am doing RFC Lookup in xslt mapping using java helper class. I have found blog for the same (http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14) However this blog is very advanced.
    Can anybody help me with step by step approach for the same?
    My basic questions are not answered in the blog as:
    1) where to add the jar file of the java class used in xslt mapping.
    I have added zip file of XSLT mapping in imported archived and using that in mapping.
    Thanks in advace.
    Regards,
    Rohan

    Hi,
    Can u please have look at this in detail , u can easily point out yourself the problem...
    http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm
    Please observe the line,
    xmlns:javamap="java:com.company.group.MappingClass
    in XSLT mapping..
    The packagename of class and class name and XSLT namespace should be matching...
    Babu
    Edited by: hlbabu123 on Sep 29, 2010 6:04 PM

  • Error running XSLSample.java

    Hi,
    I tried to run the XSLSample.java distributed with
    xmlparser_v2_0_0_1 and I got the following error:
    (lpo) sample- cat empl.xml
    <?xml version="1.0"?>
    <!DOCTYPE employee [
    <!ELEMENT employee (Name, Dept, Title)>
    <!ELEMENT Name (#PCDATA)>
    <!ELEMENT Dept (#PCDATA)>
    <!ELEMENT Title (#PCDATA)>
    ]>
    <employee>
    <Name>John Goodman</Name>
    <Dept>Manufacturing</Dept>
    <Title>Supervisor</Title>
    </employee>
    (lpo) sample- cat iden.xsl
    <?xml version="1.0"?>
    <!-- Identity transformation -->
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    <xsl:template match="*|@*|comment()|pi()|text()">
    <xsl:copy>
    <xsl:apply-templates
    select="*|@*|comment()|pi()|text()"/>
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>
    (lpo) sample- java XSLSample empl.xml iden.xsl
    oracle.xml.parser.v2.XSLException: XSL Stylesheet does not belong
    to XSLT namespace
    at
    oracle.xml.parser.v2.XSLStylesheet.error(XSLStylesheet.java:928)
    at
    oracle.xml.parser.v2.XSLStylesheet.updateStylesheet(XSLStylesheet
    .java:227)
    at
    oracle.xml.parser.v2.XSLStylesheet.initStylesheet(XSLStylesheet.j
    ava:189)
    at
    oracle.xml.parser.v2.XSLStylesheet.<init>(XSLStylesheet.java:75)
    at XSLSample.main(XSLSample.java:55)
    I wonder if I'm running it the right way.
    Thanks.
    Lap
    null

    Hi Lap Po,
    Your sequence of command is wrong try it this way :-
    java XSLSample iden.xsl empl.xml
    -R.S.Kamal.
    Lap Po (guest) wrote:
    : Hi,
    : I tried to run the XSLSample.java distributed with
    : xmlparser_v2_0_0_1 and I got the following error:
    : (lpo) sample- cat empl.xml
    : <?xml version="1.0"?>
    : <!DOCTYPE employee [
    : <!ELEMENT employee (Name, Dept, Title)>
    : <!ELEMENT Name (#PCDATA)>
    : <!ELEMENT Dept (#PCDATA)>
    : <!ELEMENT Title (#PCDATA)>
    : ]>
    : <employee>
    : <Name>John Goodman</Name>
    : <Dept>Manufacturing</Dept>
    : <Title>Supervisor</Title>
    : </employee>
    : (lpo) sample- cat iden.xsl
    : <?xml version="1.0"?>
    : <!-- Identity transformation -->
    : <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    : <xsl:template match="*|@*|comment()|pi()|text()">
    : <xsl:copy>
    : <xsl:apply-templates
    : select="*|@*|comment()|pi()|text()"/>
    : </xsl:copy>
    : </xsl:template>
    : </xsl:stylesheet>
    : (lpo) sample- java XSLSample empl.xml iden.xsl
    : oracle.xml.parser.v2.XSLException: XSL Stylesheet does not
    belong
    : to XSLT namespace
    : at
    oracle.xml.parser.v2.XSLStylesheet.error(XSLStylesheet.java:928)
    : at
    oracle.xml.parser.v2.XSLStylesheet.updateStylesheet(XSLStylesheet
    : .java:227)
    : at
    oracle.xml.parser.v2.XSLStylesheet.initStylesheet(XSLStylesheet.j
    : ava:189)
    : at
    oracle.xml.parser.v2.XSLStylesheet.<init>(XSLStylesheet.java:75)
    : at XSLSample.main(XSLSample.java:55)
    : I wonder if I'm running it the right way.
    : Thanks.
    : Lap
    null

  • Pdf Printing - Sorry another question

    Hi all
    I am just getting to grips with apex 3 and looking at some of the new features. I am particularly interested in pdf printing and trying to get a grip on the art of the possible without using BI publisher.
    I have read most of the forum posts on the subject and Carl Backstrom’s great blog:
    http://carlback.blogspot.com/
    I have been through his example without any problem
    http://apex.oracle.com/pls/otn/f?p=11933:139
    Next I have been trying to see what can be done with some of the 3ed Party tools suggested; Atova XML Spy and Atova StyleVision.
    I did the following:
    1.     Export XML from apex report
    2.     Open in XML spy
    3.     Generate DTD schema
    4.     Create a new SPS in StyleVision based on XML and DTD
    5.     Generate xslt-fo
    6.     Load xslt in print region in apex and voila…. Error
    I have put the generated xslt onto apex.oracle.com with an example
    http://apex.oracle.com/pls/otn/f?p=579:13
    Am I barking up the wrong tree? Or should this be possible. It renders ok with the Apache FOP that comes with StyleVision.
    Perhaps there is a problem with the xslt?
    Any suggestions would be greatly appreciated.
    Thanks
    Simon

    Hello,
    After a brief look it looks like it is a namespace issues. See here are my namespaces
    &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:htmldb_r="http://htmldb.oracle.com/report" xmlns:svg="http://www.w3.org/2000/svg">and here's the one you have
    &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:altova="http://www.altova.com">See if there is an export that exports with only xslt namespace and I would at least start with XSLT version 1.0
    Regards,
    Carl

  • Spliting xml document- or sending portion of xml document

    Hi,
    I have large xml document and has to share between multiple components. But each component requires only portion of xml .How to pass only portion of node value as xml documentto different component.?
    say I have the following xml file.
    <AccountManager name="AccountManager" type="java" namespace="com.AccountManager">
         <Transformer name="RequestTransformer" type="java" namespace="com.RequestTransformer">
              <Resource name="RequestDTD" type="dtd" namespace="RequestDTD.dtd"/>
              <Resource name="RequestXSLT" type="xslt" namespace="RequestXSLT.xslt"/>
         </Transformer>
    </AccountManager>
    I want to send Transfomer node to different component. (This should include Resource Name i.e., all child nodes).

    Convert the node that is to be sent to a String with either the Transformer API or DOM 3 Load and Save API and send the string.

  • Transformer(XML, Xsl)

    Hello
    There is my class. When I run it I get error: stylesheet requires attribute version ; missimg or incorect XSLT Namespaces
    What to do?
    I have in database XML and Xsl file and i nead this function to join them.
    import java.io.*;
    import java.lang.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.parsers.DocumentBuilder;
    public class Parser{
         public static void main(String[] args)     {
                   Parser f = new Parser();
                   f.join();
         public void join(){
              try{
                   File stylesheet = new File("d:/jelenak/install/vezba/cdcatalog.xsl");
                   File xmlfile = new File("d:/jelenak/install/vezba/cdcatalog.xml");
                   File outputFile=new File("d:/jelenak/install/vezba/cdcatalog.xml");
                   TransformerFactory tFactory =TransformerFactory.newInstance();
                   StreamSource stylesource = new StreamSource(stylesheet);
                   StreamSource source = new StreamSource(xmlfile);
                   StreamResult result = new StreamResult(outputFile);
                   Transformer transformer = tFactory.newTransformer(stylesource);
                   transformer.transform(source, result);
              }catch (Exception e) {
                   e.printStackTrace(System.err);
    Thanks a lot

    aaaaaah! in a servlet, ok.
    you can build a StreamResult on the Servlet response output stream.
    personally, to provide the browser with the correct size of data to receive in the HTTP header, i output the XSLT result in a ByteArrayOutputStream (baos) then i use this kind of code in my servlet:
    response.setContentType("text/xml");
    response.setContentLength(baos.size());
    baos.writeTo(response.getOutputStream());

  • XSLT Mapping for Namespace Prefix replacement

    Hey All,
    I have below XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:OrderChange ns0:transactionPurposeIndicator="Change" xmlns:ns0="http://www.api.org/pidXML">
    <ns0:OrderChangeProperties>
    <ns0:OrderChangeNumber>1</ns0:OrderChangeNumber>
    <ns0:OrderChangeDate>2009-10-19</ns0:OrderChangeDate>
    </ns0:OrderChangeProperties>
    </ns0:OrderChange>
    And i need to convert it to below format:
    <?xml version="1.0" encoding="UTF-8"?>
    <pidx:OrderChange pidx:transactionPurposeIndicator="Change"   xmlns:pidx="http://www.api.org/pidXML" xmlns="http://www.api.org/pidXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.api.org/pidXML Z:\integration\trunk\schemas\pidx\OrderChange_1-2.xsd">
    <pidx:OrderChangeProperties>
    <pidx:OrderChangeNumber>1</pidx:OrderChangeNumber>
    <pidx:OrderChangeDate>2009-10-19</pidx:OrderChangeDate>
    </pidx:OrderChangeProperties>
    </pidx:OrderChange>
    Can someone please let me know the XSLT Mapping to achieve this. I have tried searching on the forum but haven't found much help.
    Appreciate your help.
    Thanks

    Hi Saif,
    The below blog and doc will be useful
    Useful XSLT mapping functions in SAP XI/PI
    Changing Namespaces and the encoding format of XML - Process Integration - SCN Wiki
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/000ee4d0-be91-2d10-8aaf-ff8045bdd37d?overridelayout=t…
    regards,
    Harish

  • XSLT Mapping: Namespace for prefix 'ns0' has not been declared

    Hello, I am working on a synchronous SOAP call and having some trouble with the response message. The web service has its own namespace and I am trying to convert this to my custom data type in PI. PI wants the message to be in format of having ns0 prefix and namespace like we have defined (http://foo for example).
    I have an XSLT mapping (see below) which works fine with my test response payload (pulled from SXMB_MONI source) on this online XSLT test site:
    http://www.freeformatter.com/xsl-transformer.html
    However when I import this archive to PI and test with operation mapping it always says "Namespace for prefix 'ns0' has not been declared."
    This is very confusing because when I test it online, I see both prefix and namespace declaration perfectly. Is there a way to see the results in the PI test tool? After this XSLT java error it doesn't give me the output even in Trace Level All mode.
    Please advise on this issue or if you know an easier way (such as altering my datatype/message type to match the inbound SOAP message). I tried working with the 3rd party WSDL but the response message types show a different root level node than what PI is receiving so I gave up to make my own matching datatype. I just have to solve this last inbound namespace issue and should be finished.
    FYI I have refreshed all PI caches and activated all objects.
    Thanks for your ideas!
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns0="http://foo"
      <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
      <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="/*">
        <xsl:element name="ns0:{local-name()}">
          <xsl:apply-templates select="@* | node()" />
        </xsl:element>
      </xsl:template>
      <xsl:template match="/">
        <xsl:element name="{local-name()}">
          <xsl:apply-templates select="@* | node()" />
        </xsl:element>
      </xsl:template>
    </xsl:stylesheet>

    Some additional info, here is an example payload which goes through the XSLT mapping perfectly, but in PI I get the error about missing ns0 declaration.
    XML input:
    <bar xmlns='http://irrelevantnamespace'
    xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
    xmlns:xsd='http://www.w3.org/2001/XMLSchema'
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    <foo/>
    </bar>
    XSLT mapped output using test tool and XSL above:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:bar xmlns:ns0="http://foo">
       <foo />
    </ns0:bar>

  • XSLT mapping to remove namespace prefix

    Hi experts,
    I have one requrement where I need to remove the prefix ns0 from the xml (given below) getting generated in message mapping.
    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns0:ExecuteRequest xmlns:ns0="http://test/">
    <ns0:_sRequestXML><inteflow>body</inteflow></ns0:_sRequestXML></ns0:ExecuteRequest></soap:Body></soap:Envelope>
    I am usimg the below xslt and it is now adding one ns0 prefix in the tag <inteflow>.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <ExecuteRequest xmlns="http://test/">
    <_sRequestXML>
    <inteflow>
    <xsl:copy-of select="//inteflow"/>
    </inteflow>
    </_sRequestXML>
    </ExecuteRequest>
    </xsl:template>
    </xsl:stylesheet>
    Result after using xslt.
    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ExecuteRequest xmlns="http://test/"><_sRequestXML>
    <inteflow xmlns:ns0="http://decisionintellect.com/inteport/"></inteflow></_sRequestXML></ExecuteRequest></soap:Body></soap:Envelope>
    Can you please help. What is wrong in the xslt and how I can get the desired result.
    Thanks & Regards,
    Pratyus Ganguly
    <?

    Hi Pratyus
    XMLAnonymizerBean works fine when I try it with your payload. Here is the config, basically I included the namespace for everything except the ns0.
    Parameter Name
    Parameter Value
    anonymizer.acceptNamespaces
    http://www.w3.org/2001/XMLSchema xsd http://www.w3.org/2001/XMLSchema-instance xsi http://schemas.xmlsoap.org/soap/envelope/ soap
    Before
    After
    Rgds
    Eng Swee

  • XSLT mapping: namespace

    Hi,
    I have a problem with my XSLT mapping... My scenario is <b>file to IDoc</b> (Orders05) and I use xsd schemes as external definitions.
    When I test my mapping in the Interface mapping I don't get any values in the target IDoc. I think it's a problem with the namespaces but I'm not sure though...
    Is this the correct way of filling up a field ?
    <DATUM><xsl:value-of select="Document/Order/OrderHeader/Dates/RequestedDeliveryDate"/></DATUM>
    Could anyone give me a <b>simple example</b> of xslt mapping, so I can match with my mapping ?
    Source interface: MI_Orders
    Target interface: ORDERS.ORDERS05
    Source msg: Document
    Target msg: ORDERS.ORDERS05
    XML Document source message:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Document xmlns:ns0="http://www.certione.com/RFOrder/Schema">
       <SenderID/>
       <ReceiverID/>
       <DocumentDate/>
       <DocumentNumber/>
       <TestIndicator/>
       <Version/>
       <Order/>
    </ns0:Document>
    Thx in advance!
    Wouter.
    Message was edited by: Wouter Dhaenens

    Hi,
    thx for your answers but I didn't make it to solve my problem yet...
    My external definition generates the source xml input data:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Document xmlns:ns0="http://www.certione.com/RFOrder/Schema">
       <SenderID/>
       <ReceiverID/>
       <DocumentDate/>
       <DocumentNumber/>
       <TestIndicator/>
       <Version/>
       <Order/>
    </ns0:Document>
    I want to generate a ORDERS05 IDoc... is it necessary to map the EDI_DC40 instance with all the fields as described in OSS note 728792 in my XSLT mapping?
    <?xml version="1.0" encoding="UTF-8"?>
    <ORDERS05 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:Documents and SettingsdevadmMy DocumentsAltova ProjectsUntitled1.xsd">
         <IDOC BEGIN="1">
              <EDI_DC40 SEGMENT="1">
    When I try to test I get the error "XML not well formed", the problem is that my example source document has the root node <Document> and the external definition generates a <ns0:Document> as root node...
    Begin of my XSLT mapping:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <!-- <xsl:decimal-format name="point" decimal-separator="."/> -->
         <!-- <xsl:output encoding="ISO-8859-1"/> -->
         <xsl:output encoding="UTF-8"/>
         <xsl:strip-space elements="*"/>
         <!-- Root -->
         <xsl:template match="/"/>
         <!-- <ORDERS05 xmlns:ns="http://certipost.be/xi/XI/Orders"> -->
         <!-- ================================================================= -->
         <!-- Segment Document -->
         <!-- ================================================================= -->
         <xsl:template match="Document">
              <xsl:element name="ORDERS05">
                   <xsl:element name="IDOC">
                        <xsl:apply-templates select="Order"/>
                   </xsl:element>
              </xsl:element>
         </xsl:template>
    Does anybody have a solution for this annoying problem ? :s
    Thx in advance,
    Wouter.

  • XSLT for adding Namespace is not being executed at runtime

    Hi Gurus,
    I am trying to add a Namespace to inbound xml and I wrote a simple XSLT mapping as below, when I execute this using XML spy or in Operation mapping manually it is working fine and giving me output as expected but at runtime it is not executing, I am getting same input xml as output xml and receiver agreement is failing...
    Appreciate your thoughts..
    <?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" encoding="UTF-8"/>
            <xsl:template match="*">
              <ns0:SalesXmlExtended xmlns:ns0="urn:/company.com/H/sndr">
              <xsl:copy-of select="//SalesReportInfo"/>
         </ns0:SalesXmlExtended>
         </xsl:template>
    </xsl:stylesheet>
    input xml is as below....
    <?xml version="1.0" encoding="UTF-8"?>
    <SalesXmlExtended>
         <SalesReportInfo>
              <SalesReport>
                   <Detail>
                        <deptNum>0270</deptNum> etc...
    output I am getting in XMLSpy and OM is as below, this is exactly what I need...
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:SalesXmlExtended xmlns:ns0="urn:/company.com/H/sndr">
         <SalesReportInfo>
              <SalesReport>
                   <Detail>
                        <deptNum>0270</deptNum>
    Thanks...
    Sukarna...

    Hi Baskar,
    Yeah, that is what my issue is , it shouldn't be failing but it is...
    I tried by manipulating the required namespace in the input file and it is working fine with out any errors....so I am guessing the XSLT is not being executed...
    I am getting below error which is valid because the transformation is not happening
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Technical Routing --> <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
    <SAP:Category>XIServer</SAP:Category>
    <SAP:Code area="OUTBINDING">CO_TXT_OUTBINDING_ERROR</SAP:Code>
    <SAP:P1>-BS_HOUSE_OF_FRASER_DEV</SAP:P1><SAP:P2>-BD1_100,urn:.com/HoF/POS/EOD/sndr.SI_Out_HoFSales_XML</SAP:P2>
    <SAP:P3/>
    <SAP:P4/>
    <SAP:AdditionalText>No standard agreement found for , BS_HOUSE_OF_FRASER_DEV, , BD1_100, urn:/HoF/POS/EOD/sndr, SI_Out_HoFSales_XML</SAP:AdditionalText
    ><SAP:Stack>Problem occurred in receiver agreement for sender -BS_HOUSE_OF_FRASER_DEV to receiver -

Maybe you are looking for

  • Can IPhone be set to a disc mode?

    Is there any way to just move some media off the iPhone (as if it were an external disc)? More frequently I am away from my desktop (my laptop isn't big enough to hold ALL my data) and my experience is if I sync it with the partial media on my laptop

  • Logic to capture deletion of   CS08 allocation unit.

    Hi gurus, I have a problem in Cs08 transaction. I need to delete the allocation unit dynamically . For that i need to Capture Auskz field. Can any one suggest me in capturing this field.

  • Compiler GD Library Error

    I followed exactly the excellent tutorial here: http://osx.topicdesk.com/content/view/135/41/ i ge following compile error.I have X11 installed, How can help me? /SourceCache/php-5.2.8/ext/gd][0]$ MACOSXDEPLOYMENTTARGET=10.5 CFLAGS="-arch ppc -arch p

  • Standard Cost and 'What if' cost

    Hi Standard Cost and 'What if' cost Please explain what is the difference between Standard Cost and 'What if' cost estimate. Does anybody has the idea about 'What If' cost estimate. Raju

  • When I connect via face time with my friend's ipad or iphone we can see each other and I can hear them but they can't hear me.  HELP!

    When I connect from my mac via facetime with my friend's iphone or ipad we can see each other and I can hear them but they can't hear me.  The mute is not applied, and the microphone seems to work with other applications.  Help!