Problem in transforming XML to string using XSLT

Hi there,
I have a R/3 -> XI -> WebService scenario where the message from XI to webservice needs to be sent in document/wrapped mode (the message xml must be embedded in a string element) and this message needs to be digitally signed.
We are using another webservice to sign the messages, also with the message being sent in a string. To transform the XML's into string and vice-versa, we are using XSLT (/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping).
The problem is that both the signer and the final webservice understand the special characters (like '<', '>', '&', '"' etc) in one way but the XSLT generates them in another way. For example, the character '<', in both webservices, is returned as "&#60;" but the XSL Transformation results in "&lt;".
The problem now is that our messages are always being rejected because the signature is not being recognized as true, though we are almost 100% sure that it's being done correctly. The only possibility to the error that we found is this character mapping being done differently.
So, it's like this:
XI sends string to signer as "&lt;"
XI receives string from signer as "&#60;"
XI processes the message
XI sends string to webservice as "&lt;"
XI receives string from webservice (containing error message) as "&#60;"
Is there a way of making the XSLT to return "&#60;" instead of "&lt;"?
Thanks in advace,
Henrique.

For Java Mapping, you can refer this-
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
In Java Mapping, in the startdocument event , you need to check for the specialchars, and just repalce the value required.
But, what i am thinking is , just try with Java functions inside the XSLT mapping instead of going for Java Mapping. You can call java functions from the XSLT. So before the document starts pasring, you need to replace the special characters. I did not try in XSLT like this.
For this , you can think with this e.g
/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
Regards,
Moorthy

Similar Messages

  • Help Please ! -- transform XML to HTML using xslt tag in JSP

    Hello,
    I have problem to do XSL transform in JSP.
    I have an XSL : test.xsl
    I have an XML : test.xml
    In JSP I have:
    <x:xslt media="html" xml="test.xml">
    <x:stylesheet media="html" uri="test.xsl" />
    </x:xslt>
    But It doesn't work the way it suppose to. What is wrong in my code ? I followed the URL http://e-docs.bea.com/wls/docs81/xml/xml_apps.html
    Thanks in advance,
    Christina

    Basically:
        try{
          //Setting up parameters.
          xml=new StreamSource(new File(xmlInput));
          xsl=new StreamSource(new File(xslInput));
          baos=new ByteArrayOutputStream();
          htmlResult=new StreamResult(baos);
          //Transform input(xml, xsl) onto html output.
          TransformerFactory tfactory=TransformerFactory.newInstance();
          Transformer transformer=tfactory.newTransformer(xsl);
          transformer.transform(xml, htmlResult);
          baos.writeTo(out);
          //System.err.println(htmlResult.getOutputStream().toString());
        catch(...){
        }I havent tested and I havent use this for a while, but I hope this can serve as a staring point.
    Regards,
    OO

  • Problems in transforming XML to HTML using HP-UX with Netscape Enterprise Server 4.0 sp3

    Hi,
    Has anyone ever had any problem using XML in NES 4.0 sp3?
    I'm using the libraries com.sun.xml.parser, com.sun.xml.tree, javax.xml.transform.
    The html is being created but is not being returned.
    (it is not showed in browser)
    This same xml application works well in Solaris with Iplanet Web Server 4.1, but it is not working in HP-UX with Netscape Enterprise Server 4.0 sp3.
    I'm entirely lost. I don't know if there is a bug in this version (NES 4.0) or if I need other xml libraries or it is a problem of JRE version.
    Any comments will be appreciate.
    Thanks

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Norbert Clavaux ([email protected]):
    Hi,
    Last year we built a complete new website, based on XML/XSL.
    We assumed all browsers would cope with XSL by now, but that was far to optimistic.
    Our company planned to launch the new site this december, but XSL is giving us some major problems:
    *** All our customers are obliged to use Internet Explorer 4/5.x. Some don't like that at all: they stick to Netscape.
    *** IE users have to download and install the MS-XSL parser. At our pilotsites this is giving a lot of trouble and frustration.
    I heard that it is possible to do the parsing at the serverside, using XSLT, creating HTML.
    HOW CAN WE INSTALL / IMPLEMENT THIS OPTION IN OUR CONFIGURATION?
    (PL/SQL / IAS 9i / Sun Solaris / Oracle 8.1.2)
    Thanks in advance,
    Norbert Clavaux
    Nederlandse Bibliotheek Dienst
    The Netherlands<HR></BLOCKQUOTE>
    You could use DB Prism / Cocoon CMS.
    This CMS is built on top of Apache Cocoon Framework and DB Prism servlet engine.
    This CMS stores the assets in the DB (CLOB) and applys the stylesheet at runtime.
    If you need more information about this CMS look at is free.
    This CMS builts the DB Prism web site at www.plenix.com/dbprism/
    Best regards, Marcelo.

  • XML to string using xslt or java mapping

    Hi Experts,
    I want to put xml into string and i need to change lessthan symbol to "&lt"   and greaterthan symbol to "&gt" , can anyone please help me how to do this??? can you provide code for java mapping or XSLT mapping to achive this.
    SOURCE
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:source_mt xmlns:ns0="urn:ppp:prototype">
       <row>
          <name1>IT</name1>
          <name2>SOLUTIONS</name2>
       </row>
    </ns0:source_mt>
    TARGET
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:target_mt xmlns:ns0="urn:ppp:prototype">
       <row>
          <Body>"&lt"name1"&gt" IT"&lt"/name1"&gt" "&lt"name2"&gt" SOLUTIONS"&lt";/name2"&gt" </Body>
       </row>
    </ns0:target_mt>

    Hi ,
          here is the XSLT code to obtain the desired output
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="/">
    <ns0:target_mt xmlns:ns0="urn:ppp:prototype">
         <xsl:for-each select="//row">
              <row>
                   <Body>
                        <xsl:for-each select="name1">
                                  <xsl:value-of select="concat('*&quot;&lt;&quot;name1&quot;&gt;&quot;*',normalize-space(.),'*&quot;&lt;&quot;/name1&quot;&gt;&quot;*')"></xsl:value-of>
                        </xsl:for-each>     
                        <xsl:for-each select="name2">
                                  <xsl:value-of select="concat('*&quot;&lt;&quot;name2&quot;&gt;&quot;*',normalize-space(.),'*&quot;&lt;&quot;/name2&quot;&gt;&quot;*')"></xsl:value-of>
                        </xsl:for-each>
                   </Body>
              </row>
         </xsl:for-each>
    </ns0:target_mt>      
    </xsl:template>
    </xsl:stylesheet>
    output produced as viewed in browser is
    http://postimage.org/image/1lqbgw8kk/
    Now to obtain exactly the output you posted earlier here is the code
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="/">
    <ns0:target_mt xmlns:ns0="urn:ppp:prototype">
         <xsl:for-each select="//row">
              <row>
                   <Body>
                        <xsl:for-each select="name1">
                                  <xsl:value-of select="concat('*&quot;&amp;lt&quot;name1&quot;&amp;gt&quot;*',normalize-space(.),'*&quot;&amp;lt&quot;/name1&quot;&amp;gt&quot;*')"></xsl:value-of>
                        </xsl:for-each>     
                        <xsl:for-each select="name2">
                                  <xsl:value-of select="concat('*&quot;&amp;lt&quot;name2&quot;&amp;gt&quot;*',normalize-space(.),'*&quot;&amp;lt&quot;/name2&quot;&amp;gt&quot;*')"></xsl:value-of>
                        </xsl:for-each>
                   </Body>
              </row>
         </xsl:for-each>
    </ns0:target_mt>      
    </xsl:template>
    </xsl:stylesheet>
    output you can see from link below
    http://postimage.org/image/2c7bzo478
    Hope this helps.
    Hi,
        Could you please kindly let us know if the solution is working properly as per your requirement?
    regards
    Anupam
    Edited by: anupamsap on Jul 26, 2011 6:29 AM
    Edited by: anupamsap on Jul 26, 2011 4:10 PM

  • Problem in transforming xml to html using xsl

    Hi everybody ,
    I am creating a xml in memory and i want to transform using xsl into an html.
    I want to embed some html code also in the data node.But when I get the html it simply writes as it is. I tried to make it cdata section but it did not worked. Pls help.
    crypticashu
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import org.w3c.dom.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    public class mytemp {
         public static void main(String args[])
         DocumentBuilder builder = null;
         Document document = null;
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         try
         builder = factory.newDocumentBuilder();
         document = builder.newDocument();
         catch (ParserConfigurationException e)
         e.printStackTrace();
         Element root = (Element) document.createElement("REPORT");
         document.appendChild(root);
         Node child = document.createElement("DATA");
         CDATASection data = document.createCDATASection("<b>Hello World </b>");
         child.appendChild(data);
         root.appendChild(child);
         document.getDocumentElement().normalize();
         DOMSource domsource = new DOMSource(document);
              TransformerFactory tfactory = TransformerFactory.newInstance();
              File f = new File("c:/mytemp/report.xsl");
              StreamSource xsl = new StreamSource(f);
              File html = new File("c:/myhtml.html");
              try
                   Templates templates = tfactory.newTemplates(xsl);
                   Transformer transformer = templates.newTransformer();
                   transformer.transform(domsource, new StreamResult(html));
              catch(Exception e)
                   e.printStackTrace();
         }

    want to embed some html code also in the data node.But when I get the html it simply writes as it is.That statement contradicts:
    In real application i will be getting data containg html tags.I want the parser to read that data as simple text. Both cannot be true. You either want the HTML to not be parsed or you want the transformer to deal with it. Which one?
    - Saish

  • XML to ABAP Using XSLT

    Hello friends,
        I am trying a ABAP program (posted on SDN) to convert XML into ABAP (internal table) and not having any luck. Either it is my table/structure declaration or XSLT. Could any of you experts give me a hand with it please?
    Thanks in advance..but points on help!
    Here is my XML:
    And my ABAP program:
    REPORT  ZTESTXMLREAD.
    TYPE-POOLS: abap, ixml.
      class cl_ixml definition load.
    TYPES: BEGIN OF t_dc40,
             docnum(17) TYPE  C,
             status(2)  TYPE  C,
           END   OF t_dc40.
    TYPES: BEGIN OF t_emkt,
             spras(2)   TYPE  C,
             maktx(35)  TYPE  C,
           END   OF t_emkt.
    TYPES: BEGIN OF t_emrm,
             matnr(12)  TYPE  C,
             ersda(8)   TYPE  C,
             ernam(25)  TYPE  C,
             emktx      TYPE  t_emkt,
           END   OF t_emrm.
    TYPES: BEGIN OF t_mm,
             dc40   TYPE  t_dc40,
             emrm   TYPE  t_emrm,
           END   OF t_mm.
    DATA: l_ixml            TYPE REF TO if_ixml,
          l_streamfactory   TYPE REF TO if_ixml_stream_factory,
          l_istream         TYPE REF TO if_ixml_istream.
    DATA: l_filename        TYPE string.
    DATA: it_airplus    TYPE STANDARD TABLE OF t_mm,
          wa_airplus    TYPE t_mm.
    *Errorvariables
    DATA: xslt_err   TYPE REF TO cx_xslt_exception,
          err_string TYPE string.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:Test.XML'.
    START-OF-SELECTION.
      Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
      Creating input stream
        l_istream = l_streamfactory->create_istream_uri( 'file://c:Test.xml' ).
    here we use the CALL TRANSFORMATION method which calls
    TRY.
        CALL TRANSFORMATION ZTestXSLT
          SOURCE xml l_istream
          RESULT xml_output = it_airplus
    catch any error, very helpful if the XSLT isn't correct
        CATCH cx_xslt_exception INTO xslt_err.
        err_string = xslt_err->get_text( ).
        WRITE: / 'Transformation error: ', err_string.
        EXIT.
      ENDTRY.
    setting a breakpoint to watch the workarea
    by the internal table "it_airplus"
           break-point.
      LOOP AT it_airplus INTO wa_airplus.
      ENDLOOP.

    Thank you Durairaj, as a matter of fact my program is based on your post (one that you pointed me to). For whatever reason I'm not having luck figuring it out (may be just a bit of work pressure) could you please hlep me a bit more by pointing me to where in my program code/xslt I'm going wrong? I somehow feel that it could be my table structure or xslt.
    I would really appreciate it!
    Thanks again,
    erfan.

  • How to find XSD file? XML to ABAP using XSLT convertor

    Hi Gurus,
    I am trying to convert an XML file to ABAP internal tables using an XSLT transformation. I used the code posted by Durairaj (XSLT program Y_XML_2_ITAB_SIMPLE as mentioned in the link: [Y_XML_2_ITAB_SIMPLE|Parse data to Internal Table;) and the code worked fine.
    My XML file structure is different, and when I try to modify the code for my purposes I got stuck. While changing the XML file strings in the report, I am unable to replace the tag xsi:noNamespaceSchemaLocation="invoice_btm.xsd" correctly. I am also not sure what this file "invoice_btm.xsd" does and where it is stored. When I remove the tag, I get other errors and cannot proceed ahead.
    Can you please advice as to how I should proceed? Also, where can I see the XSD file? can I add a XSD file for my own XML? Or, is there a way to eliminate the need for an XSD file altogether?
    Thanks in advance.
    Regards,
    Shailesh.

    Hi guys,
    Any help would be most helpful. Thanks again,
    Hi guys,
    Any ideas on this issue? Thanks again for your help.
    Hi Naimesh,
    Thanks for the quick reply. I am getting the error "The element abap was expected for the XML-ABAP transformation". I have replaced the following:
    1) "INVOICES_BTM" with the string "ACCOUNT_INFO"
    2) "INVOICE_BTM" with the string "ROOTNODE"
    My XSLT:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="ACCOUNT_INFO">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <OUTPUT>
              <xsl:for-each select="ROOTNODE">
                <items>
                  <INV_DATE>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_DATE"/>
                  </INV_DATE>
                  <INV_NO>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_NUMBER/NUMBER"/>
                  </INV_NO>
                  <INV_EXT>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_NUMBER/EXTENSION"/>
                  </INV_EXT>
                  <INV_SEQ>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_NUMBER/SEQUENCE"/>
                  </INV_SEQ>
                </items>
              </xsl:for-each>
            </OUTPUT>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    My XML program:
    TYPES: BEGIN OF stru,
             inv_date(10),
             inv_no(50),
             inv_ext(10),
             inv_seq(10),
           END OF stru.
    DATA: outtab TYPE STANDARD TABLE OF stru .
    DATA: xslt_error  TYPE REF TO cx_xslt_exception,
          xslt_message  TYPE  string .
    DATA: xml_string TYPE string .
    CLEAR xml_string .
    CONCATENATE
    '<?xml version="1.0" encoding="ISO-8859-1"?>'
    '<ACCOUNT_INFO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ROOTNODE.xsd">'
      '<ROOTNODE>'
        '<INVOICE_HEAD LANGUAGE="DE" DIRECT_DEBIT_QUALIFIER="NO">'
          '<INVOICE_DATE>20040112</INVOICE_DATE>'
          '<INVOICE_NUMBER>'
            '<NUMBER>0306299999</NUMBER>'
            '<EXTENSION>1</EXTENSION>'
            '<SEQUENCE>01</SEQUENCE>'
          '</INVOICE_NUMBER>'
    '</INVOICE_HEAD>'
    '</ROOTNODE>'
    '<ROOTNODE>'
        '<INVOICE_HEAD LANGUAGE="DE" DIRECT_DEBIT_QUALIFIER="NO">'
          '<INVOICE_DATE>20040113</INVOICE_DATE>'
          '<INVOICE_NUMBER>'
            '<NUMBER>0306299888</NUMBER>'
            '<EXTENSION>2</EXTENSION>'
            '<SEQUENCE>02</SEQUENCE>'
          '</INVOICE_NUMBER>'
    '</INVOICE_HEAD>'
    '</ROOTNODE>'
    '</ACCOUNT_INFO>'
    INTO xml_string .
    TRY .
        CALL TRANSFORMATION ('ZH2_XML_TRANS_I1')
          SOURCE XML  xml_string
          RESULT     output = outtab.
      CATCH cx_xslt_exception INTO xslt_error.
        xslt_message = xslt_error->get_text( ).
    ENDTRY.
    break-point.
    Edited by: Shailesh S Kamath on Jan 16, 2012 2:17 PM
    Edited by: Shailesh S Kamath on Jan 30, 2012 2:47 PM

  • Generating CDATA containing XML-like text using XSLT Mapper in OFM 11g

    Hi,
    One of our partners requires XML to be sent as XML string inside a CDATA section. The use of "real" XML is not an option at the moment. We try to generate something like the following using XSLT/XSLT Mapper in SOA Suite 11g:
    <element>
    <![CDATA[
    <supplierElement1>
    <supplierElement2>
    etcetera
    <supplierElement2>
    </supplierElement1>
    ]]>
    </element>
    We've tried the following two approaches, so far unsuccessful:
    <xsl:template match="/">
    <inp1:singleString>
    <inp1:input>
    <xsl:text disable-output-escaping="yes">&lt;![CDATA[test]]&gt;</xsl:text>
    </inp1:input
    </inp1:singleString>
    </xsl:template>
    resulting in:
    <inp1:singleString xmlns:inp1="http://xmlns.oracle.com/singleString">
    <inp1:input>&lt;![CDATA[test]]></inp1:input>
    </inp1:singleString>
    and:
    <xsl:output method="xml" indent="yes" cdata-section-elements="input"/>
    <xsl:template match="/">
    <inp1:singleString>
    <input>test</input>
    </inp1:singleString>
    </xsl:template>
    resulting in:
    <inp1:singleString xmlns:inp1="http://xmlns.oracle.com/singleString" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <input>test</input>
    </inp1:singleString>
    Does anyone know how to generate the CDATA section declaratively (within XSLT/XSLT Mapper), without resorting to custom code and parsing as we have to do now?
    Thanks!
    Ronald

    The exact error message I'm getting is :
    ABAP XML formatting error in XML node of type "element", name: "abap"

  • How to display transformed XML in flex? xslt processor w/o javascript?

    I have a tree view with a list of links. upon clicking the links it will display its contents in an iFrame.
    some of the links in my tree are, google.com, yahoo.com, and 2 xml files, 1 of which i have transfromed into html using xsl.
    google, yahoo and the xml file which i have not transformed display successfully in the iFrame. however the xml which i have transformed does not display anything. is there another way to display html in flex? or is there a way to display a transformed xml to html in flex.
    also is there another way to to use an xslt processor in flex without having to use javascript?

    In jsp page set content type to text/xml
    <%@ page contentType="text/xml" %>

  • How to ignore prefix from XML while converting XML to csv using XSLT

    Hi All,
    I am trying to convert XML to csv file.
    the XML i have is like....
    <?xml version="1.0"?>
    <bulkCmConfigDataFile xmlns:es="SpecificAttributes.3.0.xsd" xmlns:un="utranNrm.xsd" xmlns:xn="genericNrm.xsd" xmlns:gn="geranNrm.xsd" xmlns="configData.xsd">
    <configData dnPrefix="Undefined">
            <xn:SubNetwork id="AU_R">
                <xn:SubNetwork id="H5RG_0501">
                    <xn:MeContext id="Firle_5070020">
                        <xn:ManagedElement id="1">
                   <un:RncFunction id="1">
                   <un:UtranCell id="50390303">
                                    <un:attributes>
                                        <un:userLabel>UtranCell 50390303</un:userLabel>
                                        <un:cId>52383</un:cId>
                                        <un:localCellId>50390303</un:localCellId>
                                        <un:uarfcnUl>9613</un:uarfcnUl>
                                        <un:uarfcnDl>10563</un:uarfcnDl>
                                        <un:primaryScramblingCode>502</un:primaryScramblingCode>
                                        <un:primaryCpichPower>287</un:primaryCpichPower>
                                        <un:maximumTransmissionPower>403</un:maximumTransmissionPower>
                                        <un:primarySchPower>-18</un:primarySchPower>
                                        <un:secondarySchPower>-20</un:secondarySchPower>
                                        <un:bchPower>-20</un:bchPower>
                                        <un:lac>50301</un:lac>
                                        <un:rac>1</un:rac>
                                        <un:sac>52383</un:sac>
                                        <un:utranCellIubLink>SubNetwork=AU_R,SubNetwork=H5RG_0501,MeContext=H5RG_0501,ManagedElement=1,RncFunction=1,IubLink=5039030</un:utranCellIubLink>
                                    </un:attributes>
                                </un:UtranCell>     
                   </un:RncFunction>
                        </xn:ManagedElement>   
                    </xn:MeContext>
             </xn:SubNetwork>
            </xn:SubNetwork>
        </configData>
    </bulkCmConfigDataFile>now when i am using XSLT functionality to convert this XML into a csv i want ignore all the prefix from this xml like "un" , "xn" etc....
    can anybody has idea how i can ignore all this value using XSLT

    I just dont understand why factory.setIgnoringElementContentWhitespace(true) did not work.That only does something if the XML has a DTD that enables it to know what whitespace can be ignored and what is significant. The API documentation for the method refers you to this document:
    http://www.w3.org/TR/REC-xml#sec-white-space

  • How to get the WHOLE xml document inside a string using XSLT mapping

    Hi folks,
    I have a deep xml structure that I want to embed as body, tags included, in a mail message (not as an attachment).
    I'm trying to use Michal's method in this blog
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    However, I can't get it to deliver the entire structure instead of just specific elements.
    Any help is greatly appreciated,
    Thanks,
    Guy

    Ashok,
    I was able to work it out for my case.
    This XSL......
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <inside>
    <namestring>
    <xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>
    <xsl:copy-of select="outside/name/*"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text>
    <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
    </namestring>
    </inside>
    </xsl:template>
    </xsl:stylesheet>
    ...will transform this input....
    <?xml version="1.0" encoding="UTF-8"?>
    <outside>
    <name>
    <nameone>name1</nameone>
    <nametwo>name2</nametwo>
    <namethree>name3</namethree>
    </name>
    </outside>
    ...and put the whole lot into the CDATA element.
    Hope this helps you,
    Guy

  • Convert XML Node to String using XSLT

    Hi,
    Perhaps this has been discussed before. But i am looking at creating a XSLT mapping to take the entire inbound message and put it into a single node of the target.
    Is there a way?
    Thanks in advance
    Regards
    Venkat

    Hi Shankar,
    I have a input XML <root><a></a></root>
    I have a target <tgt><b></b></tgt>
    I need to have the target xml as
    <tgt><b>&lessthansign;root&greaterthansign;&lessthansign;a&greaterthansign;&lessthansign;/a&greaterthansign;&lessthansign;/root&greaterthansign;</b></tgt>
    Using the XSLT that you mentioned
    I am getting the format
    <tgt><b><root><a></a></root></b></tgt>
    Now the consumer of this message expects the data in the first type of format
    That is where i am getting stuck
    Thanks and Regards
    Venkat

  • Printint XML string using  XSLT mapping

    Hi,
    I'm trying to build a outgoing SOAP message with in XI, my backedn legacy application expect the soap message to be in certain format. It expect the xml request passed in the body of the message as whole xml string. I need to pring the xml something like this, I would appreciate if anyone had implemented something like this before. if you look at the below message I'm enclosing the whole xml string in the data element.
    <data xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <crm:schedule_call_request session_id="mid://07060623130210031519@elnk_crm.com" target_system_id="csi_ivr" xmlns:crm="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd" xmlns:xcommon="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd"> <crm:call_parameter global_rules_version_id="" manual_request="true" originating_skillset="TS (DU/BB)|ADSL RETAIL" parameter_version_id="1" transfer_skillset="TSBBDSL...WinELNK"> <crm:call_id>10031519</crm:call_id> <crm:department_name>TS</crm:department_name> <crm:object_type>CASE</crm:object_type> <crm:object_id>73079085</crm:object_id> <crm:call_time>2007-06-07T12:30:01.000-08:00</crm:call_time> <crm:customer_phone_number>6263452656</crm:customer_phone_number> <crm:override_attempts>false</crm:override_attempts> <crm:retry_count>3</crm:retry_count> <crm:call_trigger>3000</crm:call_trigger> <crm:call_time_padding>10</crm:call_time_padding> <crm:override_local_customer_call_hours>false</crm:override_local_customer_call_hours> </crm:call_parameter> </crm:schedule_call_request></data>

    Hi
    thanks for responding. here is the input SOAP message that I was building in the XLT mapping. I was stuck at putting the xml in the data element.
    soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    - <soapenv:Header>
    - <wsa:EndpointReference soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
      <wsa:Address xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">https://xmlc-qe.corp.earthlink.net/ws_xmlc/s_router</wsa:Address>
      <wsa:ServiceName wsa:PortName="XMLCollectivePort" xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">wsa:ServiceName</wsa:ServiceName>
      </wsa:EndpointReference>
      <wsa:To soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">https://xmlc-qe.corp.earthlink.net/ws_xmlc/queues/csi_queue</wsa:To>
      <wsa:Action soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">https://xmlc-qe.corp.earthlink.net/ws_xmlc/action//messaging/put_single</wsa:Action>
      <wsa:MessageID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xsi:type="soapenc:string" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">07060623130210031519</wsa:MessageID>
    - <wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">
    - <wsse:UsernameToken>
      <wsse:Username xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">elnk_crm</wsse:Username>
      <wsse:Password wsse:Type="wsse:PasswordDigest" xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">20UioFa77hI6MLhlc+KPDF95Hx0=</wsse:Password>
      <wsse:Nonce xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">VlX1Jpoq+vkQCQ8af2SaCDP1u9c=</wsse:Nonce>
      <wsu:Created xsi:type="soapenc:string" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">2007-06-06T23:13:12Z</wsu:Created>
      </wsse:UsernameToken>
      </wsse:Security>
      </soapenv:Header>
    - <soapenv:Body>
    - <ns1:SubmitRequest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="SubmitRequest">
      <data xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <crm:schedule_call_request session_id="mid://07060623130210031519@elnk_crm.com" target_system_id="csi_ivr" xmlns:crm="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd" xmlns:xcommon="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_crm.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd https://signup.earthlink.net/ws_xmlc/schema/crm/271005/xmlc_common.xsd"> <crm:call_parameter global_rules_version_id="" manual_request="true" originating_skillset="TS (DU/BB)|ADSL RETAIL" parameter_version_id="1" transfer_skillset="TSBBDSL...WinELNK"> <crm:call_id>10031519</crm:call_id> <crm:department_name>TS</crm:department_name> <crm:object_type>CASE</crm:object_type> <crm:object_id>73079085</crm:object_id> <crm:call_time>2007-06-07T12:30:01.000-08:00</crm:call_time> <crm:customer_phone_number>6263452656</crm:customer_phone_number> <crm:override_attempts>false</crm:override_attempts> <crm:retry_count>3</crm:retry_count> <crm:call_trigger>3000</crm:call_trigger> <crm:call_time_padding>10</crm:call_time_padding> <crm:override_local_customer_call_hours>false</crm:override_local_customer_call_hours> </crm:call_parameter> </crm:schedule_call_request></data>
      </ns1:SubmitRequest>
      </soapenv:Body>
      </soapenv:Envelope>

  • SAP 4.7 XML data exchange using XSLT

    Hello All,
    Hopefully the right place to post such article but here goes any way.
    My project involves producing XML files and then reading them back into to SAP internal tables. I am ok with writing SAP data to external XML file but reading it back in is causing a lot of head scratching.
    I am able to double click the XML file and it launches Ok in Internet Explorer.
    I am also able to debug the xslt file from within SE80 and the correct output is displayed.
    However, where I am trying to read the contents of the xml file via the Call Transformation procedure call my output table is not getting populated but instead I am recieving an error message saying the following is not correct:
    xmlns:sapxsl="http://www.sap.com/sapxsl
    but the above line is placed automaticlly in the XSLT when you create a new one from within SE80.
    I am new to SAP ABAP development so not sure what's exactly wrong.
    Any help on this issue will be greatfully appreciated. Thanks in Advance,
    Wasif
    REPORT  z_hp_xml_test                                               .
    TYPE-POOLS: ixml.
    TABLES: tstc, tstct.
    TYPES: BEGIN OF ty_transactions,
          tcode LIKE tstc-tcode,
          ttext LIKE tstct-ttext,
          sprsl LIKE tstct-sprsl,
    END OF ty_transactions.
    DATA: itab_transactions TYPE STANDARD TABLE OF ty_transactions.
    TYPES: BEGIN OF t_xml_line,
            data(256) TYPE x,
          END OF t_xml_line.
    DATA: l_ixml            TYPE REF TO if_ixml,
          l_streamfactory   TYPE REF TO if_ixml_stream_factory,
          l_parser          TYPE REF TO if_ixml_parser,
          l_istream         TYPE REF TO if_ixml_istream,
          l_document        TYPE REF TO if_ixml_document,
          l_node            TYPE REF TO if_ixml_node,
          l_xmldata         TYPE string.
    DATA: l_elem            TYPE REF TO if_ixml_element,
          l_root_node       TYPE REF TO if_ixml_node,
          l_next_node       TYPE REF TO if_ixml_node,
          l_name            TYPE string,
          l_iterator        TYPE REF TO if_ixml_node_iterator.
    DATA: l_xml_table       TYPE TABLE OF t_xml_line,
          l_xml_line        TYPE t_xml_line,
          l_xml_table_size  TYPE i.
    DATA: l_filename        TYPE string.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'C:     emp     ransactions.xml'.
    Validation of XML file: Only DTD included in xml document is supported
    PARAMETERS: pa_val  TYPE char1 AS CHECKBOX.
    START-OF-SELECTION.
      Creating the main iXML factory
      l_ixml = cl_ixml=>create( ).
      Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
      PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
      wrap the table containing the file into a stream
      l_istream = l_streamfactory->create_istream_itable( table =
    l_xml_table
                                                      size  =
    l_xml_table_size ).
      Creating a document
      l_document = l_ixml->create_document( ).
      Create a Parser
      l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                        istream        = l_istream
                                        document       = l_document ).
      Validate a document
      IF pa_val EQ 'X'.
        l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
      ENDIF.
    Parse the stream
    If any errors then disply else convert XML to table
      IF l_parser->parse( ) NE 0.
        IF l_parser->num_errors( ) NE 0.
          DATA: parseerror TYPE REF TO if_ixml_parse_error,
                str        TYPE string,
                i          TYPE i,
                count      TYPE i,
                index      TYPE i.
          count = l_parser->num_errors( ).
          WRITE: count, ' parse errors have occured:'.
          index = 0.
          WHILE index < count.
    parseerror = l_parser->get_error( index = index ).
    i = parseerror->get_line( ).
    WRITE: 'line: ', i.
    i = parseerror->get_column( ).
    WRITE: 'column: ', i.
    str = parseerror->get_reason( ).
    WRITE: str.
    index = index + 1.
    ENDWHILE.
    ENDIF.
    ELSE.
    TRY .
    CALL TRANSFORMATION (`Z_HP_TEST_XSLT`)
    SOURCE XML l_xml_table
    RESULT outtab = itab_transactions.
    DATA: xslt_err TYPE REF TO cx_xslt_exception .
    CATCH cx_xslt_exception INTO xslt_err.
    DATA: s TYPE string.
    s = xslt_err->get_text( ).
    WRITE: ': ', s.
    STOP.
    ENDTRY .
      Process the document
        IF l_parser->is_dom_generating( ) EQ 'X'.
          PERFORM process_dom USING l_document.
        ENDIF.
      ENDIF.
    *&      Form  get_xml_table
    FORM get_xml_table CHANGING l_xml_table_size TYPE i
                                l_xml_table      TYPE STANDARD TABLE.
      Local variable declaration
      DATA: l_len      TYPE i,
            l_len2     TYPE i,
            l_tab      TYPE tsfixml,
            l_content  TYPE string,
            l_str1     TYPE string,
            c_conv     TYPE REF TO cl_abap_conv_in_ce,
            l_itab     TYPE TABLE OF string.
      l_filename = pa_file.
      upload a file from the client's workstation
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename   = l_filename
          filetype   = 'BIN'
        IMPORTING
          filelength = l_xml_table_size
        CHANGING
          data_tab   = l_xml_table
        EXCEPTIONS
          OTHERS     = 19.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      Writing the XML document to the screen
      CLEAR l_str1.
      LOOP AT l_xml_table INTO l_xml_line.
        c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
    replacement = space  ).
        c_conv->read( IMPORTING data = l_content len = l_len ).
        CONCATENATE l_str1 l_content INTO l_str1.
      ENDLOOP.
      l_str1 = l_str1+0(l_xml_table_size).
      SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
      WRITE: /.
      WRITE: /' XML File'.
      WRITE: /.
      LOOP AT l_itab INTO l_str1.
        REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
    IN
          l_str1 WITH space.
        WRITE: / l_str1.
      ENDLOOP.
      WRITE: /.
    ENDFORM.                    "get_xml_table
    *&      Form  process_dom
    FORM process_dom USING document TYPE REF TO if_ixml_document.
      DATA: node      TYPE REF TO if_ixml_node,
            iterator  TYPE REF TO if_ixml_node_iterator,
            nodemap   TYPE REF TO if_ixml_named_node_map,
            attr      TYPE REF TO if_ixml_node,
            name      TYPE string,
            prefix    TYPE string,
            value     TYPE string,
            indent    TYPE i,
            count     TYPE i,
            index     TYPE i.
      node ?= document.
      CHECK NOT node IS INITIAL.
      ULINE.
      WRITE: /.
      WRITE: /' DOM-TREE'.
      WRITE: /.
      IF node IS INITIAL. EXIT. ENDIF.
      create a node iterator
      iterator  = node->create_iterator( ).
      get current node
      node = iterator->get_next( ).
      loop over all nodes
      WHILE NOT node IS INITIAL.
        indent = node->get_height( ) * 2.
        indent = indent + 20.
        CASE node->get_type( ).
          WHEN if_ixml_node=>co_node_element.
            element node
            name    = node->get_name( ).
            nodemap = node->get_attributes( ).
            WRITE: / 'ELEMENT  :'.
            WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
            IF NOT nodemap IS INITIAL.
              attributes
              count = nodemap->get_length( ).
              DO count TIMES.
                index  = sy-index - 1.
                attr   = nodemap->get_item( index ).
                name   = attr->get_name( ).
                prefix = attr->get_namespace_prefix( ).
                value  = attr->get_value( ).
                WRITE: / 'ATTRIBUTE:'.
                WRITE: AT indent name  COLOR COL_HEADING INVERSE, '=',
                                 value COLOR COL_TOTAL   INVERSE.
              ENDDO.
            ENDIF.
          WHEN if_ixml_node=>co_node_text OR
               if_ixml_node=>co_node_cdata_section.
            text node
            value  = node->get_value( ).
            WRITE: / 'VALUE     :'.
            WRITE: AT indent value COLOR COL_GROUP INVERSE.
        ENDCASE.
        advance to next node
        node = iterator->get_next( ).
      ENDWHILE.
    ENDFORM.                    "process_dom
    Section 3: My XSLT file:
    <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:template match="TransList">
         <xsl:apply-templates />
    </xsl:template>
             <xsl:template match="Tcode">
                  Tcode <xsl:apply-templates />
             </xsl:template>
             <xsl:template match="ttext">
                  ttext <xsl:apply-templates />
             </xsl:template>
             <xsl:template match="sprsl">
                  sprsl <xsl:apply-templates />
             </xsl:template>
    </xsl:transform>

    The exact error message I'm getting is :
    ABAP XML formatting error in XML node of type "element", name: "abap"

  • Problems with some web parts when using XSLT

    I have a page on which I have several web parts. Some web parts are custom while others are OOB and only XSLT is applied on them.  
    I am using 2 WFEs with NLB. Problem is when I do iisreset on one of the WFE then the OOB web parts with XSLT start giving error. You know the standard error "corelation ID....bla bla bla". Anyway the error automatically goes away after a 2, 3 minutes.
    So basically if I do iisreset or stop the iis, and then load that page, then all custom web parts load fine except those OOB web parts with XSLT. And then they too start working fine after 2, 3 minutes if I reload page.  
    What could be the reason for that? Looks like some service on which XSLT depends take time to load!? And once that service is loaded then they start working fine?  Or it could be due to distributed cache or something!?

    Hi  Frank,
    Which version of the SharePoint 2010 did you use?
    In June 2011 CU code was added to the DataFormWebPart (which is used to display list data) that if an XSLT transform took longer than 5 seconds, a StackOverflowException was thrown. This was done to avoid
    a potential Denial Of Service attack on SharePoint if crafted XML could be sent that would continually clog up the XSLT, thereby stopping pages from rendering.
    In August 2011 CU the transform "timeout" was reduced from 5 seconds to 1.
    So, any list with XSLT that takes longer than 1 second to parse in an XSLT transform goes *boom*.
    After you perform an IIS reset , the cache of the page was cleared and you encountered the error. Once the page is cached, there is no error.
    You can try to set up XSLT Timeout with the following PS commands:
    $farm = Get-SPFarm
    $farm.XsltTransformTimeOut = 5
    $farm.Update()
    Reference:
    http://social.msdn.microsoft.com/Forums/sharepoint/de-DE/44cfd798-be7a-4436-8786-bd44049e7def/sp2010-column-filter-causing-unable-to-display-web-part-error-and-a-stack-overflow-exception?forum=sharepointgeneralprevious
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

Maybe you are looking for

  • MacBook Pro to HP w1907v

    Hi. I just connected my 13 inch MacBook Pro to the HP w1907v monitor and I wanna make the HP monitor my mane screen... how can I do that ? Cause now when I move my mouse all the way up it goes to my MacBook Pro screen. I just wanna make the MacBook P

  • Wine and xrandr

    I'm trying to run some games with wine, but everyone shows the same problem when I try to run it in fullscreen. For instance if I run Starcraft or Fallout 2, terminal says: fixme:advapi:SetSecurityInfo stub fixme:win:EnumDisplayDevicesW ((null),0,0x3

  • Chinese character display scrambled in iTune!

    I have a folder containing mp4 files with some Chinese characters. When added to iTune, iTune will not display Chinese character correctly! What is the mechanism that allow iTune to display file names in different language? Should I edit the file pro

  • [SOLVED] - Twinkle: why its look is pretty ugly?

    I think the best sip program on archlinux it's Twinkle (unfortunately, ekiga sucks ). Leaving the fact that in the extra repo there is an old twinkle version, the application has a very ugly aspect. Do you know a way to improve the appareance, just l

  • " Query in Crystal Report "

    Hai  friend's,   I am having a Multi-Provider,Which consists a combination of Info cubes. I have to link the Multi-provider to my Crystal report. Can you let me know the Procedure. After also let me know the procedure to Display the Crystal Report. I