XSL Mapping Query

Dear Collegues,
i am  doing  Simple xsl transformation ,
source xml
<?xml version="1.0" encoding="UTF-8"?>
<!Sample XML file generated by XMLSpy v2006 sp2 U (http://www.altova.com)>
<ns0:Request xmlns:ns0="http://sap.com/xi/demo/httpxsd">
     <CARRID>LH</CARRID>
     <CONNID>0400</CONNID>
</ns0:Request>
XSL file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- <xsl:output method="xml" indent="yes"/>  -->
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
      <ns0:ZSYNCCONNECTIONDET xmlns:ns="urn:sap-com:document:sap:rfc:functions">
         <carrid>
             <xsl:value-of select="/ns0:Request/CARRID"/>
         </carrid>
         <connid>
              <xsl:value-of select="/ns0:Request/CONNID"/>
         </connid>
      </ns0:ZSYNCCONNECTIONDET>
</xsl:template>
</xsl:stylesheet>
when i execute the xsl progtram i am getting the output without the values ,
output:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:ZSYNCCONNECTIONDET xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
     <carrid></carrid>
     <connid></connid>
</ns0:ZSYNCCONNECTIONDET>
any suggestions?
Regards
shekar chandra

> Hi Henrique,
>
> It is not the "0" alone what he missed, the
> he namespace itself is wrong. But irrespective of
> that, as per my above message, if he ensures that the
> namespace of Input XML is used in the map, then it
> would work perfectly.
>
> Regards
> Vishnu
Vishnu,
You were right in the part that not only the 0 is missing, but the namespace is not wrong, since he needs it to define output message's namespace. The point is that he has forgot to define input namespace and has used the same prefix for input and output.
Chandra,
For correction, you should add that 0 to ns (so it's ns0) and add the namespace&prefix for the input message, and use this other prefix for refering to the input fields.
In order to don't get confused, you should use prefixes that say directly which message you are refering to. Your xslt could be like (modifications in bold):
XSL file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <b>xmlns:input="http://sap.com/xi/demo/httpxsd"</b>>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<<b>output</b>:ZSYNCCONNECTIONDET xmlns:<b>output</b>="urn:sap-com:document:sap:rfc:functions">
<carrid>
<xsl:value-of select="/<b>input</b>:Request/CARRID"/>
</carrid>
<connid>
<xsl:value-of select="/<b>input</b>:Request/CONNID"/>
</connid>
</<b>output</b>:ZSYNCCONNECTIONDET>
</xsl:template>
</xsl:stylesheet>
Regards,
Henrique.

Similar Messages

  • Call plsql function from esb-xsl mapping

    Hi
    I want to call a plsql function that takes an inparameter from an xsl mapping file.
    I tried to use the orcl:query-database function for this, but i couldn't get it to work when I wanted to dynamically pass the value of the inparameter to the function taken from the XML file used as input in the xsl transformation:
    If I hardcode the parameter value like this, it works fine:
    orcl:query-database('select emx_parameters.get_parameter_value('DEADLINE') result from dual',false(),false(),'jdbc/DB')
    But if i dynamically want to assign the inparameter, it doesn't work for me:
    orcl:query-database('select emx_parameters.get_parameter_value('/Header/ParameterName') result from dual',false(),false(),'jdbc/DB')
    Maybe it has something to do with the ' signs, but I tried a lot of combinations it nothing worked for me.
    Has anyone any ideas how to do this?
    Thanks
    Kalle

    Hi
    If anyone is interested i managed to solve it this way:
    I build up the sql query string with xsl variables like this:
    <xsl:variable name="start">select emx_parameters.get_parameter_value('</xsl:variable>
    <xsl:variable name="param" select='/Header/ParameterName'/>
    <xsl:variable name="end">') result from dual</xsl:variable>
    <xsl:variable name="expr" select="concat($start,$param,$end)"/>
    And then I called the orcl:query-database method with the variable as in-parameter.
    orcl:query-database($expr,false(),false(),"jdbc/DB")
    Maybe there is another way, but this worked for me.
    //Kalle

  • How can I use index in xsl mapping

    Hi All,
    How can I use index in XSL mapping.

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • ** How to use TO_DATE function in Stored Proc. for JDBC in ABAP-XSL mapping

    Hi friends,
    I use ABAP-XSL mapping to insert records in Oracle table. My Sender is File and receiver is JDBC. We use Oracle 10g database. All fields in table are VARCHAR2 except one field; this is having type 'DATE'.
    I use Stored procedure to update the records in table. I have converted my string into date using the Oracle TO_DATE function. But, when I use this format, it throws an error in the Receiver CC. (But, the message is processed successfully in SXMB_MONI).
    The input format I formed like below:
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">
    Value in Payload is like below.
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">TO_DATE('18-11-1991','DD-MM-YYYY')</X_EMP_START_DT>
    Error in CC comes as below:
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_EMP_DETAILS' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('18"
    Friends, I have tried, but unable to find the correct solution to insert.
    Kindly help me to solve this issue.
    Kind Regards,
    Jegathees P.
    (But, the same is working fine if we use direct method in ABAP-XSL ie. not thru Stored Procedure)

    Hi Sinha,
    Thanks for your reply.
    I used the syntax
    <xsl:call-template name="date:format-date">
       <xsl:with-param name="date-time" select="string" />
       <xsl:with-param name="pattern" select="string" />
    </xsl:call-template>
    in my Abap XSL.  But, its not working correctly. The problem is 'href' function to import "date.xsl" in my XSLT is not able to do that. The system throws an error. Moreover, it is not able to write the command 'extension-element-prefixes' in my <xsl:stylesheet namespace>
    May be I am not able to understand how to use this.
    Anyway, I solved this problem by handling date conversion inside Oracle Stored Procedure. Now, its working fine.
    Thank you.

  • Performance of XSL Mapping in the ABAP Engine

    Hi All,
    Is the performance of XSL Mapping in the ABAP Engine better than java and graphical mapping. XSLT on the java stack has performance issue handling large documents.I want to know how far XSL Mapping in the ABAP Engine performs when compared to java/graphical mapping in the context of large inputs(>1MB).
    Anticipating your valuable inputs.
    Regards,
    Sudharshan N A

    Hi Sudarshan,
       Please go through the below link for a very clear understanding of the performance of the Mapping techniques...
    /people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
    Hope this helps
    Regards
    Kiran..

  • Unable to open xsl file in Jdev 10.1.3.4.0.4270 (XSL Map generation failed)

    Hi Guys,
    I am trying to edit an XSL file using Jdeveloper 10.1.3.4 and it gives me the error "XSL Map generation failed. Please use the source editor to correct the problems and return to the design editor".
    In the Mapper Message Log i find these lines.
    Line Number:(44) : Error: "xsl:import" XSL Element Currently not Supported
    Line Number:(68) : Error: "xsl:apply-templates" XSL Element Currently not Supported
    Line Number:(67) : Error: <xsl:template match="/"> and <xsl:template name="..."> are the only permitted <template> elements in the XSL
    Any help / pointers is very much appreciated.
    Regards,
    Vik

    Perhaps better late than never...
    This is a limitation in JDeveloper that it cannot render an XSL in design/mapper view when it contains these features of XSL. Pretty much 100% of AIA transformations fall into this category.

  • XSL mapping with Java enhancment PI 7.1 - Dynamic configuration

    Scenario - IDOC -> File
    XSL Mapping using dynamic configuration to set file name.
    1. Ive included
    xmlns:javamap="java:packageName.DynamicFunctionClass">
    in the XSL header
    2.Ive call this method javamap:transform($input, $output)
    In the Java code.
    1. Package = packageName
    2. Class Name = DynamicFunctionClass
    3. Class Compiles and I have uploaded into the ESR for a particular scenario. (source and class)
    4. extends AbstractTransformation and implements the transform method.
    public class DynamicFunctionClass extends AbstractTransformation{ .....
          public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {
    ISSUE -
    Essentially it looks as though PI cannot see the class file or is not able to reference it. I have created a static method in the class as well to access and this does not work.
    TRACE -
    Resource not found META-INF/Services/javax.xml.parsers.SAXParserFactory Thrown:
       com.sap.aii.ib.server.mapping.execution.MappingClassNotFoundException:

    Ive stumbled across the fact that JDK 1.5 does not allow for Mapping with Java enchanment it is a feature only in SAPXMLTOOL kit, I shall tick the little box in the Operational mapping ...

  • Problem in XSL mapping with leading zero's

    Hi ,
    i am facing a problem in disigning a XSL mapping where one of the source field (type string ) ,and I need to remove the leading zero's to map it to target.
    we have format-numer ,but It is not working in this case ,may be because of type string.
    and the replace command is not supported .
    So can any one suggest me some way to resolve this xsl problem.
    Thanks,
    Raju.

    I write an example
    xsl file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <xsl:template match="/">
              <doc>
                   <xsl:apply-templates/>
              </doc>
         </xsl:template>
         <xsl:template match="source_field">
              <source_field>
                   <xsl:call-template name="remove_leading_zeros">
                        <xsl:with-param name="value" select="."/>
                   </xsl:call-template>
              </source_field>
         </xsl:template>
         <xsl:template name="remove_leading_zeros">
              <xsl:param name="value"/>
              <xsl:choose>
                   <xsl:when test="starts-with($value, '0')">
                        <xsl:call-template name="remove_leading_zeros">
                             <xsl:with-param name="value" select="substring($value, 2)"/>
                        </xsl:call-template>
                   </xsl:when>
                   <xsl:otherwise>
                        <xsl:value-of select="$value"/>
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>
    </xsl:stylesheet>
    to test:
    input xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <doc>
    <source_field>000000123456</source_field>
    <source_field>0987654</source_field>
    </doc>
    output xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <doc xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <source_field>123456</source_field>
         <source_field>987654</source_field>
    </doc>
    hope can help you.
    regards
    Bin

  • XSL mapping

    Hi Experts,
    I imported the XSL file, it contains the mapping program....Issue is
    Here the value entering in BELNR has to divided in such a way that we discard the first three alphabet and retain the remaining part . Substring function has to be used with staring string 3 and number of characters 10 .
    Could you suggest how to test xsl mapping...or should i modify it in notepad and then upload and test in IR itself
    Many Thanks
    Bijal:)

    To test the XSLT Mapping:
    -Zip the .xslt file and import the zip into Improted Archive
    -Then create the new Interface Mapping or you can copy old Interface Mapping by right clicking on the Interface Mapping where you required to use XSLT mapping
    btw, if you are using xslt or java mapping, you need to just use this in the Interface Mapping.
    -In interface mapping, you can see the drop down list to select type of mapping and proceed further. It will direct you .
    Note: reward points if solution found helpfull
    Regards
    Chandrakanth.k

  • XSL Mapping: Get node without complete XPath

    Dear all,
    I would like to create a generic XSL mapping
    In the target structure I would like to insert the value of DOCNUM
    <xsl:template match="DOCNUM">
       <xsl:value-of select="/ORDERS/IDOC/EDI_DC40/DOCNUM" />
    </xsl:template>
    That works.
    Now, the mapping should become generic. I would like to use this for ORDERS, DELVRY and so on.
    I try tor create it this way.
       <xsl:value-of select="/../IDOC/EDI_DC40/DOCNUM" />
       <xsl:value-of select="/IDOC/EDI_DC40/DOCNUM" />
       <xsl:value-of select="/DOCNUM" />
    So I don't want to use ORDERS in the select statement.
    How to get this work for all IDOC types?
    Regards
    Chris

    just define this
    SOURCE
    <?xml version="1.0" encoding="UTF-8"?>
    <XXXXXXX>
       <IDOC BEGIN="1">
          <EDI_DC40 SEGMENT="1">
             <TABNAM>EDI_DC40</TABNAM>
             <MANDT>310</MANDT>
             <DOCNUM>0000000001021184</DOCNUM>
             <DOCREL>XX</DOCREL>
             <STATUS>XX</STATUS>
             <DIRECT>1</DIRECT>
    </EDI_DC40>
    </IDOC>
    </XXXXXXX>
    XLS
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="IDOC">
    <DOCNUM>
    <xsl:value-of select="EDI_DC40/DOCNUM" />
    </DOCNUM>
    </xsl:template>
    </xsl:stylesheet>
    RESULT
    <?xml version="1.0" encoding="UTF-8"?>
    <DOCNUM>0000000001021184</DOCNUM>
    Thanks
    Edited by: Rodrigo Alejandro Pertierra on Feb 3, 2011 2:28 PM

  • ABAP XSL mapping - Binary data of attached file

    I have a webservice which is converting attachment and putting it into XSLT Node. when I mapped this node to Attachment payload of my partner (using ABAP xsl mapping), I got an error.
    I was able to send the same file via SOAP UI...
    On further investigation of the http log files, I noticed that Binary data for both streams looked same, but when I did a word count, I noticed that SOAP UI was a single line file while my PI data was more than 400 lines.. so I coded a fn:transfer of this data to convert end of line character to empty value. it did seem to work...
    My question, is this approach correct? or is there any way to ensure binary data stream in XML node does not contain those additional characters?

    can you provide input xml
    Edited by: RajuGA on Dec 7, 2011 2:09 PM

  • Mapping query in SAP PI

    Hi Experts,
    I have a mapping query in SAP PI. Actually I am mapping the source and target fields, now the problem is.
    The sender filed is subnode of the main node, and I have mapped the two main nodes in the sender and receiver together.
    Now, whether the sender main node comes all the subnode values will come or do we need to do something else for it.
    Both the sender and target main nodes and subnodes can have multiple repetations.
    I think One to One mapping wont do in this case. What needs to be done please help??
    Thanks and regards,
    Aniruddha

    Hi Vijay,
    Thanks a lot.I will try this out. Can you help me in another mapping problem, the req. is that i need to map the source and the target.
    The condition basically is :
    If no value in LIFEX use VBELN to map to a single target field.
    But I wont use UDF in this case.
    Please help.
    Regards,
    Aniruddha

  • XSL mapping of ARTMAS IDoc - carriage returns and white space

    Hi all. I have tried all sorts here and am completely stuck. I am mapping an article master ARTMAS IDoc using XSL mapping and an extra carriage return and white space characters are being added to the FIELD1 and FIELD2 fields of the E1BPE1MARAEXTRT segment and I don't know why! These fields contain all our bespoke field values joined together so they are 229 and 250 characters long respectively, which I think is related to the problem. The mapping program looks like this:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>
    <xsl:template match="/">
    <ARTMAS04>
    <IDOC>
      <xsl:copy-of select="//ARTMAS04/IDOC/EDI_DC40"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MATHEAD"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARART"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARAEXTRT"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MAKTRT"/>
      <xsl:for-each select="//ARTMAS04/IDOC/E1BPE1MARCRT">
        <xsl:if test="(PLANT='D100') or (PLANT='D200') or (PLANT='D300')">
          <xsl:copy-of select="."/>
        </xsl:if>
      </xsl:for-each>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARMRT"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MEANRT"/>
    </IDOC>
    </ARTMAS04>
    </xsl:template>
    </xsl:stylesheet>
    I have a test IDoc going through this and the first 3 characters of the FIELD1 are "BIK". If I look at the source of the XML file, the problem area looks like this:
    <E1BPE1MARAEXTRT SEGMENT="1">
          <FUNCTION>004</FUNCTION>
          <MATERIAL>000000000000895649</MATERIAL>
          <b><FIELD1>
            BIK</b>      0  0.00 T                                    000000001CARRERA FURY 04 20"     CARRERA FURY 04 20" 2005092420040622    X                    00000000   20031104 00200406140000000000                    0.00 0000000
          </FIELD1>
    You can't really see it above, but there is a carriage return and 8 white spaces before the BIK. Where does this carriage return and white space come from?! Any help would be really appreciated - this is driving me crazy!
    Many thanks,
    Stuart Richards

    Stuart,
    I think I know the cause to your problem. I am not an XSLT programmer but based on searching this forum I found how I can acheive the carriage return at the end of my document. Your xsl statement is as follows:
    <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>
    Change the indent value from yes to no. This should remove the carraige return. Hope this works for you.
    I actually need a carriage return and line feed on my document so I am still stuck. All I have acheived is the carraige return.
    Thanks,
    Jim

  • White space not preserved with XSL Mapping

    Hello
    Is there a problem with preserving white space when using a XSL mapping? My schema has the following included:
                  <xs:element name="FileVersion" minOccurs="1" maxOccurs="1">
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:length value="5"/>
                        <xs:whiteSpace value="preserve"/>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:element>             
    The whiteSpace attribute alone didn't do it, so I've added length as well which didn't help either.
    My imported XSL mapping writes a fix value of " 6.00" (having a leading space) into the field:
         <FileVersion>
              <xsl:value-of select="' 6.00'"/>
         </FileVersion>
    Processing the mapping with an external tool provides the correct output with a leading space.
    The leading space is missing in the output file or when I do testing in the integration builder. Looking at the target payload in sxmb_moni also shows me the value without leading space:
      <FileVersion>6.00</FileVersion>
    What do I miss? I haven't really found a posting regarding the issue, hence I assume it isn't really one!? Any feedback is appreciated.
    Thanks,
    Daniel

    My XSLT mapping does not have a preserve-space declaration. I am using Altova MapForce, and apparently preserve-space is not a declaration that is supported by MapForce. I would need to manually add it to the mapping after generating it in the tool. Nevertheless, isn't preserve-space the default anyway if nothing is declared, and therefore not necessary?.

  • How can we test XSL mapping program

    Hi Experts,
    I have XSL mapping program. How can I test this program.
    Please tell me how can I test this file.
    Thanks
    Balaprasad

    Please download xml tools like XML SPY/ALTOVA/ COOKTOP.
    YOu can test your XSL mapping using these tools.
    Alternatively, you have to create a Interface mapping in XI, using your XSL mapping.
    Then you can test using test TAB in the interface mapping.
    cooktop download:
    http://www.xmlcooktop.com/update/
    Regards,
    Ravi

Maybe you are looking for