XSLT transform problem in JDeveloper 9i
I have the following method which is called from a JSP which accepts an XMLDocument and XSL filename, generates HTML and sends this to the response object:
public void processOutput(HttpServletResponse response
, XMLDocument xmlDoc
, String xslFileName)
throws Exception
DOMParser parser = new DOMParser();
parser.setPreserveWhitespace(true);
XMLDocument xslDoc = null;
PrintWriter out = null;
try{
URL xslURL = new URL(xslFileName);
parser.parse(xslURL);
xslDoc = parser.getDocument();
XSLStylesheet xslStyleSheet = new XSLStylesheet(xslDoc, xslURL);
XSLProcessor processor = new XSLProcessor();
response.setContentType("text/html");
out = response.getWriter();
processor.processXSL(xslStyleSheet, xmlDoc,out);
catch (Exception e){
throw new Exception("ERROR in XSLTManager.processOutput:"+e.getMessage());
finally{
xslDoc = null;
out=null;
when I run this in Jdeveloper 3.1.1.2 it works fine. When I run it in Jdeveloper 9.0.3.1 I get the following error ...
java.lang.Exception: ERROR in XSLTManager.processOutput:OutputStream already retrieved
... caused by the following line ...
out = response.getWriter();
Any help on this would be appreciated.
JDev 3.1 uses Oracle Web-to-Go as its servlet engine, and uses a previous release of Oracle JSP.
JDev 9.0.3 uses Oracle Containers for Java 9.0.3 (OC4J), and a later release of Oracle JSP.
Something in your JSP page has caused the JSP infrastructure to already get the outputstream, so you cannot get the writer. You'll need to:
(1) Figure out why your page is using the servlet output stream before you think it should be -- perhaps a <jsp:include flush="true"> in there? --, or
(2) Call getOutputStream() and let XSLT write to the outputstream instead of the writer.
Similar Messages
-
Hi,
hope anybody can help.
I try to transform a object to another object via XSLT transformation.
Here is my coding :
DATA: wa_transformation TYPE y0dpl_structures.
DATA: obj_import TYPE abap_trans_srcbind_tab,
wa_import TYPE abap_trans_srcbind.
DATA: obj_export TYPE abap_trans_resbind_tab,
wa_export TYPE abap_trans_resbind.
DATA: obj_data TYPE REF TO data.
* Get transformation data
SELECT SINGLE *
INTO wa_transformation
FROM y0dpl_structures
WHERE filetype = i_file_type.
* Create table with internal structure
CREATE DATA e_data TYPE (wa_transformation-structure_name).
wa_import-name = 'IMPORT'.
GET REFERENCE OF i_data INTO wa_import-value.
APPEND wa_import TO obj_import.
* Call transformation
CALL TRANSFORMATION (wa_transformation-transformation)
SOURCE (obj_import)
RESULT (obj_export).
i_data is a import parameter from type "ref to data".
My problem is, that "Call transformation" makes a shortdump when calling them.
Regards,
AntonFound a solution for my problem. Now it works!
DATA: wa_transformation TYPE y0dpl_structures.
DATA: obj_import TYPE abap_trans_srcbind_tab,
wa_import TYPE abap_trans_srcbind.
DATA: obj_data TYPE REF TO data.
DATA: wa_return TYPE bapiret2.
FIELD-SYMBOLS: <data> TYPE ANY TABLE.
* Get transformation data
SELECT SINGLE *
INTO wa_transformation
FROM y0dpl_structures
WHERE filetype = i_file_type.
IF sy-subrc IS INITIAL.
* Create table with internal structure
CREATE DATA e_data TYPE STANDARD TABLE OF (wa_transformation-structure_name).
ASSIGN i_data->* TO <data>.
wa_import-name = 'IMPORT'.
GET REFERENCE OF <data> INTO wa_import-value.
APPEND wa_import TO obj_import.
* Call transformation
CALL TRANSFORMATION (wa_transformation-transformation)
SOURCE (obj_import)
RESULT export_data = e_data.
ELSE.
MOVE: 'Y0_DPL' TO wa_return-id,
'E' TO wa_return-type,
'108' TO wa_return-number.
APPEND wa_return TO e_return.
CLEAR: wa_return.
ENDIF. -
PL/SQL XSLT transformation problem
I am trying to perform an XSLT transformation inside a PL/SQL procedure using dbms_xslprocessor.processxsl() but I am getting the following error 'LPX-00411: unknown function name encountered'
The transformation XSL contains a java extension to preform some encoding of data and with the template containing the reference to the extension removed the transformation works fine. Does this mean that DBMS_XMLPARSER does not support java extensions in XSL or is it possible I'm just calling the function incorrectly?
I have been testing up to now using oraxsl on the command line which seemed to work fine.
Thanks,
AlanAlan,
Are you using the right namespace for the class you want to use? -
Xslt transform problem on Sun AS 8PE
Hi,
I have following xslt:
<xsl:call-template name="CustomerFilter">
<xsl:with-param name="custFilterPath" select="CustomerFilter"/>
</xsl:call-template>
<xsl:template name="CustomerFilter">
<xsl:param name="custFilterPath"/>
<xsl:text>Customer filter: </xsl:text>
<strong>
<xsl:value-of select="$custFilterPath/Type/text()"/> - <xsl:value-of select="$custFilterPath/Name/text()"/>
</strong>
</xsl:template>
I have following xml :
<CustomerFilter id="0" idDb="0">
<Name>All</Name>
<Type>All</Type>
</CustomerFilter>
I perform a server xml-xslt tranform to html using xalan 2.5.2 on tomcat5.0.x server with following code without any errors:
TransformerFactory tf = TransformerFactory.newInstance();
tf.setURIResolver(new ServerURIResolver(server_url));
Transformer t = tf.newTransformer(new StreamSource(stylesheet));
t.setOutputProperty(OutputKeys.INDENT, indenting);
t.setOutputProperty(OutputKeys.ENCODING, encoding);
t.setParameter("server_url", server_url);
t.transform(new DOMSource(response_doc), new StreamResult(response_stream));
But when I deployed the code on Sun App Server Update1 I get following error:
[#|2004-10-25T11:54:48.757+0200|SEVERE|sun-appserver-pe8.0.0_01|javax.enterp
rise.system.container.web|_ThreadID=13;|StandardWrapperValve[xmlgate]:
Servlet.service() for servlet xmlgate threw exception
javax.xml.transform.TransformerException: java.lang.RuntimeException:
Invalid conversion from 'reference' to 'java.lang.String'.
at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:6
44)
at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:3
17)
at
the last line of sample code
This code ran without any problems on Sun AS 7 (with Xalan 2.3.1_01).
I don't know why it's not working. Can anybody help me?
Thank you,
MiroActually Xalan version shipped with AS 8.0 is Xalan 2.5.2 + bugfixes. So it is possible that slightly different version might have gone into Tomcat but i am not sure here.
So it would be good to know, how are you making sure that the same Xalan version is used with AS 8.0 or Tomcat ?
Best Regards -
XML Transformation Problem in JDeveloper 11.1.1.3.0
Friends,
I am trying to transform an XML using an XSL, by a Java program, which uses javax.xml.transform.Transformer.
I have a Java project which has the above program and I have a Web project created, where i have the java project's jar in the WEB-INF/lib. And, when i tried to access the same java program from inside the web project, I am getting the following error:
XML-22000: (Fatal Error) Error while parsing XSL file ({0}).
oracle.jbo.JboException: XML-22000: (Fatal Error) Error while parsing XSL file ({0}).
Code in ServiceAMImpl class:
TransformerFactory factory = TransformerFactory.newInstance();
template =
factory.newTemplates(new StreamSource(AMImpl.class.getClassLoader().getResourceAsStream("text.xsl")));
AMImpl.class.getClassLoader().getResourceAsStream("text.xsl") is returning NULL.
Please help in resolving this error.
Thanks much.Hi,
I figured out the problem. The file was not in correct class path. Now it works fine.
Thanks everyone. -
XML Transformation Problem in JDeveloper 10.1.3
I am trying to transform an XML using an XSL, by a Java program, which uses javax.xml.transform.Transformer.
I have a Java project which has the above said program, where when i run the program, the xml transformation is done successfully.
But I have a Web project created, where i have the java project's jar in the WEB-INF/lib. And, when i tried to access the same java program from inside the web project, I am getting the following error:
XML-22000: (Fatal Error) Error while parsing XSL file (unknown protocol: c).
Please help in resolving this error.This is from Metalink:
Cause
This is caused by a conflict between the Oracle XML parser installed by default in OC4J and the
Xerces parser that the application was developed with. Under 10.1.3 OC4J it is possible to tell OC4J not to use the default XML parser for the application at deployment time.
Solution
1. Undeploy the existing application using AS Console.
2. Start a new deployment of the application in AS Console. Click deploy
3. On the Deploy: Select Archive screen, browse to your deployment war file. Click Next
4. On the Deploy: Application Attributes give the application a name and click next
5. On the Deploy: Deployment Settings screen, click the pencil "Go To Task" Icon for the Configure Class Loading option.
6. Locate the shared library called "oracle.xml" (You may need to click "next 10" one or many times depending on the number of shared libraries you have) . For this row, UNCHECK the box for the column "IMPORT". Click OK
7. Click deploy, then test you application. -
Problem with XSLT Transformation on BPM
Hi there,
I have a 1:N File --> Idocs Scenario with BPM, Inside the BPM i have an XSLT Transformation that has a problem i cant figure out, basically this XSLT Groups the file structure like this:
<File> * <Shipments>
<Route> * <Route>
<Id>1</Id> * <Id>1</Id>
<delivery>1</delivery> * <delivery>1</delivery>
</Route> * <delivery>2</delivery>
<Route> * </Route>
<Id>1</Id> * <Route>
<delivery>2</delivery> * <Id>2</Id>
</Route> * <delivery>3</delivery>
<Route> * <delivery>4</delivery>
<Id>2</Id> * </Route>
<delivery>3</delivery> * </Shipments>
</Route> *
<Route> *
<Id>2</Id> *
<delivery>4</delivery> *
</Route> *
</File> *
It's supposed to generate 1 Route Segment for each disctint Route Id on the Source file, it has always worked fine as we ran several tests before going into production system, but now, sometimes it misses a few routes for example the output will be 25 different Routes for a source file that 28, or 2 routes from a file that as 3.
I have tested the XSLT on the repository and it works fine all the time, same thing when using xml spy, i always download the payload i get from the file adapter, i got a source file from PRD that has 28 routes and i ran the whole scenario on QAS and it generated 12 routes only, im about to open an OSS message but first i wanted to know if anyone has seen something like this, thanks in advance for all the help you guys can provide.
Best Regards,
Roberto.
p.s. i can send the XSL if needed or anything just ask for it.Hi,
Basically because i have to do 2 transformations, first i run the XSLT to group all the deliveries and such, and then i do a graphic mapping to split it into single Shipment Idocs, i dont know how to group by id on graphical mapping..., anyway i don't think the fact that im using BPM would finally alter the xslt result,
Regards,
Roberto. -
XSLT transformation: tamplate match="*" problem
Hi everybody,
I have some stupid problem with XSLT transformations. I use XALAN-J 2.7 to transform xml files. My xslt transformation can be downloaded from http://tesla.rcub.bg.ac.yu/~sing/xsd2rdf.xslt
Problem is when I have in xslt file template defined with (match="*") it does not work. Transformation does not throw any exceptions; it just does not match nodes very well.
Next XML schema can be used as test. So, if you transform this file(schema below) using e.g. XML Spy it will work fine, but if you transform it using JAVA it does not match all nodes. Any suggestions are welcome. Is it problem with XPath standard and XALAN implementation or what???
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.openapplications.org/oagis/CoreComponents/1.90/Types" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cct="http://www.openapplications.org/oagis/CoreComponents/1.90/Types" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="Simple">
<xs:restriction base="xs:integer"/>
</xs:simpleType>
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="cct:Simple">
<xs:attribute name="currencyID" type="xs:integer" use="required"/>
<xs:attribute name="codeListVersionID" type="xs:float" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
Thanks,
Igor.Found a solution for my problem. Now it works!
DATA: wa_transformation TYPE y0dpl_structures.
DATA: obj_import TYPE abap_trans_srcbind_tab,
wa_import TYPE abap_trans_srcbind.
DATA: obj_data TYPE REF TO data.
DATA: wa_return TYPE bapiret2.
FIELD-SYMBOLS: <data> TYPE ANY TABLE.
* Get transformation data
SELECT SINGLE *
INTO wa_transformation
FROM y0dpl_structures
WHERE filetype = i_file_type.
IF sy-subrc IS INITIAL.
* Create table with internal structure
CREATE DATA e_data TYPE STANDARD TABLE OF (wa_transformation-structure_name).
ASSIGN i_data->* TO <data>.
wa_import-name = 'IMPORT'.
GET REFERENCE OF <data> INTO wa_import-value.
APPEND wa_import TO obj_import.
* Call transformation
CALL TRANSFORMATION (wa_transformation-transformation)
SOURCE (obj_import)
RESULT export_data = e_data.
ELSE.
MOVE: 'Y0_DPL' TO wa_return-id,
'E' TO wa_return-type,
'108' TO wa_return-number.
APPEND wa_return TO e_return.
CLEAR: wa_return.
ENDIF. -
Problem getting xslt transform to work
I have the following ABAP Xslt transformation
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl" version="1.0"
>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ALLIR_REIKNINGAR>
<xsl:apply-templates select="//Invoice"/>
</ALLIR_REIKNINGAR>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="Invoice">
<REIKNINGUR>
<REIKN_NUMER>
<xsl:value-of select="cbc:ID"/>
</REIKN_NUMER>
<REIKN_AFRIT>
<xsl:value-of select="cbc:CopyIndicator"/>
</REIKN_AFRIT>
<REIKN_UTGAFUDAGS>
<xsl:value-of select="cbc:IssueDate"/>
</REIKN_UTGAFUDAGS>
<REIKN_MYNT>
<xsl:value-of select="cbc:DocumentCurrencyCode"/>
</REIKN_MYNT>
<REIKN_TIMABIL_FRA>
<xsl:value-of select="cac:InvoicePeriod/cbc:StartDate"/>
</REIKN_TIMABIL_FRA>
<REIKN_TIMABIL_TIL>
<xsl:value-of select="cac:InvoicePeriod/cbc:EndDate"/>
</REIKN_TIMABIL_TIL>
</REIKNINGUR>
</xsl:template>
</xsl:transform>
And the following XML input file
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="vodafone_xslt_namespace.xslt"?>
<Invoice
xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ccts="urn:un:unece:uncefact:documentation:2"
xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0"
xmlns:clm5639="urn:un:unece:uncefact:codelist:specification:5639:1988"
xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001"
xmlns:clm66411="urn:un:unece:uncefact:codelist:specification:66411:2001"
xmlns:clmIANAMIMEMediaType="urn:un:unece:uncefact:codelist:specification:IANAMIMEMediaType:2003"
>
<cbc:UBLVersionID>2.0</cbc:UBLVersionID>
<cbc:CustomizationID>NES</cbc:CustomizationID>
<cbc:ProfileID schemeID="Profile"
schemeAgencyID="NES">urn:www.nesubl.eu:profiles:profile4:ver1.1</cbc:ProfileID>
<cbc:ID>PB1554421</cbc:ID>
<cbc:CopyIndicator>false</cbc:CopyIndicator>
<cbc:IssueDate>2011-12-31</cbc:IssueDate>
<cbc:InvoiceTypeCode listID="UN/ECE 1001 Restricted" listAgencyID="NES">380</cbc:InvoiceTypeCode>
<cbc:Note languageID="IS">Company name</cbc:Note>
<cbc:DocumentCurrencyCode listID="ISO 4217 Alpha">ISK</cbc:DocumentCurrencyCode>
<cbc:AccountingCost>2001523</cbc:AccountingCost>
<cac:InvoicePeriod>
<cbc:StartDate>2011-12-01</cbc:StartDate>
<cbc:EndDate>2011-12-31</cbc:EndDate>
</cac:InvoicePeriod>
</Invoice>
My problem is that this transformation does not work unless I completly strip out the namespace parts i.e. cbc:
How can I get the parser to read the tags with namespace part. And if the parser can not handle namespace in XML how can I go about reding the data into sap ?I think you are trying convert the xml to an internal table because of // in apply-templates, then you need to change last XSLT program and include <item> tag inside the <xsl:template match="inv:Invoice"> template, see updated XSLT bellow.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:inv="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ccts="urn:un:unece:uncefact:documentation:2"
xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0"
xmlns:clm5639="urn:un:unece:uncefact:codelist:specification:5639:1988"
xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001"
xmlns:clm66411="urn:un:unece:uncefact:codelist:specification:66411:2001"
xmlns:clmIANAMIMEMediaType="urn:un:unece:uncefact:codelist:specification:IANAMIMEMediaType:2003"
xmlns:sapxsl="http://www.sap.com/sapxsl"
version="1.0">
<xsl:strip-space elements="*"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ALLIR_REIKNINGAR>
<xsl:apply-templates select="//inv:Invoice"/>
</ALLIR_REIKNINGAR>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="inv:Invoice">
<item>
<REIKNINGUR>
<REIKN_NUMER>
<xsl:value-of select="cbc:ID"/>
</REIKN_NUMER>
<REIKN_AFRIT>
<xsl:value-of select="cbc:CopyIndicator"/>
</REIKN_AFRIT>
<REIKN_UTGAFUDAGS>
<xsl:value-of select="cbc:IssueDate"/>
</REIKN_UTGAFUDAGS>
<REIKN_MYNT>
<xsl:value-of select="cbc:DocumentCurrencyCode"/>
</REIKN_MYNT>
<REIKN_TIMABIL_FRA>
<xsl:value-of select="cac:InvoicePeriod/cbc:StartDate"/>
</REIKN_TIMABIL_FRA>
<REIKN_TIMABIL_TIL>
<xsl:value-of select="cac:InvoicePeriod/cbc:EndDate"/>
</REIKN_TIMABIL_TIL>
</REIKNINGUR>
</item>
</xsl:template>
</xsl:transform>
According to the XSLT program you need dclare an itab like this:
DATA: BEGIN OF ls_reikningur,
reikn_numer(10) TYPE c,
END OF ls_reikningur.
DATA: BEGIN OF ls_invoice,
reikningur LIKE ls_reikningur,
END OF ls_invoice.
DATA: lt_invoice LIKE TABLE OF ls_invoice.
And finally you need a call transformation in your abap code like this:
DATA: root_error TYPE REF TO cx_root.
DATA: lv_mess TYPE string.
TRY.
CALL TRANSFORMATION zinvoice
SOURCE XML lv_xml
RESULT allir_reikningar = lt_invoice.
CATCH cx_root INTO root_error.
lv_mess = root_error->if_message~get_text( ).
WRITE lv_mess.
ENDTRY. -
Error when applying a XSLT transformation
central instance
transaction SURVEY
Extras->Target Group Hierarchy-> Import from file
select file
Error when applying a XSLT transformation
dialog instance workingHello Andrey Kuryanov,
Could make sure you describe the problem more clear as much as you can so that community can help you better.
Please provide more details with more detailed steps and actual error messge.
Thanks
Raja Pamireddy
Moderator -
UTF-8 encoding in XSLT transformation
Hello,
I have a problem with a transformation of an ABAP structure into XML. I use the XSLT transformation for this.
My XSLT starts like this:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="*"/>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
I tried many settings I could find posted on the internet, but I did not find one that would allow encoding to UTF-8.
It always encodes to iso-8859-1 which my interface partner cannot read.
Does anyone know a way to force encoding to UTF-8?
Adding a command like <xsl:output encoding="utf-8"/> did not help.
Thanks a lot!
J. EulerHello!
I think I just solved the problem taking a different approach.
In a note here on SDN, a guy from SAP wrote, that the SAP XSLT processor is not able to code anything but the system's default to a string, BUT that it is able to code it to an xstring.
All I did now is add the tag
<xsl:output encoding="utf-8" indent="yes" method="xml"/>
to my xslt program and change the coding in the program accordingly.
The program code is now:
DATA: tempxstring TYPE xstring,
temp_length TYPE i,
conv TYPE REF TO cl_abap_conv_in_ce.
CLEAR tempxstring.
TRY.
CALL TRANSFORMATION
zxxje_tst_xslt
SOURCE omsregdatawebservice = wa_data
RESULT XML tempxstring.
CATCH cx_sy_conversion_base64.
CATCH cx_sy_conv_illegal_date_time.
ENDTRY.
IF tempxstring IS NOT INITIAL.
CLEAR: conv, temp_length, string_xml_result.
conv = cl_abap_conv_in_ce=>create( input = tempxstring ).
conv->read( IMPORTING data = string_xml_result len = temp_length ).
ENDIF.
Thanks anyways for all your help!
regards,
Johannes Euler -
Hi,
I am trying to upload one xml file and filling an internal table with the content and a XSLT transformation. After uploading the file and make the first transformation i obtein one string with all the fields without tags and separated by #. so when i try to call transformation for filling the internal table i obtein the exception cx_xslt_exception with the message 'No valid source context supplied'.
I would like to know if i am having poroblems with unicode characters. Is there any example made in sap that i can test or does anybody have had any similar problem?.
My string
<?xml version="1.0" encoding="utf-16"?>#######S####L####08##2######
Thanks in advance
regardsHi Verma,
You're not transforming anything from your input to the output shown. You're actually constructing a new Output. I don't see anything being transformed from input to output.
Anyway, if you need a XSLT to be used to get the above Output in map, following XSLT shall help you:
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0" version="1.0" xmlns:s0="http://xmlns.service/1" xmlns:ns1="http://xmlns.types/1.0" xmlns:ns0="http://xmlns.OutService/2">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/s0:Request" />
</xsl:template>
<xsl:template match="/s0:Request">
<Output xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://xmlns.OutService/2">
<outContext xmlns:ns0="http://xmlns.OutService/2" xsi:type="ns0:ReferenceContext" xmlns="http://xmlns.types/1.0" />
</Output>
</xsl:template>
</xsl:stylesheet>
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
XSLT transformation for deep structure .....
Hello,
I am trying to do an XSLT transformation for a deep structure HAP_S_PDF_DOCUMENT (see it in SE11), I have managed to achieve this. but not with perfection. i still get some redundant data and data have been experiencing Data duplication. I was hoping if you people point out the what is wrong in the transfromation. The data repeats for every once under node DATA and then under node of the refered structure name. Besides it also create a blank row even if the record is 0. I am mostly facing problem with nodes T_ELEMENTS. T_COL_CELL and T_FIELD. These are the nested structures, Can anybody help / guide me to achieve these transforamtion?
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="HAP_DOCUMENT">
<xsl:element name="HAP_DOCUMENT" namespace="">
<xsl:apply-templates select="MAIN_HEADER"/>
<xsl:apply-templates select="T_ELEMENTS"/>
<xsl:apply-templates select="T_STAT_CHG_BUTTONS"/>
<xsl:apply-templates select="S_APPRAISAL_ID"/>
<xsl:apply-templates select="S_HEADER"/>
<xsl:apply-templates select="POSITIONS"/>
<xsl:element name="STAT_CHG_BUTTON">
<xsl:value-of select="../STAT_CHG_BUTTON"/>
</xsl:element>
<xsl:element name="OFFLINE_ID">
<xsl:value-of select="OFFLINE_ID"/>
</xsl:element>
<xsl:element name="BSP_FLAG">
<xsl:value-of select="BSP_FLAG"/>
</xsl:element>
<xsl:element name="ROLE">
<xsl:value-of select="ROLE"/>
</xsl:element>
<xsl:element name="APPRAISAL_YEAR">
<xsl:value-of select="APPRAISAL_YEAR"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="MAIN_HEADER">
<xsl:element name="MAIN_HEADER">
<xsl:for-each select="ZBGAPR_FORM_HEADER">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_ELEMENTS">
<xsl:element name="T_ELEMENTS">
<xsl:for-each select="ZHAP_S_PDF_ELEMENTS">
<xsl:element name="DATA">
<xsl:apply-templates select="T_COL_CELL"/>
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_COL_CELL">
<xsl:element name="T_COL_CELL">
<xsl:for-each select="ZHAP_S_PDF_COL_CELL">
<xsl:element name="DATA">
<xsl:apply-templates select="T_FIELD"/>
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_FIELD">
<xsl:element name="T_FIELD">
<xsl:for-each select="ZHAP_S_PDF_FIELD">
<xsl:element name="DATA">
<xsl:apply-templates select="T_VAL_VALUES"/>
<xsl:apply-templates select="T_VAL_RANGES"/>
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_VAL_VALUES">
<xsl:element name="T_VAL_VALUES">
<xsl:for-each select="HAP_S_BODY_CELL_VAL_VALUES">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_VAL_RANGES">
<xsl:element name="T_VAL_RANGES">
<xsl:for-each select="HAP_S_BODY_CELL_VAL_RANGES">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_STAT_CHG_BUTTONS">
<xsl:element name="T_STAT_CHG_BUTTONS">
<xsl:for-each select="HAP_S_BODY_CELL_VAL_RANGES">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="S_APPRAISAL_ID">
<xsl:element name="S_APPRAISAL_ID">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="S_HEADER">
<xsl:element name="S_HEADER">
<xsl:apply-templates select="S_TEXTS"/>
<xsl:apply-templates select="T_APPRAISER"/>
<xsl:apply-templates select="T_APPRAISEE"/>
<xsl:apply-templates select="T_PART_APPRAISER"/>
<xsl:apply-templates select="T_OTHERS"/>
<xsl:apply-templates select="S_STATUS"/>
<xsl:apply-templates select="S_DATES"/>
<xsl:apply-templates select="S_DISPLAY"/>
</xsl:element>
</xsl:template>
<xsl:template match="POSITIONS">
<xsl:element name="POSITION">
<xsl:for-each select="ZBGHR_APR_POSITION_DET">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="S_TEXTS">
<xsl:element name="S_TEXTS">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="T_APPRAISER">
<xsl:element name="T_APPRAISER">
<xsl:for-each select="HAP_S_PDF_APPRAISER">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_APPRAISEE">
<xsl:element name="T_APPRAISEE">
<xsl:for-each select="HAP_S_PDF_APPRAISEE">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_OTHERS">
<xsl:element name="T_OTHERS">
<xsl:for-each select="HAP_S_PDF_OTHERS">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_PART_APPRAISER">
<xsl:element name="T_PART_APPRAISER">
<xsl:for-each select="HAP_S_PDF_PART_APPRAISERS">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="T_PART_APPRAISER">
<xsl:element name="T_PART_APPRAISER">
<xsl:for-each select="HAP_S_PDF_PART_APPRAISERS">
<xsl:element name="DATA">
<xsl:copy-of select="child::node()"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="S_STATUS">
<xsl:element name="S_STATUS">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="S_DATES">
<xsl:element name="S_DATES">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="S_DISPLAY">
<xsl:element name="S_DISPLAY">
<xsl:copy-of select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="STAT_CHG_BUTTON">
</xsl:template>
<xsl:template match="OFFLINE_ID">
</xsl:template>
<xsl:template match="BSP_FLAG">
</xsl:template>
<xsl:template match="ROLE">
</xsl:template>
<xsl:template match="APPRAISAL_YEAR">
</xsl:template>
</xsl:transform>
Regards,
Shishir.P"XSLT transformation for a deep structure"
which way abap to xml or xml to abap?
you may want to check this thread
Re: Problem converting XML back to structure using XSLT -
XSLT Transformation error: Non-canonical structure of element name
Good day experts,
I have recently started using xslt, and came upon the following demo in the sdn.
http://wiki.sdn.sap.com/wiki/display/ABAP/XMLXSLTwith+ABAP
I have retrieved the example xml files from airplus.com, as per the instructions, and implemented the code.
When I test the xslt transformation in se80, it transforms correctly.
However, when I run the program, I get the following error.
CX_XSLT_FORMAT_ERROR
Transformation error: Non-canonical structure of element name XML_OUTPUT
Is there an error in the example that I am not aware of?
Thanks in advance,
Johan KriekFound the solution.
You rename the tag <XML_OUTPUT> to anything else like <TEST>. And Hurray!!! it works.
It looks like SAP is using this name internally somewhere so we are getting error when we are using same name.
Anyways the problem is solved.
Regards,
Jai -
I'm having a problem with xslt transformations.
I'm sending a DOMDocument to be transformed into a varchar2. The transformation was into html and I was then printing the returning varchar2 to a web page, along the lines of...
htp.prn(Xslt.transform(domdoc, xslt.stylesheet( l_stylesheet_bfile)));
I subsequently broke the varchar2 32k limit so I started playing with transforming into a dom instead of a varchar, then writing the dom to a clob and the printing the clob to the web page in 32k chunks.
I noticed this produced different results than the first method. Now I'm assuming that this is not because xslt is doing the transformations differently but because it's trying to put my html into a well-formed DOMdocument. I have noticed, though, that things like & #160; seemed to have disappeared.
Just wondering if I'm doing something wrong, and also any reason why the transform functionality doesn't have an output option of CLOB?
Thanks
JasonWhat is the DB version?
Maybe you are looking for
-
Hi Experts, When I wanted the end users to have access to a Rule, I'm used to add the rule name to the endUserAccess Attributes in the SystemConfiguration object. And it works fine. But the FAQ page in Sun IDM partner space says that if you specify u
-
Problem with commit flag with RH_PNNNN_MAINTAIN
Hi, i'm using RH_PNNNN_MAINTAIN in this way: call function 'RH_PNNNN_MAINTAIN' exporting act_fcode = 'INSE' act_otype = lw_plog-otype act_objid = lw_p
-
Files with ".jdb.bup.1" extension
Hi All, On our production environment I have found too many files (but not all) with ".jdb.bup.1" extension. Does it has any relationship with BDBJE? BR, /César. Edited by: Cesar Alvarez on 22-dic-2010 21:07
-
CS4 Premiere Pro_How to Zoom out/in on stills?
I have stills (still jpeg images) in my timeline and I want to create the effect of zooming in or out of them (like they were video and not stills). How do I do this in Adobe Premiere CS4? Thank you-please help.
-
Error message when trying to link files. Xinet?
"Error: Unable to report an error [Exception Code}! Please report this to Xinet technical support." This is what one of our users is getting when attempting to link files from an InDesign job on her machine. We have no idea what this is (Xinet?). Any