Transformation XSLT
Hi,
Im new to XSLT.
I have to create an abap program using transformation to dymanically put data into Excel using XSLT .
Plz let me know with an example.
also is it possible to save an excel file directly as XSLT?
Regards,
Vimal
hi
good
go through these links,hope these ll help you to solve your probelm
http://help.sap.com/saphelp_nw2004s/helpdata/en/a8/824c3c66177414e10000000a114084/frameset.htm
XSLT samples for XML->ABAP mapping
thanks
mrutyun^
Similar Messages
-
Error while transforming XSLT by calling function with Reflection API
Hi,
I'm new to Reflection API. I want to call function from the jar file which is not in my application context. So I have loaded that jar ( say XXX.jar) file at runtime with URLClassLoader and call the function say [ *myTransform(Document document)* ]. Problem is that when I want to transform any XSLT file in that function it throws exception 'Could not compile stylesheet'. All required classes are in XXX.jar.
If I call 'myTransform' function directly without reflection API then it transformation successfully completed.
Following is code of reflection to invoke function
ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
URLClassLoader loader = new URLClassLoader(jarURLs, contextCL);
Class c = loader.loadClass(fullClasspath);
Constructor constructor = c.getDeclaredConstructor(constructorParamsClasses);
Object instance = constructor.newInstance(constructorParams);
Method method = c.getDeclaredMethod("myTransform", methodParamsClasses);
Object object = method.invoke(instance, methodParams);Following is function to be called with reflection API.
public Document myTransform ( Document document ) {
// Reference of Document (DOM NODE) used to hold the result of transformation.
Document doc = null ;
// DocumentBuilderFactory instance which is used to initialize DocumentBuilder to create newDocumentBuilder.
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance () ;
// Reference of DocumentBuilder used to create new Document (DOM NODE).
DocumentBuilder builder;
try {
// Initialize DocumentBuilder by using DocumentBuilderFactory instance.
builder = factory.newDocumentBuilder ();
// Initialize new document instance by using DocumentBuilder instance.
doc = builder.newDocument () ;
// Creates new DOMSource by using document (DOM NODE) which is coming through current transform() method parameter.
DOMSource domsource = new DOMSource ( document ) ;
// Creates new instance of TransformerFactory.
TransformerFactory transformerfactory = TransformerFactory.newInstance () ;
// Creates new Transformer instance by using TransformerFactory which holds XSLT file.
Transformer transformer = null;
********* exception is thrown from here onward ******************
transformer = transformerfactory.newTransformer (new StreamSource (xsltFile));
// Transform XSLT on document (DOM NODE) and store result in doc (DOM NODE).
transformer.transform ( domsource , new DOMResult ( doc ) ) ;
} catch (ParserConfigurationException ex) {
ex.printStackTrace();
} catch (TransformerConfigurationException ex) {
ex.printStackTrace();
} catch (TransformerException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
//holds result of transformation.
return doc ;
}Following is full exception stacktrace
ERROR: 'The first argument to the non-static Java function 'myBeanMethod' is not a valid object reference.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:829)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:623)
at com.actl.dxchange.utilities.Transformation.transform(Transformation.java:83)
at com.actl.dxchange.base.BaseConnector.transform(BaseConnector.java:330)
at com.actl.dxchange.connectors.KuoniConnector.doRequestProcess(KuoniConnector.java:388)
at com.actl.dxchange.connectors.KuoniConnector.hotelAvail(KuoniConnector.java:241)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
...........Hi,
Thanks for response.
Following is code for setting 'methodParamsClasses' array object. I do ensure that Document is not null and valid. My application is web application.
Document requestObj = /* my code for generating Document object*/
Object[] methodParams = new Object[]{requestObj}
Class[] methodParamsClasses = new Class[]{};
if (methodParams != null) {
methodParamsClasses = new Class[methodParams.length];
for (int i = 0; i < methodParams.length; i++) {
if (methodParams[i] instanceof Document) {
/************** if parameter is instance of Document then I set class type as "Document.class" ***********/
methodParamsClasses[i] = Document.class;
} else {
methodParamsClasses[i] = methodParams.getClass(); -
CALL TRANSFORMATION - XSLT encoding not settable?
Hello fellow ABAPer,
I have a problem creating an XML file from an simple itab, using XSLT transformation (CALL TRANSFORMATION).
Here's what I'm doing: I have a simple itab it_person type tt_person:
TYPES: BEGIN OF tt_person,
id(4) TYPE n,
firstname(20) TYPE c,
lastname(20) TYPE c,
END OF tt_person.
I'm filling it_person with test-data:
gs_person-id = '1'.
gs_person-firstname = 'John'.
gs_person-lastname = 'Smith'.
APPEND wa_person TO it_person.
Now I'm getting the reference of my itab for the CALL TRANSFORMATION command and I'm finally doing the actual transformation like this:
CALL TRANSFORMATION z_test_transformation
SOURCE (it_source_tab)
RESULT XML it_xml.
The Transformation (XSLT Program) looks like this:
http://uploading.com/files/775c1d31/trans.txt/
(sorry, I tried to post the transformation's code here, but that's not working, it screws the whole formating of this posting, that's why I had to upload it)
When I'm gui_downloading the XML file it looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<CUSTOMERS>
<item>
<id>1</id>
<first_name>John</first_name>
<last_name>Smith</last_name>
</item>
</CUSTOMERS>
So everything is fine, until now: I need a different encoding, the other system's parser is not able to read ISO-8859-1 encoded files. So I need the first line of my XML to look like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
... and this is where I'm stuck right now, I can't get that to work.
I can change the line in my transformation to:
<xsl:output encoding="uft-8" indent="yes" method="xml" version="1.0" standalone="no"/>
but the resulting XML file is still ISO-8859-1. The "standalone" tag, that I need as well, doesn't work either.
So, what am I doing wrong? Is it not possible to create other XMLs than ISO-8859-1 with the XSLT-Transformation?
Thanks alot, any help would be highly appreciated.
AJI guess it_xml is an internal table cotaining chars?
i'm using
xxml TYPE xstring,
and
CALL TRANSFORMATION z_abap_to_xml_root
PARAMETERS mestyp = c_mestyp nsuri = c_namespace
SOURCE filename = fname table = it_out
RESULT XML xxml.
and i'm getting the xml encoding like
<?xml version="1.0" encoding="utf-8" ?>
Directly after your transformation insert the following call if your report can run interactively:
CALL FUNCTION 'DISPLAY_XML_STRING'
EXPORTING
xml_string = xxml
* TITLE =
* STARTING_X = 5
* STARTING_Y = 5
EXCEPTIONS
no_xml_document = 1
OTHERS = 2.
This displays the XML so you can check the encoding to be sure that the data is not tempered elsewhere.
Downloading the XML String even if its xstring should be no problem. -
Call transformation XSLT and long note string in XML
Hi
Using call transformation (XSLT scheme) to convert XML file to html the problem is that line breaks in xml are ignored when passing the call tranformation.
<b>Note in xml look like:</b>
<com:Note><![CDATA[
Serie 87% 0,000000
Amount in this period 01-01-2006 - 01-07-2006 - 180 days
Currency 16.267.117,38 DKK
Loan DKK 14.332.700,00
Debt 7.358.534,23
Indexsfactor 226,230
]]></com:Note>
<b>When HTML displayed in sap, - note is just a long string which continue out of the screen. Note looks like:</b>
Serie 87% 0,000000Amount in this period 01-01-2006 - 01-07-2006 - 180 daysCurrency 16.267.117,38 DKKDebt 7.358.534,23Indexsfactor 226,230
<i>What to do ? Any ideas ?</i>Hi Jon,
What is the XSLT program that you're using to transform the XML?
Can you try modifying the XSLT stylesheet and add or modify the following attribute.
<xsl:output indent="yes"/>
Regards,
Erwin -
Bridge Output Module: Use Custom Transformer.xslt?
Hello,
I've been poking around the Adobe Output Module in CS4 to determine if we might be able to use it instead of the old Web Photo Gallery plug-in for Photoshop. I can understand the reasoning behind using XSLT / XML to generate HTML gallery pages, but I'm baffled by what appears to be a complete inability to specify a custom "transformer.xslt" which would be specific to a media gallery template. Is there any way to tell Bridge's Output Module to use a custom transformer.xslt so I don't have to edit or replace the default one?
Many thanks for any help.SERIOUSLY. And how about all of the other things missing from the old Contact Sheet:
1. How many pdf pages will be generated? ***MAY BE USEFUL when calculating the images per colum/row
2. the ability to output directly to Photoshop. Is it that hard? Do you really believe people didn't use that?
3. fix the stupid zoom. It's a POINTER FINGER, but when you click it zooms. And God forbid you keep anything consistent with any of your other software - ZOOM OUT IS *SHIFT*, not Command. Even then, the cursor stays a stupid finger. -
Error while transforming XSLT,"Could not compile stylesheet"
Hi,
During transformation of my XSLT I needs to fetch data from method named *"myMethod(String str)"*, which is in *"mypackage.test.MyClass"* class. MyClass is in{color:#000000} XXX.jar. {color}
This XXX.jar is not in context of my web application.*
Following is part of XSLT which I am using.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:aaa="mypackage.test.MyClass">
<xsl:template match="/responseData">
<xsl:for-each select="response">
<XMLResponse>
<xsl:for-each select="status">
<xsl:variable name="Vvar_ResResponseType" select="."/>
<xsl:attribute name="ResResponseType">
<xsl:value-of select="aaa:myMethod($Vvar_ResResponseType)"/>
</xsl:attribute>
</xsl:for-each>
</XMLResponse>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>So I tried to use reflection API to load XXX.jar file at runtime.
But while transforming Transformer does not find "myMethod(String str)" and gives error like "Could not compile stylesheet"
Following is full exception stacktrace
ERROR: 'The first argument to the non-static Java function 'myMethod' is not a valid object reference.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:829)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:623)
at com.actl.dxchange.utilities.Transformation.transform(Transformation.java:83)
at com.actl.dxchange.base.BaseConnector.transform(BaseConnector.java:330)
at com.actl.dxchange.connectors.KuoniConnector.doRequestProcess(KuoniConnector.java:388)
at com.actl.dxchange.connectors.KuoniConnector.hotelAvail(KuoniConnector.java:241)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
...........Please suggest is there any other way, so that Transformer can find required bean class from XXX.jar duruing transformation process.
Thanks & Regards,
Rohit Lad
Edited by: Rohit_Lad on Jan 29, 2009 7:38 PM
Edited by: Rohit_Lad on Jan 30, 2009 9:57 AM
Edited by: Rohit_Lad on Jan 30, 2009 10:02 AMGot the solution from forum named
"Reflections & Reference Objects"
Following is link for whom encountered this issue.
http://forums.sun.com/thread.jspa?threadID=5362426
Edited by: Rohit_Lad on Jan 30, 2009 2:35 PM -
Problem in Call transformation - xslt program
Hi Experts,
For the below XML file i have declared the XSLT Program as described.
i am not able to get the data into Internal table.
Could you pls help me in where am i going wrong?
Is it XSLT declaration or what?
Data declarations
TYPES: BEGIN OF TY_BH,
RECORDTYPE(02), " Record Type
DOCTYPE(02), " Document type
REFERENCE(16), " Reference Document Number
DOCUMENTDATE(08), " Document Date in Document
POSTINGDATE(08), " Posting Date in the Document
COMPANYCODE(04), " Company Code
CURRENCY(03), " Currency Key
EXCHANGERATE(08), " Exchange rate
PARK(01), " Park document
ITEMNUMBER(03), " Number of line item
END OF TY_BH,
BEGIN OF TY_HH,
RECORDTYPE(02), " Record Type
SOURCE(04),
DESTINATION(04),
TIMESTAMP(14),
END OF TY_HH,
BEGIN OF TY_TT,
RECORDTYPE(02),
TOTALRECORDS(10) TYPE N,
TOTALVALUE(16),
END OF TY_TT.
TYPES: BEGIN OF TY_BL,
RECORDTYPE(02),
REFERENCE(16),
REFLINEITEM(03),
ACCTTYPE(01),
DRCRINDICATOR(01),
ACCOUNT(10),
AMOUNT(13),
VENDORNAME1(40),
VENDORNAME2(40),
VENDORNAME3(40),
VENDORNAME4(40),
STREET(40),
CITY(40),
POSTALCODE(10),
COUNTRY(02),
CONTACTPERSON(10),
ALTERNATEPAYEECODE(10),
ALTERNATEPAYEENAME1(40),
ALTERNATEPAYEENAME2(40),
ALTERNATEPAYEENAME3(40),
PAYMENTTERMS(04),
BASELINEDATE(08),
PAYMENTMETHODS(01),
ALLOCATION(18),
LINEITEMTEXT(50),
TAXCODE(02),
TAXAMOUNT(13),
WHTAXCODE(02),
WHTAXBASE(13),
FUND(10),
FUNDCENTER(16),
COSTCENTER(10),
INTERNALORDER(12),
TAXAUTOMATICALLY(01),
SPECIALGLINDICATOR(01),
END OF TY_BL.
DATA: GT_BH TYPE STANDARD TABLE OF TY_BH,
GS_BH TYPE TY_BH,
GT_BL TYPE STANDARD TABLE OF TY_BL,
GS_BL TYPE TY_BL,
GT_HH TYPE STANDARD TABLE OF TY_HH,
GS_HH TYPE TY_HH,
GT_TT TYPE STANDARD TABLE OF TY_TT,
GS_TT TYPE TY_TT.
DATA: GT_RESULT_XML5 TYPE ABAP_TRANS_RESBIND_TAB,
GS_RESULT_XML5 TYPE ABAP_TRANS_RESBIND.
DATA: GS_RIF_EX TYPE REF TO CX_ROOT,
GS_VAR_TEXT TYPE STRING.
DATA: BEGIN OF GT_XML,
HH TYPE TY_HH,
BH LIKE TABLE OF GT_BH,
BL LIKE TABLE OF GT_BL,
TT TYPE TY_TT,
END OF GT_XML.
DATA: GT_ITAB TYPE STANDARD TABLE OF CHAR2048,
GS_ITAB TYPE CHAR2048.
I have the below file read into internal table GT_ITAB.
XML File
<?xml version="1.0" encoding="utf-8"?>
<ABCInbound xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\XYZSchema\ABCInbound.xsd">
<HH>
<RecordType>HH</RecordType>
<Source>ABC</Source>
<Destination>XYZ</Destination>
<TimeStamp>20050909220546</TimeStamp>
</HH>
<BH>
<RecordType>BH</RecordType>
<DocType>AB</DocType>
<Reference>2205516125</Reference>
<DocumentDate>20080909</DocumentDate>
<PostingDate></PostingDate>
<CompanyCode>ABC</CompanyCode>
<Currency>INR</Currency>
<ExchangeRate>1.0000</ExchangeRate>
<Park></Park>
<ItemNumber>2</ItemNumber>
</BH>
<BL>
<RecordType>BL</RecordType>
<Reference>2205516125</Reference>
<RefLineItem>1</RefLineItem>
<AcctType>K</AcctType>
<DrCrIndicator>H</DrCrIndicator>
<Account>01000003</Account>
<Amount>364.00</Amount>
<VendorName-1>TOM & JERRY IS MY</VendorName-1>
<VendorName-2> NAME TO BE PAID</VendorName-2>
<VendorName-3>1987566Z</VendorName-3>
<VendorName-4>22</VendorName-4>
<Street>UCX STREET</Street>
<City>ROAD 4</City>
<PostalCode>515004</PostalCode>
<Country>IND</Country>
<ContactPerson></ContactPerson>
<AlternatePayeeCode></AlternatePayeeCode>
<AlternatePayeeName-1></AlternatePayeeName-1>
<AlternatePayeeName-2></AlternatePayeeName-2>
<AlternatePayeeName-3></AlternatePayeeName-3>
<PaymentTerms></PaymentTerms>
<BaselineDate></BaselineDate>
<PaymentMethods></PaymentMethods>
<Allocation></Allocation>
<LineItemText>item text</LineItemText>
<TaxCode></TaxCode>
<TaxAmount>0.00</TaxAmount>
<WHTaxCode></WHTaxCode>
<WHTaxbase>0.00</WHTaxbase>
<Fund></Fund>
<FundCenter></FundCenter>
<CostCenter></CostCenter>
<InternalOrder></InternalOrder>
<TaxAutomatically></TaxAutomatically>
<SpecialGLIndicator></SpecialGLIndicator>
</BL>
<TT>
<RecordType>TT</RecordType>
<TotalRecords>1</TotalRecords>
<TotalValue>222</TotalValue>
</TT>
</ABCInbound>
Call transformation as below
GET REFERENCE OF GT_XML INTO GS_RESULT_XML5-VALUE.
GS_RESULT_XML5-NAME = 'IABC'.
APPEND GS_RESULT_XML5 TO GT_RESULT_XML5.
TRY.
CALL TRANSFORMATION Z_XML_TO_ABAP5
SOURCE XML GT_ITAB
RESULT (GT_RESULT_XML5).
CATCH CX_ROOT INTO GS_RIF_EX.
GS_VAR_TEXT = GS_RIF_EX->GET_TEXT( ).
MESSAGE GS_VAR_TEXT TYPE 'E'.
ENDTRY.
WHEN I CHECK GT_XML its initial.
XSLT Program Z_XML_TO_ABAP5 is like below.
Pls let me know if my xslt declaration is wrong.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<IABC>
<xsl:apply-templates select="//ABCInbound"/>
</IABC>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="ABCINBOUND">
<item>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<SOURCE>
<xsl:value-of select="Source"/>
</SOURCE>
<DESTINATION>
<xsl:value-of select="Destination"/>
</DESTINATION>
<TIMESTAMP>
<xsl:value-of select="TimeStamp"/>
</TIMESTAMP>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<DOCTYPE>
<xsl:value-of select="DocType"/>
</DOCTYPE>
<REFERENCE>
<xsl:value-of select="Reference"/>
</REFERENCE>
<DOCUMENTDATE>
<xsl:value-of select="DocumentDate"/>
</DOCUMENTDATE>
<POSTINGDATE>
<xsl:value-of select="PostingDate"/>
</POSTINGDATE>
<COMPANYCODE>
<xsl:value-of select="CompanyCode"/>
</COMPANYCODE>
<CURRENCY>
<xsl:value-of select="Currency"/>
</CURRENCY>
<EXCHANGERATE>
<xsl:value-of select="ExchangeRate"/>
</EXCHANGERATE>
<PARK>
<xsl:value-of select="Park"/>
</PARK>
<ITEMNUMBER>
<xsl:value-of select="ItemNumber"/>
</ITEMNUMBER>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<REFERENCE>
<xsl:value-of select="Reference"/>
</REFERENCE>
<REFLINEITEM>
<xsl:value-of select="RefLineItem"/>
</REFLINEITEM>
<ACCTTYPE>
<xsl:value-of select="AcctType"/>
</ACCTTYPE>
<DRCRINDICATOR>
<xsl:value-of select="DrCrIndicator"/>
</DRCRINDICATOR>
<ACCOUNT>
<xsl:value-of select="Account"/>
</ACCOUNT>
<AMOUNT>
<xsl:value-of select="Amount"/>
</AMOUNT>
<VENDORNAME1>
<xsl:value-of select="VendorName-1"/>
</VENDORNAME1>
<VENDORNAME2>
<xsl:value-of select="VendorName-2"/>
</VENDORNAME2>
<VENDORNAME3>
<xsl:value-of select="VendorName-3"/>
</VENDORNAME3>
<VENDORNAME4>
<xsl:value-of select="VendorName-4"/>
</VENDORNAME4>
<STREET>
<xsl:value-of select="Street"/>
</STREET>
<CITY>
<xsl:value-of select="City"/>
</CITY>
<POSTALCODE>
<xsl:value-of select="PostalCode"/>
</POSTALCODE>
<COUNTRY>
<xsl:value-of select="Country"/>
</COUNTRY>
<CONTACTPERSON>
<xsl:value-of select="ContactPerson"/>
</CONTACTPERSON>
<ALTERNATEPAYEECODE>
<xsl:value-of select="AlternatePayeeCode"/>
</ALTERNATEPAYEECODE>
<ALTERNATEPAYEENAME1>
<xsl:value-of select="AlternatePayeeName1"/>
</ALTERNATEPAYEENAME1>
<ALTERNATEPAYEENAME2>
<xsl:value-of select="AlternatePayeeName2"/>
</ALTERNATEPAYEENAME2>
<ALTERNATEPAYEENAME3>
<xsl:value-of select="AlternatePayeeName3"/>
</ALTERNATEPAYEENAME3>
<PAYMENTTERMS>
<xsl:value-of select="PaymentTerms"/>
</PAYMENTTERMS>
<BASELINEDATE>
<xsl:value-of select="BaselineDate"/>
</BASELINEDATE>
<PAYMENTMETHODS>
<xsl:value-of select="PaymentMethods"/>
</PAYMENTMETHODS>
<ALLOCATION>
<xsl:value-of select="Allocation"/>
</ALLOCATION>
<LINEITEMTEXT>
<xsl:value-of select="LineItemText"/>
</LINEITEMTEXT>
<TAXCODE>
<xsl:value-of select="TaxCode"/>
</TAXCODE>
<TAXAMOUNT>
<xsl:value-of select="TaxAmount"/>
</TAXAMOUNT>
<WHTAXCODE>
<xsl:value-of select="WHTaxCode"/>
</WHTAXCODE>
<WHTAXBASE>
<xsl:value-of select="WHTaxbase"/>
</WHTAXBASE>
<FUND>
<xsl:value-of select="Fund"/>
</FUND>
<FUNDCENTER>
<xsl:value-of select="FundCenter"/>
</FUNDCENTER>
<COSTCENTER>
<xsl:value-of select="CostCenter"/>
</COSTCENTER>
<INTERNALORDER>
<xsl:value-of select="InternalOrder"/>
</INTERNALORDER>
<TAXAUTOMATICALLY>
<xsl:value-of select="TaxAutomatically"/>
</TAXAUTOMATICALLY>
<SPECIALGLINDICATOR>
<xsl:value-of select="SpecialGLIndicator"/>
</SPECIALGLINDICATOR>
<RECORDTYPE>
<xsl:value-of select="RecordType"/>
</RECORDTYPE>
<TOTALRECORDS>
<xsl:value-of select="TotalRecords"/>
</TOTALRECORDS>
<TOTALVALUE>
<xsl:value-of select="TotalValue"/>
</TOTALVALUE>
</item>
</xsl:template>
</xsl:transform>
I able to get if declare only for BL and BH in separate xslt transformations.
Regards,
SimhaHello Mithun,
when you use the call transformation statement you have to specifiy the xslt transformation used. As a first step you usually use the transformation with the name ID. This is a special transformation for making the asXML representation of abap data. Unfortunately if you look into this transformation you find the following:
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:transform>
If I remember correctly when you use another transformation this will first call the ID transformation and after this the specified one. So it should not be possible to just copy ID transformation and remove the line. I'll have to think again how to avoid the behaviour.
Best Regards
Roman -
Transforming XML into nested Internal Table via Call Transformation XSLT
Hi guys!
I am relatively new to this XML transformation to Abap Internal table. Hence I got help some help from this thread ABAP Development as well as referencing Txn SSTDEMO1 and SSTDEMO2
But I tried to attempt on my prog it failed. Heres my sample XML, XSLT & as well as Internal Table.
The good news is I am able to read in a BID item under bidlist BUT with no fields filled in the table.... Pls help....
<b><u>XML</u></b>
<?xml version="1.0" encoding="iso-8859-1"?>
<myXML>
<BIDLIST>
<BID>
<HEADER>
<DOC_CODE>4000000343</DOC_CODE>
<RESPONSE_NO>80000003</RESPONSE_NO>
<RESPONSE_DATE>2006-10-01</RESPONSE_DATE>
<SUPP_CODE>44</SUPP_CODE>
<SUPP_SITE_ID>44</SUPP_SITE_ID>
<SUPP_CONTACT_NAME>JIM BEAN</SUPP_CONTACT_NAME>
<SUPP_CONTACT_PHONE>+6512345678</SUPP_CONTACT_PHONE>
<SUPP_CONTACT_EMAIL>[email protected]</SUPP_CONTACT_EMAIL>
</HEADER>
</BID>
</BIDLIST>
<myXML>
<u><b>XSLT</b></u>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/abapxml"
>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<BID_RESPONSE>
<xsl:for-each select="myXML/BIDLIST/BID">
<LBID>
<xsl:for-each select="HEADER">
<LHEADER>
<DOC_CODE> <xsl:value-of select="DOC_CODE"/> </DOC_CODE>
<RESPONSE_NO> <xsl:value-of select="RESPONSE_NO"/> </RESPONSE_NO>
<RESPONSE_DATE> <xsl:value-of select="RESPONSE_DATE"/> </RESPONSE_DATE>
<SUPP_CODE> <xsl:value-of select="SUPP_CODE"/> </SUPP_CODE>
<SUPP_SITE_ID> <xsl:value-of select="SUPP_SITE_ID"/> </SUPP_SITE_ID>
<SUPP_CONTACT_NAME> <xsl:value-of select="SUPP_CONTACT_NAME"/> </SUPP_CONTACT_NAME>
<SUPP_CONTACT_PHONE> <xsl:value-of select="SUPP_CONTACT_PHONE"/> </SUPP_CONTACT_PHONE>
<SUPP_CONTACT_EMAIL> <xsl:value-of select="SUPP_CONTACT_EMAIL"/> </SUPP_CONTACT_EMAIL>
</LHEADER>
</xsl:for-each>
</LBID>
</xsl:for-each>
</BID_RESPONSE>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
<u><b>Internal Table</b></u>
TYPES: BEGIN OF T_HEADER,
DOC_CODE(17),
RESPONSE_NO(8),
RESPONSE_DATE(10),
SUPP_CODE(16),
SUPP_SITE_ID(15),
SUPP_CONTACT_NAME(140),
SUPP_CONTACT_PHONE(23),
SUPP_CONTACT_EMAIL(100),
D_HEADER TYPE T_HEADER OCCURS 0.
TYPES: BEGIN OF T_BID,
HEADER TYPE D_HEADER,
END OF T_BID,
D_BID TYPE T_BID OCCURS 0.
TYPES: BEGIN OF T_BIDLIST,
BID TYPE D_BID,
END OF T_BIDLIST,
D_BIDLIST TYPE T_BIDLIST OCCURS 0.
TYPES: BEGIN OF TYPE_DATA,
BIDLIST TYPE D_BIDLIST,
END OF TYPE_DATA.
DATA: BID_RESPONSE TYPE TABLE OF TYPE_DATA.hi
good
go through these links, i hope these ll help you to solve your problem.
http://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/15ecdf90-0201-0010-d792-941a3c3c30a4
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/d-f/from%20xml%20to%20abap%20data%20structures%20and%20back%20bridging%20the%20gap%20with%20xslt
thanks
mrutyun^ -
What is the use of XSLT.....
I want to ask if the tree of the xml file has changed( such as remove a node from the tree), and then use the transformer to display the changed tree .........
does it mean that we don't need to rewrite the xml file to save the changed tree?Well. XSLT specification just defines how to transform a source document into another .. the other can be palin text, another XML or HTML or whatever one wants.. n it really doesn't make ne change in the source tree..
-
Outbound Proxy is generating Mapping Transformation XSLT error in SPROXY Test
Hi,
I have searched already online but i am unable to find anything relevant.
The scenario is that I have an Inbound proxy for processing the incoming payload and in this code the call is made to the oubound proxy method and i am gettin the MAPPING.TRANSFORMER_EXCEPTION Exception occurred during XSLT mapping of the application
CALL METHOD outbound_obj->shipment_status_notification_o
EXPORTING
output = wa_orders_request_out
IMPORTING
input = wa_orders_response_out.
We just updated the orders_request_out with a single field and activated and regnerated the proxy in ECC and i can now see the updated structure.
However, if i take the payload from production and just pass the payload in debug to the above method call in both Dev and QA with the added field, I am getting the above error.
I cannot do the proxy debug in production unfortunately so i cannot see if this is happening only in Dev and QA.
Can anyone please help me as this is urgent and If i can get past this error i can actually test if processing is working as expected?
Regards,
ArchanaHi Mark,
I have checked the data type and the field occurrence is 0.1
The change was made only to the request structure as based on this field value some selection needs to be made. The Response structure was not changed at all.
I have regenerated the outbound proxy as well and surprisingly even though it was not modified it still did not give me a message that the proxy object has not changed. I had to activate it as changed to inactive.
I am also not sure why that happened.
Regards,
Archana -
Error in Passing BPEL variable Contents to BPEL Transform (XSLT)
Hi,
Problem Statement:
· I want to Transform data, from schema1 to schema2.
· Schema1 is basically a collection lets say collection of A. in XML terms, it has multiple same type of child elements under the root element.
· Schema2 associated with each child element of Schema1.
· In the Loop, I want to iterate through the schema1 data and iteration count would be as much as number of child elements in it.
· Pick one child element (using index in XPATH) and use it to associate with Schema2 elements.
· In this process I wanted to pass 2 parameters to BPEL Transform activity using properties datatype. (ref: http://blogs.oracle.com/rammenon/2007/05/07)
· However it is not realizing the parameters passed to it.
Please also suggest me a location to upload the related code for any verification.
Please suggest the flaw in this and suggestions to rectify.
Thanks
Regards
JoyExample counting nodes.
ora:countNodes('Invoke_FileSyncRead_SynchronousRead_OutputVariable','Root-Element','/ns1:Root-Element/ns1:SiteInfo')
Set that to Integer variable $count.
Then set new variable type integer $interator = 1.
That will give you a proper loop counter for your payload.
AS far as mapping only certain elements, I would just transform 1st, then pick out what you need with an explicit assign activity to whatever you want to pass that to.
Hope that helps. -
High memory consumption in XSL transformations (XSLT)
Hello colleagues!
We have the problem of a very high memory consumption when transforming XML
files with CALL TRANSFORMATION.
Code example:
CALL TRANSFORMATION /ipro/wml_translate_cls_ilfo
SOURCE XML lx_clause_text
RESULT XML lx_temp.
lx_clause_text is a WordML xstring (i.e. it is a Microsoft Word file in XML
format) and can therefore not be easily splitted into several parts.
Unfortunately this string can get very huge (e.g. 50MB). The problem is that
it seems that CALL TRANSFORMATION allocates memory for the source and result
xstrings but doesn't free them after the transformation.
So in this example this would mean that the transformation allocates ~100MB
memory (50MB for source, ~50MB for result) and doesn't free it. Multiply
this with a couple of transformations and a good amount of users and you see
we get in trouble.
I found this note regarding the problem: 1081257
But we couldn't figure out how this problem could be solved in our case. The
note proposes to "use several short-running programs". What is meant with
this? By the way, our application is done with Web Dynpro for ABAP.
Thank you very much!
With best regards,
Mario DüsselHi,
q1. how come the Ram consumption is increased to 99% on all the three boxes?If we continue with the theory that network connectivity was lost between the hosts, the Coherence servers on the local hosts would form their own clusters. Prior to the "split", each cache server would hold 1/12 of the primary and 1/12 of the backup (assuming you have one backup). Since Coherence avoids selecting a backup on the same host as the primary when possible, the 4 servers on each host would hold 2/3 of the cache. After the spit, each server would hold 1/6 of the primary and 1/6 of the backup, i.e., twice the memory it previously consumed for the cache. It is also possible that a substantial portion of the missing 1/3 of the cache may be restored from the near caches, in which case, each server would then hold 1/4 of the primary and 1/4 of the backup, i.e., thrice the memory it previously consumed for the cache.
q2: where is the cache data stored in the coherence servers?on which memory?The cache data is typically stored in the jvm's heap memory area.
Have you reviewed the logs?
Regards,
Harv -
Adding PHP to transformer.xslt
Specifically I would like to add a php function to the header of the individual images page and echo a call to it later in the page. I can't get the php formated properly for this. Do I add it in as a simple xsl string since xml does not understand php, but once its on the server it can be parsed? Do I enclose it in script tags? Any ideas, examples or other discussions on this mater would be appreciated.
ex:
[opencarrot]script language="php"[closecarrot]
function get_url() {code here}
[opencarrot]/script[closecarrot]
later:
[opencarrot]input type="hidden"[closecarrot]
[opencarrot]xsl:attribute name="return" /[closecarrot]
[opencarrot]xsl:attribute value='\If you custom developed the PHP or have access to code and
can follow it, you only need to output the static parts of the
OBJECT and EMBED tag and provide any dynamic values via PHP
variables.
If you are using a product that rotates ads and it cannot
handle Flash movies, contact the vendor or find one that does. -
How to define myself transform function in a xslt document???!!
"XSL Transformations (XSLT) Version 1.0"(http://www.w3.org/TR/1999/REC-xslt-19991116)
have "Additional Function" and "Extension Functions".
It is easy to define a transform function with ms biztalk mapper.
but how to do with weblogic or with Apache Xalan????!!!!!!
pleasy give me a sample!!!!!!!!!!!!
thanks!!!!!!look at the samples bea\wlserver6.0sp1\samples\examples\xml
~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
[email protected]
www.filip.net
"xp" <[email protected]> wrote in message
news:3b52ff86$[email protected]..
>
"XSL Transformations (XSLT) Version1.0"(http://www.w3.org/TR/1999/REC-xslt-19991116)
have "Additional Function" and "Extension Functions".
It is easy to define a transform function with ms biztalk mapper.
but how to do with weblogic or with Apache Xalan????!!!!!!
pleasy give me a sample!!!!!!!!!!!!
thanks!!!!!! -
XSLT Transform in XML Signature: Exception
Hello,
I have following problem with an XSLT tranform in my XML signature. Here is the code I use to add XSLT to signature:
main() {
DOMStructure stylesheet = new DOMStructure( getStylesheet() );
XSLTTransformParameterSpec spec = new XSLTTransformParameterSpec( stylesheet );
transforms.add( fac.newTransform( Transform.XSLT, spec ) );
private Element getStylesheet() throws Exception {
String stylesheet = //"<?xml version=\"1.0\"?>" +
"<xslt:stylesheet version=\"1.0\" xmlns:xslt=\"http://www.w3.org/1999/XSL/Transform\">\n" +
" <xsl:include href=\"http://extern XSLT\" />\n" +
" <xslt:template match=\"/\">" +
" <xsl:apply-imports />" +
" </xslt:template>" +
"</xslt:stylesheet>\n";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//dbf.setValidating( true );
return dbf.newDocumentBuilder().parse( new ByteArrayInputStream( stylesheet.getBytes() ) ).getDocumentElement();
I get following exception:
javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.dsig.TransformException: com.sun.org.apache.xml.internal.security.transforms.TransformationException: Cannot find xslt:stylesheet in Transform
Original Exception was com.sun.org.apache.xml.internal.security.transforms.TransformationException: Cannot find xslt:stylesheet in Transform
at org.jcp.xml.dsig.internal.dom.DOMReference.transform(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMReference.digest(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.digestReference(Unknown Source)
at org.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(Unknown Source)
In google I cannot find any details what can be wrong.
Any suggestions?
Thanks in advance,
errnoThanks for your response. Sorry - I tried both versions with xslt and xsl - doesn't worked -> the error in my post is actually caused through the multiple changes of this part of code. Here once again:
private Element getStylesheet() throws Exception {
String stylesheet = //"<?xml version=\"1.0\"?>" +
"<xslt:stylesheet version=\"1.0\" xmlns:xslt=\"http://www.w3.org/1999/XSL/Transform\">\n" +
" <xslt:include href=\"external XSLTl\" />\n" +
" <xslt:template match=\"/\">" +
" <xslt:apply-imports />" +
" </xslt:template>" +
"</xslt:stylesheet>\n";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//dbf.setValidating( true );
return dbf.newDocumentBuilder().parse( new ByteArrayInputStream( stylesheet.getBytes() ) ).getDocumentElement();
Thanks,
errno
Maybe you are looking for
-
Why can I not open itunes app running Windows XP Professional w/SP3? I get a window message DEP that will not allow me to open the itunes app to load or buy music
-
I have a 2-part presentation. The first part consists of a looping set of slides with animations, each including an icon designated as a hyperlink. The hyperlink goes to the second part of the presentation, which is the main slideshow. I find there i
-
Sync iPad calendar to Gmail Calendar
Hey all, I have done a lot of research about trying to figure out how to sync appointments made on my iPad to my Gmail calendar. I have found countless guides for how to get entries from Gmail to iPad which works for me, but I have not been able to f
-
Hi, I am trying to send an object from Server to Client but the ObjectInputStream.readObject() on the client blocks. net beans Project can be found Here . Why it doesn't work? Thanks, Itay
-
Can you export your site to godaddy, 1&1 etc...
i was wondering if i could post my site i made on iWeb to something like godaddy or 1&1. If so how do i do this because i dont want to pay for the whole mobile me suite.