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

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

    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.

  • XSLT problem -- urgent

    Hi,
    We are porting our application from WLS5.1 to WLS6.0SP2. We
    use Apache's Xerces parser for XSLT processing. After starting the server while
    loading a page, I get the following error:
    javax.xml.transform.TransformerException
    at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1242)
    at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2942)
    at java.lang.Thread.run(Thread.java:484)
    java.lang.ArrayIndexOutOfBoundsException
    at org.apache.xalan.serialize.SerializerToXML.accum(SerializerToXML.java:1321)
    at org.apache.xalan.serialize.SerializerToXML.outputLineSep(SerializerToXML.java:195)
    at org.apache.xalan.serialize.SerializerToXML.indent(SerializerToXML.java:2241)
    at org.apache.xalan.serialize.SerializerToHTML.startElement(SerializerToHTML.java:559)
    at org.apache.xalan.transformer.QueuedStartElement.flush(QueuedStartElement.java:357)
    at org.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHandler.java:770)
    at org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:279)
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:749)
    at org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.java:498)
    at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:193)
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2202)
    at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2085)
    at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1219)
    at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2942)
    at java.lang.Thread.run(Thread.java:484)
    Has anyone come across this problem and got the solution ?
    Regards,
    Ramkumar

    This is correct you can use different 3rd party parsers like crimson or xml4j , by
    configuring the xml registry .However using different versions of apache xerces and xalan
    other than those shipped can cause compatibility problems and is not supported.
    Look at the faq url for details.
    http//e-docs.bea.com/wls/docs61/faq/xml.html#740643
    It might be possible however to hack this and get it to work.
    yeshwant
    Simon Spruzen wrote :
    If at all possible, you should limit your versions of Xalan and Xerces to those
    shipped with WLS (in weblogic.jar and xmlx.jar). So your imports look something
    like:
    import org.w3c.dom.*;
    import weblogic.apache.*; // not org.apache.*
    It seems that different versions of Xalan and Xerces ship with different versions
    of the org.w3c.dom classes that can be incompatible. You also must also use compatible
    versions of Xalan and Xerces together, else all sorts of oddness starts.
    (I wish Jakarta would merge the Xalan and Xerces packages into one super-package
    and gave it a single name)
    If you use the stuff shipped with WLS6.0 and nothing else, everything works fine.
    You don't have to use the registry and JAXP if you don't want to, however it's
    a nice clean API, providing you agree on what versions of Xalan and Xerces you're
    on. I found using JAXP with mixed versions of Xalan/Xerces just made things more
    confusing!
    WLS6.1 upgrades Xalan and Xerces and drops xmlx.jar. Here's part of a reply from
    a support case I've raised in a related area that clears things up:
    [Helen - BEA Support - writes:]
    "Here is some information that I hope will clarify things a little more :-
    The packaging was intended to make sure that customers could use newer versions
    of xerces and xalan without causing problems for the built in parser.The org.apache
    classes are packaged in xmlx.jar whereas the weblogic.apache classes are packaged
    in weblogic.jar.
    Originally, we planned to rev the xmlx.jar version of Xerces more often than
    the built-in version in WLS. But it turned out that there were compatibility
    problems involving the Level 2 DOM classes (org.w3c.dom package), so in
    practice people couldn't easily plug in a different version of Xerces than
    the one included in weblogic.jar. This problem generally only affects
    customers desiring to plug in a different version of Xerces;
    Because of the compatibility issue, which is not easily solvable, we have
    decided not to support plugging in a different version of Xerces than the one
    shipped. Therefore, we have decided to axe xmlx.jar.
    Note that for 6.1 it is not possible to use a different version of xerces and
    xalan than what is shipped as per
    http//e-docs.bea.com/wls/docs61/faq/xml.html#740643"
    "Ram Kumar" <[email protected]> wrote:
    Hi Kenneth,
    Yes, it is already in my classpath before weblogic.jar.
    Do I need to use the XML Registry and JAXP API for this to work compulsorily
    Regards,
    Ramkumar
    "Kenneth Chenis" <[email protected]> wrote:
    Try putting your xerces.jar file in the classpath before the weblogic.jar
    .... that resolved some (not all) of the problems we had with the internal
    xerces/parser classes in the weblogic.jar file.
    hope this helps,
    Kenneth Chenis
    ComponenTree Inc.
    Data Code Inc.
    [email protected]
    978-521-5970
    "Ram Kumar" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    We are porting our application from WLS5.1 to WLS6.0SP2. We
    use Apache's Xerces parser for XSLT processing. After starting theserver
    while
    loading a page, I get the following error:
    javax.xml.transform.TransformerException
    atorg.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
    ava:1242)
    atorg.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2942)
    at java.lang.Thread.run(Thread.java:484)
    java.lang.ArrayIndexOutOfBoundsException
    atorg.apache.xalan.serialize.SerializerToXML.accum(SerializerToXML.java:1321)
    atorg.apache.xalan.serialize.SerializerToXML.outputLineSep(SerializerToXML.jav
    a:195)
    atorg.apache.xalan.serialize.SerializerToXML.indent(SerializerToXML.java:2241)
    atorg.apache.xalan.serialize.SerializerToHTML.startElement(SerializerToHTML.ja
    va:559)
    atorg.apache.xalan.transformer.QueuedStartElement.flush(QueuedStartElement.jav
    a:357)
    atorg.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHandle
    r.java:770)
    atorg.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.
    java:279)
    atorg.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:
    749)
    atorg.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.ja
    va:498)
    atorg.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.jav
    a:193)
    atorg.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
    erImpl.java:2202)
    atorg.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transformer
    Impl.java:2085)
    atorg.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
    ava:1219)
    atorg.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2942)
    at java.lang.Thread.run(Thread.java:484)
    Has anyone come across this problem and got the solution ?
    Regards,
    Ramkumar

  • 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 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());

  • Removal of namespace in xslt - Urgent pls

    All,
    version: 11.1.1.3.
    My incoming xml doc comes like this (sample one) into BPEL with namespace ns1
    +*<?xml version="1.0" encoding="UTF-8" ?>*+
    +*<ns1:OrderRequestHeader>*+
    +*<ns1:ShipTo>*+
    +*<ns1:Name xml:lang="en-US">P1- Atlanta</ns1:Name>*+
    +*</ns1:ShipTo>*+
    +*</ns1:OrderRequestHeader>*+
    To remove such namespace I used the template as below
    <?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" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="*">
    <!-- remove element prefix (if any) -->
    <xsl:element name="{local-name()}">
    <!-- process attributes -->
    <xsl:for-each select="@*">
    <!-- remove attribute prefix (if any) -->
    <xsl:attribute name="{local-name()}">
    <xsl:value-of select="."/>
    </xsl:attribute>
    </xsl:for-each>
    <xsl:apply-templates/>
    </xsl:element>
    </xsl:template>
    </xsl:stylesheet>
    This template(googled it) remove all the namespace from element and also the attribute (*<ns1:Name xml:lang="en-US">P1- Atlanta</ns1:Name>*) i.e xml got removed from xml:lang. But I dont want to remove the namespace from attributes. Hence I removed the section below the commented line <!-- remove attribute prefix (if any) -->. This time the output just showed only the element without the attribute like this
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns1:OrderRequestHeader>
    <ns1:ShipTo>P1- Atlanta</ns1:Name>
    </ns1:ShipTo>
    </ns1:OrderRequestHeader>
    But I want the output to be with attribute with xml namespace. How do I achieve that? I tried many combination in the template, but couldnt get thru. Any help is highly appreciated.
    Thanks,
    Sen

    All,
    Am I not cleared with my queries? Its very urgent for me, ur help is much appreciated.
    Thanks,
    sen

  • Removal of namespace in xslt - Urgent Plz

    All,
    version: soa 11.1.1.3
    To remove the namespace from the xml doc, I used ora:processXSLT function (ora:processXSLT('TrX_RemoveNamespace.xsl',bpws:getVariableData('JCAAdapterInVar','cXML'))) and maintain TrX_RemoveNamespace.xsl in the project dir. The bpel worked fine until 11.1.1.1, when I migrated the same BPEL to 11.1.1.3, it failed with the following error
    *[2010-12-09T16:18:19.075+05:30] [soa_server1] [ERROR] [] [oracle.soa.bpel.engine.xml] [tid: orabpel.invoke.pool-4.thread-13] [userId: <anonymous>] [ecid: 0000InAjguSCgol_ott1iY1D0A080000sI,0:14:0x5f5e123:27:0x5f5e124:51:100000039] [APP: soa-infra] [composite_name: OutReceiptRequestCustomMap] [component_name: OutReceiptRequestCustomMap] [component_instance_id: 40036] [dcid: d34be9ea7b8698ce:d8e3ede:12cca72d20f:-7ffd-00000000000001de] BPEL1AssignWMP[[*
    ORABPEL-09500
    XPath expression failed to execute.
    An error occurs while processing the XPath expression; the expression is ora:processXSLT('TrX_RemoveNamespace.xsl',bpws:getVariableData('JCAAdapterInVar','cXML')).
    The XPath expression failed to execute; the reason was: XML-22900: (Fatal Error) An internal error condition occurred..
    Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
    TrXRemoveNamespace.xsl_+
    *<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl" xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue">*
    *<xsl:template match="*">*
    *<xsl:element name="{local-name()}">*
    *<xsl:apply-templates select="@* | node()"/>*
    *</xsl:element>*
    *</xsl:template>*
    *<xsl:template match="@* | text()">*
    *<xsl:copy/>*
    *</xsl:template>*
    *</xsl:stylesheet>*
    Please help me what might be gone wrong.
    Thanks,
    Sen

    All,
    Am I not cleared with my queries? Its very urgent for me, ur help is much appreciated.
    Thanks,
    sen

  • 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>

Maybe you are looking for

  • Itunes 7.0.3 error message

    I just downloaded Itunes 7.0.3 and when I went to open it it said a newer vesion of Quick Time 7.1.3 or later is recquired for ITunes 7.0.3. I went to the quicktime player and it said that I had quicktime 7.1.6. I've redownloaded Itunes and tried to

  • Windoze Ad-hoc networks killing Airport Extreme Base Station

    After having a horrible experience with an Orinoco base station sometime ago at his coffee shop, a client of mine asked me to install a new Wi-Fi access point to replace it. Since I'd never had a problem with my graphite Airport Base Station, I selec

  • Sharing 1 monitor, keyboard and mouse

    I have a brand new macbook (bought March 1, 2007). I additionally own a Dell tower running Windows XP. Is it possible to have the macbook and Dell PC share 1 monitor, keyboard and mouse via a KVM switch? How do I do it? What cables do I need? MacBook

  • Problem that is driving me mad

    So this weekend a problem begins. I cannot "unlock" the phone by sliding the bar at the bottom, but it will unlock if I slide the bar and press the bottom button. Please forgive me if I don't know the names of the buttons, but it's the round one unde

  • Internal Monitor problem

    Ok all, I installed a new hard drive, did the 35X wipe, and installed the basic version of OS 10.4. Airport can't find my wireless network. I started moving files from my external drive to the internal but didn't finish. Now, when I start up I have n