ABAP XSLT Transformation using element include

Hi there,
I am trying to convert data from SAP-DATA -> DOM over XSLT to a Stream.
For achieving this I have to use certain modularized XSL-Files which will later be accessible over http. At the moment however, those files are on my local hard drive (client) only. I tried to access these files using:
<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:sap="http://www.sap.com/sapxsl"
>
*<xsl:include href="D:\XSL\include.xsl"/>*
<xsl:strip-space elements="*"/>
<xsl:template match="/">
</xsl:template>
</xsl:transform>
I get the message "D:\XSL\include.xsl doesn't exist" when checking the syntax. When I test this in my OS however, it works perfectly. Being an SAP- and XML-Newbie my question is the following: Does SAP not know my hard drive mappings while I'm in a transformation or can i only access directories over al11/http. Or is it complete nonsense at all? 
Regards, Lukas
Edited by: Lukas Weigelt on Jun 9, 2010 4:18 PM

Hi,
according to:
>
Michal_Krawczyk_PIXI wrote:
> as per:
> http://help.sap.com/saphelp_470/helpdata/EN/84/2e4d3ce624b800e10000000a114084/frameset.htm
> "The href attribute no longer applies in this case."
it appears the include element only works with the repository.... I tried
<xsl:include sap:name="<Name_of_the_Transformation_in_Repository>"/>
and it works.
However this would mean, all includes i have to make have to be imported to the repository. If that's really the case, it'll be a huge problem, because the xsl-files i want to include are outside of my reference
Regards, Lukas

Similar Messages

  • Execute a query using ABAP  (XSLT transformation issue)

    Hello,
    I made the steps from this blog (part I, II and III).
    /people/durairaj.athavanraja/blog/2005/12/05/execute-bw-query-using-abap-part-iii
    When trying to run the XSLT transformation, I got the message that : XML invalid source file.
    I am not sure what are the steps for running a transformation, or running it for this case ,maybe something it's not ok. I just run it, did not provide any information.
    Any suggestions ? Did anyone use the function module described in this blog ?
    Thank you very much in advance.

    try giving
    CALL TRANSFORMATION (`ID`)
    SOURCE meta = meta_data[]
    output = <ltable>[]
    RESULT XML xml_out
    OPTIONS xml_header = 'NO'.
    and check - sometimes the codepages configured in the BW system tend to cause an issue... I am not sure if the syntax is right though - but you are basically trying to bypass any encoding that is happening in the query transformation....
    http://www.sapetabap.com/ovidentia/index.php?tg=fileman&sAction=getFile&inl=1&id=4&gr=Y&path=ABAP%2FABAPENANGLAIS&file=ABAP-XML+Mapping.pdf&idf=41
    Edited by: Arun Varadarajan on May 18, 2009 11:28 PM

  • Xslt transformation using SAP BC 47

    Hi,
    I'm trying to do a transformation using the sap transformation package in the SAP BC ( rel 47 )
    I'm transforming an IDOC into a cXML order for example...
    The transformed xml contains some rather odd characters...
    Even a very simple xslt has these odd characters...
    directly after the DOCTYPE
    I'm using MapForce to create the xslt..
    Has anyone else experienced these issues?
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE cXML SYSTEM "....."[
      ]>
    <cXML payloadID="2005081645000002780916170000000000004039" timestamp="2005-08-16T09:16:17+0.00">
      <Header>
        <From>

    Hi,
    according to:
    >
    Michal_Krawczyk_PIXI wrote:
    > as per:
    > http://help.sap.com/saphelp_470/helpdata/EN/84/2e4d3ce624b800e10000000a114084/frameset.htm
    > "The href attribute no longer applies in this case."
    it appears the include element only works with the repository.... I tried
    <xsl:include sap:name="<Name_of_the_Transformation_in_Repository>"/>
    and it works.
    However this would mean, all includes i have to make have to be imported to the repository. If that's really the case, it'll be a huge problem, because the xsl-files i want to include are outside of my reference
    Regards, Lukas

  • Error in ABAP XSLT transformation

    Hi,
    Im trying to upload some data from XML to abap. But Im getting an error while transforming xml data to internal table.
    Here are the details.
    XML:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
      <!--  Edited by XMLSpy® -->
    <?xml-stylesheet type="text/xsl" href="ABAP1.xsl"?>
    <conceptRevDecisionXml>
    <projectInfo>
    <projectId>P000755</projectId>
    <stage>CON</stage>
    <country>Ethiopia</country>
    <region>AFRICA</region>
    <teamleader>Priya Agarwal</teamleader>
    <teamleaderfirstname>Priya</teamleaderfirstname>
    <teamleaderlastname>Agarwal</teamleaderlastname>
    <actionType>X</actionType>
    </projectInfo>
    </conceptRevDecisionXml>
    XSLT: Transformation
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sapxsl="http://www.sap.com/sapxsl"
    >
    <xsl:strip-space elements="*"></xsl:strip-space>
    <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <PROJID>
              <xsl:apply-templates select="//conceptRevDecisionXml"></xsl:apply-templates>
            </PROJID>
          </asx:values>
        </asx:abap>
    </xsl:template>
    <xsl:template match="conceptRevDecisionXml">
          <xsl:for-each select="projectInfo">
           <xsl:value-of select="projectId"></xsl:value-of>
           <xsl:value-of select="stage"></xsl:value-of>
           <xsl:value-of select="country "></xsl:value-of>
           <xsl:value-of select="region"></xsl:value-of>
           <xsl:value-of select="teamleader"></xsl:value-of>
           <xsl:value-of select="teamleaderfirstname"></xsl:value-of>
           <xsl:value-of select="teamleaderlastname"></xsl:value-of>
            <xsl:value-of select="actionType"></xsl:value-of>
            </xsl:for-each>
        </xsl:template>
    </xsl:transform>
    Once I run the program...Im getting an error saying...ABAP XML Formatting error in XML node..
    Im new to ABAP-XML parsing..Pls help me where Im going wrong..
    Thanks in advance.
    Regards,
    Priya

    Hi Priya,
    you can try with the below,
    1) Create a local ITAB with the structure of the XML,
    TYPES: BEGIN OF t_data,
            projectid           TYPE char30,
            stage               TYPE char30,
            country             TYPE char30,
            region              TYPE char30,
            teamleader          TYPE char30,
            teamleaderfirstname TYPE char30,
            teamleaderlastname  TYPE char30,
            actiontype          TYPE char30,
           END OF t_data.
    2) Create an XSLT prog in "STRANS" with the below code,
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:template match="/">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <L_DATA>
    <xsl:apply-templates select="//projectInfo"/>
    </L_DATA>
    </asx:values>
    </asx:abap>
    </xsl:template>
    <xsl:template match="projectInfo">
    <conceptRevDecisionXml>
    <PROJECTID>
    <xsl:value-of select="projectId"/>
    </PROJECTID>
    <STAGE>
    <xsl:value-of select="stage"/>
    </STAGE>
    <COUNTRY>
    <xsl:value-of select="country"/>
    </COUNTRY>
    <REGION>
    <xsl:value-of select="region"/>
    </REGION>
    <TEAMLEADER>
    <xsl:value-of select="teamleader"/>
    </TEAMLEADER>
    <TEAMLEADERFIRSTNAME>
    <xsl:value-of select="teamleaderfirstname"/>
    </TEAMLEADERFIRSTNAME>
    <TEAMLEADERLASTNAME>
    <xsl:value-of select="teamleaderlastname"/>
    </TEAMLEADERLASTNAME>
    <ACTIONTYPE>
    <xsl:value-of select="actionType"/>
    </ACTIONTYPE>
    </conceptRevDecisionXml>
    </xsl:template>
    </xsl:transform>
    3) Call the transformation as shown below,
    CALL TRANSFORMATION zxslt_project ---> "Name of the XSLT prog created above
    SOURCE XML l_xml_str                           ---> Source XML string
    RESULT l_data = l_data.                          ---> ITAB as in step 1 above
    Regards,
    Chen

  • ABAP XSLT transformation - XML to deep structure/nested standard table

    Hi all,
    I was struggling with this topic recently and couldn't find a single working example or description of a possible solution. So now that I've sorted it out, I did a quick example to elustrate how it works. Here is the code with XML embeded in it and the XSLT follows:
    <HR>
    <PRE>
    *& Report  Z_XML2ABAP
    *& Author: Jayanta Roy
    *& Date: 03/02/2010
    REPORT  z_xml2abap.
    DATA input_xml TYPE string.
    TYPES: BEGIN OF t_address,
            house_no TYPE string,
            street_name TYPE string,
            city_name TYPE string,
            phone_no TYPE string,
          END OF t_address.
    TYPES: t_addresses TYPE STANDARD TABLE OF t_address with NON-UNIQUE KEY house_no.
    TYPES: BEGIN OF t_person,
            firstname TYPE string,
            surname TYPE string,
            addresses TYPE t_addresses,
          END OF t_person.
    input_xml = '&lt;Friends&gt;' &&
      '&lt;People&gt;' &&
        '&lt;FirstName&gt;Homer&lt;/FirstName&gt;' &&
        '&lt;Surname&gt;Simpson&lt;/Surname&gt;' &&
          '&lt;Address&gt;' &&
            '&lt;HouseNo&gt;123&lt;/HouseNo&gt;' &&
            '&lt;Street&gt;Evergreen Terrace&lt;/Street&gt;' &&
            '&lt;City&gt;Springfield&lt;/City&gt;' &&
            '&lt;PhoneNo&gt;011212321&lt;/PhoneNo&gt;' &&
          '&lt;/Address&gt;' &&
          '&lt;Address&gt;' &&
            '&lt;HouseNo&gt;7G&lt;/HouseNo&gt;' &&
            '&lt;Street&gt;Neuclear Power Plant&lt;/Street&gt;' &&
            '&lt;City&gt;Spring Field&lt;/City&gt;' &&
            '&lt;PhoneNo&gt;911&lt;/PhoneNo&gt;' &&
          '&lt;/Address&gt;' &&
      '&lt;/People&gt;' &&
      '&lt;People&gt;' &&
         '&lt;FirstName&gt;Bart&lt;/FirstName&gt;' &&
         '&lt;Surname&gt;Simpson&lt;/Surname&gt;' &&
           '&lt;Address&gt;' &&
             '&lt;HouseNo&gt;123x&lt;/HouseNo&gt;' &&
             '&lt;Street&gt;Evergreen Terracex&lt;/Street&gt;' &&
             '&lt;City&gt;Springfieldx&lt;/City&gt;' &&
             '&lt;PhoneNo&gt;011212321x&lt;/PhoneNo&gt;' &&
           '&lt;/Address&gt;' &&
       '&lt;/People&gt;' &&
    '&lt;/Friends&gt;' .
    DATA lt_person TYPE STANDARD TABLE OF t_person.
    TRY.
        CALL TRANSFORMATION xslt_person
        SOURCE XML input_xml
        RESULT  all_people = lt_person.
      CATCH cx_root.
        WRITE 'Problemo!'.
    ENDTRY.
    WRITE 'Now, debug the program to see the values read from the XML'.
    </PRE>
    <HR>
    and here is the XSLT Transformation program (xslt_person):
    <HR>
    <PRE>
    &lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        xmlns:sap="http://www.sap.com/sapxsl" version="1.0"&gt;
      &lt;xsl:strip-space elements="*"/&gt;
      &lt;xsl:template match="/"&gt;
        &lt;asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"&gt;
          &lt;asx:values&gt;
            &lt;ALL_PEOPLE&gt;
              &lt;xsl:apply-templates select="//People"/&gt;
            &lt;/ALL_PEOPLE&gt;
          &lt;/asx:values&gt;
        &lt;/asx:abap&gt;
      &lt;/xsl:template&gt;
      &lt;xsl:template match="People"&gt;
        &lt;ALLMYFRIENDS&gt;  &lt;!This element name is not relevent... needed to just group the loop&gt;
          &lt;FIRSTNAME&gt;
            &lt;xsl:value-of select="FirstName"/&gt;
          &lt;/FIRSTNAME&gt;
          &lt;SURNAME&gt;
            &lt;xsl:value-of select="Surname"/&gt;
          &lt;/SURNAME&gt;
          &lt;ADDRESSES&gt;
            &lt;xsl:for-each select="Address"&gt;
              &lt;ADDRESS&gt; &lt;!This element name is not relevent... needed to just group the loop&gt;
                &lt;HOUSE_NO&gt;
                  &lt;xsl:value-of select="HouseNo"/&gt;
                &lt;/HOUSE_NO&gt;
                &lt;STREET_NAME&gt;
                  &lt;xsl:value-of select="Street"/&gt;
                &lt;/STREET_NAME&gt;
                &lt;CITY_NAME&gt;
                  &lt;xsl:value-of select="City"/&gt;
                &lt;/CITY_NAME&gt;
                &lt;PHONE_NO&gt;
                  &lt;xsl:value-of select="PhoneNo"/&gt;
                &lt;/PHONE_NO&gt;
              &lt;/ADDRESS&gt;
            &lt;/xsl:for-each&gt;
          &lt;/ADDRESSES&gt;
        &lt;/ALLMYFRIENDS&gt;
      &lt;/xsl:template&gt;
    &lt;/xsl:transform&gt;
    </PRE>
    <HR>
    HTH,
    Jayanta.

    thanks a LOT Jayanta..
    I was looking for an XSLT example for some time.. this one atleast got me started in the right direction..
    THANKS

  • Looking for example - abap xslt - that uses xslt document() function

    Hello,
    I'm looking for an example that shows the use of abap xslt with the xslt document() function.  Using the xslt document() function seems like a straightforward way to use xslt to create a result xml document by processing the content of two or more
    source documents.  For example, if source document A.xml and aux.xml are available in  memory as xstringand using stylesheet ztransformwhat would be the argument for the document() function to associate aux.xml.  Thanks for any insight.
    Regards,
    jb10809

    Hi,
    Sorry, perhaps I should have been clearer! The function that I picked just to test what you need to do just happened to return a string that contains SPAN tags with style attributes. The actual function code is:
    create or replace FUNCTION out_string_fn
       RETURN VARCHAR2
    IS
       CURSOR emp_cur
       IS
          SELECT ename
            FROM emp;
       v_string   VARCHAR2 (4000);
    BEGIN
       v_string := ' ';
       FOR c IN emp_cur
       LOOP
          v_string :=
                v_string
             || '&lt;SPAN style="font-weight:bold;color:green"&gt;'
             || c.ename
             || '&lt;/SPAN&gt;'
             || ', &lt;/br&gt;&lt;/br&gt;';
       END LOOP;
       RETURN v_string;
    END;And this returned a naff list in green (see [http://apex.oracle.com/pls/otn/f?p=55041:57] and click the Test button) - but it does show that you can style the validation error messages
    Andy

  • XSU XSLT and using xsl:include href=""

    I'm runing XDK 9.2 on an 8.1.7.4 database. I'm trying to transform the output of the XSU into a flat text file using a set of XSLT files. The main xslt includes the other xslt template files and then calls their templates by name as needed for different types of data in the XSU output.
    I have the main xslt in a table of BFILEs that I read from and pass to the DBMS_XMLQUERY.SETXSLT procedure as a CLOB. I get the following errors when I run the main procedure to generate the flat text file:
    oracle.xml.sql.OracleXMLSQLException: <Line 41, Column 35>: XSL-1002: (Error) Error while processing include XSL file (header.xslt).
    at oracle.xml.sql.query.OracleXMLQuery.setXSLT(OracleXMLQuery.java:818)
    at oracle.xml.sql.query.OracleXMLStaticQuery.setXSLT(OracleXMLStaticQuery.java:481)
    "header.xslt" is one of the included xslts. Is there some way to specify the other xslts? I have tried loading them into the BFILE table, but it still doesn't work.

    Hi I have tried out the code i.e. transforming a node and getting out a string representation. Following is code that works using JAXP apis.
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.dom.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import java.io.*;
    public class XMLString {
    public void xmlInString(Document document) throws Exception{
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer =
                   tf.newTransformer();
    StringWriter stWriter = new StringWriter();
    transformer.transform(new DOMSource(document), new StreamResult(stWriter));
    String strDOM = stWriter.toString();
    System.out.println("String dom");
    StringReader strIn = new StringReader(strDOM);
    BufferedReader buffIn = new BufferedReader(strIn);
    BufferedWriter bufOut = new BufferedWriter(new FileWriter("out.txt"));
    String out = null;
    while((out=buffIn.readLine()) != null){
    bufOut.write(out, 0, out.length());
    bufOut.flush();
    bufOut.close();
    public static void main(String args[]){
    try{
    XMLString strXML = new XMLString();
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource inputSource = new InputSource("input.xml");
    Document doc = db.parse(inputSource);
    strXML.xmlInString(doc);
    }catch(Exception e){
    System.out.println(e.getMessage());
    e.printStackTrace();
    I am using the xalan and xerces versions that come with the Java XML Winter pack from sun's website. The problem could lie with the underlying transformation processor you are using. It may not support transforming to a string or it could have a bug. So my advice is to find out what version transformation processor you are using. And look at the vendor's documentation to find any reference to this feature. Otherwise try using the Java XML Winter pack.

  • XSLT Transformation - using variables in title name

    Hi,
    Is there a way to set the title attribute of a table tab in XSLT dynamically through xslt? I'm trying to display sections of code which have the title hardcoded and are present in the xml being rendered. I need the title of that section determined dynamically while parsing through the object nodes of the xml.
    Example:
    <table id="Table ID" title="/Object1/attribute1/name" columnCount="3" seqNo="1">
    instead of hardcoding the title name in the XSLT can we pull the name and set it from the xml being processed?
    Thanks,
    Pavan

    <section id="CALCULATION" title="Calculation">
                   <table id="CALCULATION" title="ClientName Calculation Information" columnCount="3" seqNo="1">
                        <xsl:for-each select="//returnableObjects/IntermediateResultsJB/IntermediateResultJB">
                             <xsl:if test="resultSetName[.='Client Name Calculation Information']">
                                  <xsl:variable name="Variable1" select="resultName"/>
                                  <xsl:variable name="Variable2" select="resultValue"/>
                                  <!--<xsl:variable name="Variable3" select="resultOrder"/>-->
                                  <detailRow>
                                       <!-- <cell type="string">
                                            <xsl:value-of select="$Variable3"/>
                                       </cell> -->
                                       <cell type="string">
                                            <xsl:value-of select="$Variable1"/>
                                       </cell>
                                       <cell type="number">
                                            <xsl:value-of select="$Variable2"/>
                                       </cell>
                                  </detailRow>
                             </xsl:if>
                        </xsl:for-each>
                   </table>
    </section>This is the XSLT above being used. "ClientName Calculation Information" is hardcoded in the xml that is being rendered.
    XML Fragment is given below:
    <IntermediateResultJB>
                      <resultSetName>ResultSetName1</resultSetName>     
         <resultName>Name</resultName>
         <resultValue>Value</resultValue>
         <resultOrder>1</resultOrder>
    </IntermediateResultJB>
    <IntermediateResultJB>
         <resultSetName>ResultSetName2</resultSetName>
         <resultName>Name</resultName>
         <resultValue>Value</resultValue>
         <resultOrder>2</resultOrder>
    </IntermediateResultJB>
    <IntermediateResultJB>
         <resultSetName>ResultSetName3</resultSetName>
         <resultName>Name</resultName>
         <resultValue>Value</resultValue>
         <resultOrder>3</resultOrder>
    </IntermediateResultJB>I want the XSLT above to use the <resultSetName> value["ClientName Calculation Information" e.g] to be set in the value of the title attribute of the <table> as well as <section>.
    Thanks,
    Pavan
    Edited by: EJP on 23/05/2012 10:08: code tags.

  • Problem getting xslt transform to work

    I have the following ABAP Xslt  transformation
    <xsl:transform
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:sap="http://www.sap.com/sapxsl" version="1.0"
    >
    <xsl:strip-space elements="*"/>
         <xsl:template match="/">
              <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
                   <asx:values>
                        <ALLIR_REIKNINGAR>
                             <xsl:apply-templates select="//Invoice"/>   
                        </ALLIR_REIKNINGAR>
                   </asx:values>
              </asx:abap>
         </xsl:template>
        <xsl:template match="Invoice">
        <REIKNINGUR>
            <REIKN_NUMER>
                <xsl:value-of select="cbc:ID"/>           
            </REIKN_NUMER>
            <REIKN_AFRIT>
                <xsl:value-of select="cbc:CopyIndicator"/>
            </REIKN_AFRIT>
            <REIKN_UTGAFUDAGS>
                <xsl:value-of select="cbc:IssueDate"/>
            </REIKN_UTGAFUDAGS>
            <REIKN_MYNT>
                <xsl:value-of select="cbc:DocumentCurrencyCode"/>
            </REIKN_MYNT>
            <REIKN_TIMABIL_FRA>
                <xsl:value-of select="cac:InvoicePeriod/cbc:StartDate"/>
            </REIKN_TIMABIL_FRA>
            <REIKN_TIMABIL_TIL>
                <xsl:value-of select="cac:InvoicePeriod/cbc:EndDate"/>
            </REIKN_TIMABIL_TIL>
        </REIKNINGUR>
        </xsl:template>
    </xsl:transform>
    And the following XML input file
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="vodafone_xslt_namespace.xslt"?>
    <Invoice
    xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
    xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
    xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
    xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
    xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
    xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ccts="urn:un:unece:uncefact:documentation:2"
    xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0"
    xmlns:clm5639="urn:un:unece:uncefact:codelist:specification:5639:1988"
    xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001"
    xmlns:clm66411="urn:un:unece:uncefact:codelist:specification:66411:2001"
    xmlns:clmIANAMIMEMediaType="urn:un:unece:uncefact:codelist:specification:IANAMIMEMediaType:2003"
    >
         <cbc:UBLVersionID>2.0</cbc:UBLVersionID>
         <cbc:CustomizationID>NES</cbc:CustomizationID>
         <cbc:ProfileID schemeID="Profile"
         schemeAgencyID="NES">urn:www.nesubl.eu:profiles:profile4:ver1.1</cbc:ProfileID>
         <cbc:ID>PB1554421</cbc:ID>
         <cbc:CopyIndicator>false</cbc:CopyIndicator>
         <cbc:IssueDate>2011-12-31</cbc:IssueDate>
         <cbc:InvoiceTypeCode listID="UN/ECE 1001 Restricted" listAgencyID="NES">380</cbc:InvoiceTypeCode>
         <cbc:Note languageID="IS">Company name</cbc:Note>
         <cbc:DocumentCurrencyCode listID="ISO 4217 Alpha">ISK</cbc:DocumentCurrencyCode>
         <cbc:AccountingCost>2001523</cbc:AccountingCost>
         <cac:InvoicePeriod>
              <cbc:StartDate>2011-12-01</cbc:StartDate>
              <cbc:EndDate>2011-12-31</cbc:EndDate>
         </cac:InvoicePeriod>
    </Invoice>
    My problem is that this transformation does not work unless I completly strip out the namespace parts i.e. cbc:
    How can I get the parser to read the tags with namespace part. And if the parser can not handle namespace in XML how can I go about reding the data into sap ?

    I think you are trying convert the xml to an internal table because of // in apply-templates, then you need to change last XSLT program and include <item> tag inside the <xsl:template match="inv:Invoice">  template, see updated XSLT bellow.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:inv="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
    xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
    xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
    xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
    xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
    xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ccts="urn:un:unece:uncefact:documentation:2"
    xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0"
    xmlns:clm5639="urn:un:unece:uncefact:codelist:specification:5639:1988"
    xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001"
    xmlns:clm66411="urn:un:unece:uncefact:codelist:specification:66411:2001"
    xmlns:clmIANAMIMEMediaType="urn:un:unece:uncefact:codelist:specification:IANAMIMEMediaType:2003"
    xmlns:sapxsl="http://www.sap.com/sapxsl"
    version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <ALLIR_REIKNINGAR>
              <xsl:apply-templates select="//inv:Invoice"/>
            </ALLIR_REIKNINGAR>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="inv:Invoice">
        <item>
        <REIKNINGUR>
          <REIKN_NUMER>
            <xsl:value-of select="cbc:ID"/>
          </REIKN_NUMER>
          <REIKN_AFRIT>
            <xsl:value-of select="cbc:CopyIndicator"/>
          </REIKN_AFRIT>
          <REIKN_UTGAFUDAGS>
            <xsl:value-of select="cbc:IssueDate"/>
          </REIKN_UTGAFUDAGS>
          <REIKN_MYNT>
            <xsl:value-of select="cbc:DocumentCurrencyCode"/>
          </REIKN_MYNT>
          <REIKN_TIMABIL_FRA>
            <xsl:value-of select="cac:InvoicePeriod/cbc:StartDate"/>
          </REIKN_TIMABIL_FRA>
          <REIKN_TIMABIL_TIL>
            <xsl:value-of select="cac:InvoicePeriod/cbc:EndDate"/>
          </REIKN_TIMABIL_TIL>
        </REIKNINGUR>
       </item>
      </xsl:template>
    </xsl:transform>
    According to the XSLT program you need dclare an itab like this:
    DATA: BEGIN OF ls_reikningur,
          reikn_numer(10) TYPE c,
          END OF ls_reikningur.
    DATA: BEGIN OF ls_invoice,
          reikningur LIKE ls_reikningur,
          END OF ls_invoice.
    DATA: lt_invoice LIKE TABLE OF ls_invoice.
    And finally you need a call transformation in your abap code like this:
    DATA: root_error TYPE REF TO cx_root.
    DATA: lv_mess TYPE string.
    TRY.
        CALL TRANSFORMATION  zinvoice
           SOURCE XML lv_xml
           RESULT allir_reikningar = lt_invoice.
      CATCH cx_root INTO root_error.
        lv_mess = root_error->if_message~get_text( ).
        WRITE lv_mess.
    ENDTRY.

  • Any way to limit memory which XSLT processor uses?

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE     11.2.0.3.0     Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - ProductionWe use the xmltype.transform method to transform XSLT. We got oodles of memory (25Gb assigned to Oracle) but we do use a lot of that......
    Is there a way to limit the amount of memory that the XSLT engine uses so as to avoid out of memory errors?
    Errors in file /ora/oracle/diag/rdbms/prod01/PROD01/trace/PROD01_j001_16149.trc:
    ORA-27102: out of memory
    Linux-x86_64 Error: 12: Cannot allocate memoryThe XML file was just under 20Gb in size. I regularly see 10Gb xslt transformations using around 2Gb ram (via the top command on linux). I have no visibility to what the memory consumption was the time of the failure.

    Probably most of the heavy consumption is PGA related.
    http://docs.oracle.com/cd/B28359_01/server.111/b28274/memory.htm#i49320
    Have a look at the AWR history views concerning memory consumption. ADDM, ASH, AWR etc should give you more insight. See also the awr/addm/ash/-rpt.sql scripts in $ORACLE_HOME/rdbms/admin on the database server. You (officially) would need Diagnostic en Tuning pack licenses though, so be warned (even for "touching" those views). Probably the heavy consumption of memory is or (wrong) storage related or inefficient code...

  • XSLT transformation in XML to ABAP: special characters issue

    Hi,
    I am parsing well-formed XML file that has the following data (:
    <projects><project><name>Wallis &amp; Futuna</name></project></projects>
    I use XSLT transformation:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:template match="projects">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
            <PROJECTS>
              <xsl:for-each select="project">
                <PROJECT>
                  <NAME>
                    <xsl:value-of select="name"/>
                  </NAME>
                </PROJECT>
              </xsl:for-each>
            </PROJECTS>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    If I use the above example without &amp;amp; everything works fine, but the original XML fails with exception CX_XSLT_DESERIALIZATION_ERROR and message "Error during deserialization". Googling around did not give an answer.
    Any words of wisdom?
    Edited by: Alexei Isaev on Apr 26, 2011 5:04 AM
    Edited by: Alexei Isaev on Apr 26, 2011 5:05 AM

    Hi,
    Please visit the following link for reference.
    http://help.sap.com/abapdocu_70/en/ABAPCALL_TRANSFORMATION.htm
    Thanks & Regards,
    Harish

  • ABAP Program that generates XML and calls an XSLT transformation,

    Hello,
    I am creating a program that creates some XML output, and I am using STRANS to create a transformation.
    The file created looks like below before transformation.
      <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
    - <EMPLOYEE_DATA>
    - <item>
         <EMPLOYEE_ID>00000010</EMPLOYEE_ID>
        <FIRSTNAME>Joe</FIRSTNAME>
        <SURNAME>Bloggs</SURNAME>
        <DOB>1940-11-10</DOB>
        <SALARY>200000.0</SALARY>
      </item>
    <item>
      <EMPLOYEE_ID>00000055</EMPLOYEE_ID>
      <FIRSTNAME>Lydia</FIRSTNAME>
      <SURNAME>Jones</SURNAME>
      <DOB>1965-03-09</DOB>
      <SALARY>90000.0</SALARY>
      </item>
      </EMPLOYEE_DATA>
      </asx:values>
      </asx:abap>
    I want to make EMPLOYEE_ID  an attribute like in the following
    and what I want to output is:
      <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml">
    - <asx:values>
    - <EMPLOYEE_DATA>
    - <EMPLOYEE_DETAILS EMPLOYEE_ID="00000010">
       <FIRSTNAME>Joe</FIRSTNAME>
       <SURNAME>Bloggs</SURNAME>
       <DOB>1940-11-10</DOB>
       <SALARY>200000.0</SALARY>
      </EMPLOYEE_DETAILS>
    <EMPLOYEE_DETAILS EMPLOYEE_ID="00000055">
        <FIRSTNAME>Lydia</FIRSTNAME>
        <SURNAME>Jones</SURNAME>
        <DOB>1965-03-09</DOB>
        <SALARY>90000.0</SALARY>
        </EMPLOYEE_DETAILS>
        </EMPLOYEE_DATA>
      </asx:values>
      </asx:abap>
    the XSLT I have cureently produces:
      <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml">
    - <asx:values>
    - <EMPLOYEE_DATA>
    - <EMPLOYEE_DETAILS EMPLOYEE_ID="00000010">
      <EMPLOYEE_ID>00000010</EMPLOYEE_ID>
      <FIRSTNAME>Joe</FIRSTNAME>
      <SURNAME>Bloggs</SURNAME>
      <DOB>1940-11-10</DOB>
      <SALARY>200000.0</SALARY>
      </EMPLOYEE_DETAILS>
    - <EMPLOYEE_DETAILS EMPLOYEE_ID="00000038">
      <EMPLOYEE_ID>00000038</EMPLOYEE_ID>
      <FIRSTNAME>Fred</FIRSTNAME>
      <SURNAME>Johnson</SURNAME>
      <DOB>1960-12-11</DOB>
      <SALARY>123450.0</SALARY>
      </EMPLOYEE_DETAILS>
    - <EMPLOYEE_DETAILS EMPLOYEE_ID="00000055">
      <EMPLOYEE_ID>00000055</EMPLOYEE_ID>
      <FIRSTNAME>Lydia</FIRSTNAME>
      <SURNAME>Jones</SURNAME>
      <DOB>1965-03-09</DOB>
      <SALARY>90000.0</SALARY>
      </EMPLOYEE_DETAILS>
      </EMPLOYEE_DATA>
      </asx:values>
      </asx:abap>
    But it is repeating the Employee_ID, I want it to start from Firstname, the XSLT I have is:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:strip-space elements="*"/>
      <xsl:template match="node()">
        <xsl:copy>
          <xsl:apply-templates select="node()"/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="item">
        <EMPLOYEE_DETAILS>
          <xsl:attribute name="EMPLOYEE_ID">
            <xsl:value-of select="EMPLOYEE_ID"/>
          </xsl:attribute>
          <xsl:apply-templates select="node()"/>
        </EMPLOYEE_DETAILS>
      </xsl:template>
    </xsl:transform>
    How do I get it to start from the next node?
    Thanks

    Hi
    I am also trying the similar kind of requirement.
    I am trying to convert XML file in to ABAP using transformations.
    Problem
    When I am trying to execute the Transformation (Selection is Transformation name, Source File Path) using STRANS it is giving the bellow message.
    XSLT Tester                                                                               
    Runtime Errors                                                                               
    Reason          : No valid XSLT program supplied 
    Could you please guide me how to test the Transformation using STRANS
    Thanks
    Nikhil.B

  • XSLT Transformation error:  Non-canonical structure of element name

    Good day experts,
    I have recently started using xslt, and came upon the following demo in the sdn.
    http://wiki.sdn.sap.com/wiki/display/ABAP/XMLXSLTwith+ABAP
    I have retrieved the example xml files from airplus.com, as per the instructions, and implemented the code.
    When I test the xslt transformation in se80, it transforms correctly.
    However, when I run the program, I get the following error.
    CX_XSLT_FORMAT_ERROR
    Transformation error:  Non-canonical structure of element name XML_OUTPUT   
    Is there an error in the example that I am not aware of?
    Thanks in advance,
    Johan Kriek

    Found the solution.
    You rename the tag <XML_OUTPUT> to anything else like <TEST>. And Hurray!!! it works.
    It looks like SAP is using this name internally somewhere so we are getting error when we are using same name.
    Anyways the problem is solved.
    Regards,
    Jai

  • XSLT transformation for XML to ABAP internal table

    Hi, can anyone please tell me how it should be the xslt tranformation to conver this xml
    <Embargos_ARBA_DOC>
         <ns:Embargos_ARBA_MT
              xmlns:ns="un:swissmedical:sap:proxy:embargos_arba:file">
              <Embargos_ARBA_MT>
                   <FECHA>20081101</FECHA>
                   <CUIT>50000002124</CUIT>
                   <MONTO>0000013794090</MONTO>
                   <RAZON_SOCIAL>RAUL ARMANDO CUNQUEIRO S.A.C.I.</RAZON_SOCIAL>
              </Embargos_ARBA_MT>
              <Embargos_ARBA_MT>
                   <FECHA>20081101</FECHA>
                   <CUIT>55000001456</CUIT>
                   <MONTO>0000001144410</MONTO>
                   <RAZON_SOCIAL>PARODI ESTEBAN ARMANDO</RAZON_SOCIAL>
              </Embargos_ARBA_MT>
         </ns:Embargos_ARBA_MT>
    </Embargos_ARBA_DOC>
    to this abap Table....
      DATA: BEGIN OF i_embargos_arba_doc occurs 0,
              fecha TYPE d,
              cuit TYPE char11,
              monto TYPE char13,
              razon_social(120),
            END OF i_embargos_arba_mt.
    so i can transform it with this sentence
          CALL TRANSFORMATION ('embargos_transformation')
            SOURCE XML source
            RESULT Embargos_ARBA_DOC = embargos.
    pls i need help because i am unable to create this xslt transformation...
    I will give the highest rewards points to the one who can help me.
    thanks!
    mariano

    Hi Mariano
    Why you need to use XSLT for transforming XML file into ABAP table
    Code is a part of some ABAP report. Looks like it is reading a file from file system and updating table after transformation
    If you have requirement like you need to read XML file and then insert the data into a SAP table
    You can use
    File to RFC
    File to Proxy scenario using SAP PI.
    Please provide more inputs on requirement to help
    Thanks
    Gaurav

  • Oracle XSLT Transformation not preserving space in text element

    If we have a BPEL process which is calling a XSLT transformation contains the code similar as below:
    for Populating an element with white space only
    <tns:TargetField>
    <xsl:text disable-output-escaping="yes"> </xsl:text> <!--Note the whitespace , also tried with disable-output-escaping =”no” -->
    </tns: TargetField>
    Our expected result / output would be:
    <tns:TargetField> </tns: TargetField> <!--Note the whitespace -->
    But, we get:
    <tns:TargetField/>
    Oracle XSLT is ignoring the white space even if we try with preserve space in XSD, or in XSLT this is not producing the expected output.
    This looks a BUG with Oracle XSLT Transformation .
    For a workaround solution we can use below XSLT snippet:
    *<tns:TargetField>*
    *<xsl:value-of select="string(' ')"/> <!--Note the whitespace -->*
    *</tns:TargetField>*
    This is returning Output:
    *<tns:TargetField> </tns:TargetField> <!--Note the whitespace -->*
    Any other work around do you find?
    Edited by: panks on Jul 29, 2011 12:37 PM

    The workaround only works with one white space, if one put more white spaces, it do not work.
    <tns:TargetField>
    <xsl:value-of select="string(' ')"/> <!--Note the whitespaces -->
    </tns:TargetField>
    This is returning Output:
    <tns:TargetField> </tns:TargetField> <!--Note the only one whitespace -->
    Edited by: user10697506 on Aug 10, 2011 3:27 PM

Maybe you are looking for

  • Problem with URLLoader in AS3

    Hello All, I have asked on this fourms before about how to load data from asp.net and I have some suggestions about using URLLoader to load my data with a nice tutorial on it I have used it but the problem now that when I change the data in asp.net p

  • That Syncing Feeling :(

    Please help, since installing IOS6 my Itunes(10.4.1) running on Leopard (10.5.6) won't sync anymore, it will recognise the device, but only for pictures. I have tried resetting my Ipad to factory settings, but with no luck! It recognises my ancient I

  • Two dimensions, one fact

    Hello guys, The last few hours I've been trying to solve the following issue: I've got a small dataset which contains three different tables, two dimension tables and one fact table. The first dimension table is a calendar table (for now I will call

  • MIGO not displaying GOITEM-SGTXT for new posting

    Hi All, MIGO not displaying GOITEM-SGTXT for new posting last year postings SGTXT  is visible, while checking in customer exits there is no no code. I want to make it visible GOITEM-SGTXT. Plz help. Thanks Saket

  • I have a hitachi hard drive from an old pc. I would like to transfer pics and music to my macbook air. What cord do I need to make this possible?

    I have a hitachi hard drive from an old pc. I would like to transfer pics and music to my new macbook air. What cord do I need to make this possible?