XSLT debugging
Does JDeveloper provide any debugging capability to debug
XSL Transformation? Any support on XSLT 2.0??
--Nimchi
Thanks for the link.
Any idea when Oracle will have support for XSLT 2.0?
--Nimchi
Similar Messages
-
Debugging XSLT of Business Data List web part in SPD 2013
I am working on a Business Data List web part in SPD 2013. I want to customize that complex XSLT that got generated by the web part. It will be really helpful, if I can debug that XSLT. But I am not sure, how to debug XSLT from SPD? If at all, I need to
debug through Visual Studio also, I need the XML also, which I don't have. Can anyone please help?Hi Ven,
XSLT debugging , I have never heard abt it. Its like UI design and you modify it and test it in Browser. Thats the only way.
one such sample is http://msdn.microsoft.com/en-us/library/cc300164(v=office.12).aspx
Please remember to click 'Mark as Answer' on the answer if it helps you -
XSLT Debugger is disabled in Visual Studio 2013 Integrated Shell
According to this link, the Visual Studio 2013 Integrated Shell contains an XSLT Debugger:
https://msdn.microsoft.com/en-us/library/bb129445.aspx?f=255&MSPPError=-2147217396
I installed this version clean on a machine that has no prior Visual Studio installs.
When I launch this version of Visual Studio, and open an xsl file for debugging, the 'Start XSLT Debugging' option is grayed out / disabled.
How do I enable XSLT Debugging?
Thanks,
--garHi,
You issue can be reproduce in my Visual Studio 2013 Integrated Shell as well. I think you can submit one feedback about this issue on Microsoft connect site:https://connect.microsoft.com/
Thanks.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Should not create any output file when transform with xslt file
I have a xslt file, which I have make code to check the order status value.
If OrderStatus != 'Reject' --> create attribute, element for output file
Else OrderStatus = 'Reject' --> do not create attribute/element ==> output is the empty file.
Requirement: if OrderStatus = 'Reject' --> do not create any output file.
how to do with this requirement?
any help will be appreciated!Do you mean the xslt file always return the output file?
I have tested this xslt file following (only xslt file, not run in BizTalk project):
Create a blank console application using visual studio and add attached xslt file to newly created console app. Next open the XSLT file and select input file and output files and start xslt debugging to create output file.
I want to edit the xslt file how to cannot create output file in the case OrderStatus = Reject.
I don't say in particualr xslt file, its actually your map as a whole that returns a output message on successful execution.
since you are testing the xslt file as individual file, you are able to control it as per need. i mean you can write incomplete code or any kind of output elements that are not present even in schema. But when you set the map properties to use external
xslt , map completely relies on xslt and xslt has to produce output that matches the output schema structure.
So you better test your xslt by setting it to your map. Once you set map properties to use xslt, you can test your map by right clicking on map and choosing test map.
Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
Hi All,
Please share your experience on this.
1. Is there any XSLT debugging feature available as part of FMW?
2. Are there other Oracle owned proprietary tools which are capable of doing XSLT debugging?
3. Are there any open source XSLT debuggers which could do a good job? I got a couple from online, but the features are not rich.
4. What are some of the best external tools available for xslt debugging?
Appreciate your help.I can provide answer for first one.
1. There is XSLT test function available inbuild in Jdev, you can right click on any XSL map and test right there, it will also create source xml file if you don't have one.
- On JDev extension there is also XML or XPATH query for quick testing if XPATH is valid or not. -
Server Error in '/' Application.
Unable to ExecuteModuleActionURI : Module/Jobs/Controller/Applications/Action/Apply/JobID/915337
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Unable to ExecuteModuleActionURI : Module/Jobs/Controller/Applications/Action/Apply/JobID/915337
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Exception: Unable to ExecuteModuleActionURI : Module/Jobs/Controller/Applications/Action/Apply/JobID/915337]
BiteCMF.Util.Xsl.ExtensionObjects.BiteExtensionObject.ExecuteModuleActionURI(String moduleActionURI, String location) in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\Util\XSL\ExtensionObjects\BiteExtensionObject.cs:63
[XslTransformException: An error occurred during a call to extension function 'ExecuteModuleActionURI'. See InnerException for a complete description of the error.]
System.Xml.Xsl.Runtime.XmlExtensionFunction.Invoke(Object extObj, Object[] args) +1292307
System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) +806
<xsl:template match="Job">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, String URL) +20724
<xsl:template match="ViewData">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current) +152
<xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator ) +806
Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) +55
System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter) +150
System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) +88
System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, Stream results) +89
BiteCMF.Util.Xsl.BiteXsl.Transform(XmlDocument xmlToTransform) in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\Util\XSL\BiteXSL.cs:216
BiteCMF.Util.Xsl.BiteXsl.Transform(XmlDocument xmlToTransform, String xslUrl) in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\Util\XSL\BiteXSL.cs:182
BiteCMF.Modules.ViewActionResult.ToString(BiteRequestBroker requestBroker) in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\Modules\ViewActionResult.cs:166
BiteCMF.Modules.ViewActionResult.Process(BiteRequestBroker requestBroker) in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\Modules\ViewActionResult.cs:255
BiteCMF.Modules.CMS.CMSRequestBroker.ProcessRequestAsFrontend() in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\Modules\CMS\CMSRequestBroker.cs:221
BiteCMF.Modules.CMS.CMSRequestBroker.HandleRequest() in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\Modules\CMS\CMSRequestBroker.cs:45
BiteCMF.CMS.BiteRequestBroker.ExecuteModuleBrokers() in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\CMS\BiteRequestBroker.cs:165
BiteCMF.CMS.BiteRequestBroker.ProcessRequest() in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\CMS\BiteRequestBroker.cs:83
BiteCMF.BiteHttpModule.ProcessRequest(HttpApplication app) in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\BiteHttpModule.cs:192
BiteCMF.BiteHttpModule.Application_PostAcquireRequestState(Object source, EventArgs e) in C:\Users\mbailey.REDANT\Desktop\Projects\Changeboard\BiteCMF\BiteHttpModule.cs:164
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5456http://ww2.cs.fsu.edu/~rosentha/linux/2.6.26.5/docs/DocBook/libata/ch07.html#excatATAbusErr wrote:
ATA bus error means that data corruption occurred during transmission over ATA bus (SATA or PATA). This type of errors can be indicated by
ICRC or ABRT error as described in the section called “ATA/ATAPI device error (non-NCQ / non-CHECK CONDITION)”.
Controller-specific error completion with error information indicating transmission error.
On some controllers, command timeout. In this case, there may be a mechanism to determine that the timeout is due to transmission error.
Unknown/random errors, timeouts and all sorts of weirdities.
As described above, transmission errors can cause wide variety of symptoms ranging from device ICRC error to random device lockup, and, for many cases, there is no way to tell if an error condition is due to transmission error or not; therefore, it's necessary to employ some kind of heuristic when dealing with errors and timeouts. For example, encountering repetitive ABRT errors for known supported command is likely to indicate ATA bus error.
Once it's determined that ATA bus errors have possibly occurred, lowering ATA bus transmission speed is one of actions which may alleviate the problem.
I'd also add; make sure you have good backups when ATA errors are frequent -
Error encountered while executing the transform
My message failed at orchestration with the following error. Kindly help in finding the issue.
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Ibox.UNEDIFACT.CODECO.Orchestration.CodecoDownload(df91e55f-c6aa-914d-f042-acdb45bdcaf4)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: cc8fac84-47dc-4d31-be15-80c9f86ffaac
Shape name: CodecoMapping
ShapeId: 32b0a92d-82f7-4b3a-8e22-a94b53bf2804
Exception thrown from: segment 1, progress 22
Inner exception: Error encountered while executing the transform Ibox.UNEDIFACT.CODECO.Orchestration.CodecoMap. Error:Transformation failed..
Exception type: XTransformationFailureException
Source: Microsoft.XLANGs.Engine
Target Site: Void ApplyInMemoryTransform(System.Type, Microsoft.XLANGs.RuntimeTypes.TransformMetaData, System.Object[], System.IO.Stream[])
The following is a stack trace that identifies the location where the exception occured
at Microsoft.XLANGs.Core.Service.ApplyInMemoryTransform(Type mapRef, TransformMetaData trfMetaData, Object[] outParams, Stream[] inStreams)
at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
at Ibox.UNEDIFACT.CODECO.Orchestration.CodecoDownload.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Additional error information:
Exception has been thrown by the target of an invocation.
Exception type: TargetInvocationException
Source: mscorlib
Target Site: System.Object InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
The following is a stack trace that identifies the location where the exception occured
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.XLANGs.BaseTypes.CompiledXsltWrapperTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver resolver)
at Microsoft.XLANGs.BaseTypes.CompiledXsltWrapperTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, Stream output, XmlResolver resolver)
at Microsoft.XLANGs.Core.Service.ApplyInMemoryTransform(Type mapRef, TransformMetaData trfMetaData, Object[] outParams, Stream[] inStreams)
Additional error information:
Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added.
Exception type: XslTransformException
Source: System.Data.SqlXml
Target Site: Void ThrowInvalidStateError(System.Xml.XPath.XPathNodeType)
The following is a stack trace that identifies the location where the exception occured
at System.Xml.Xsl.Runtime.XmlQueryOutput.ThrowInvalidStateError(XPathNodeType constructorType)
at System.Xml.Xsl.Runtime.XmlQueryOutput.ConstructInEnumAttrs(XPathNodeType rootType)
at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartAttribute(String prefix, String localName, String ns)
at <xsl:template name="compiler:generated"> (36)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {http://schemas.microsoft.com/BizTalk/2003/var}var:v237,
Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v239, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v240, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v242, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v244,
Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v246, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v248, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v250, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v252,
Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v255, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v256, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v258, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v259,
Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v261, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v262, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v264, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v265,
Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v267, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v268, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v271, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v272,
Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v281, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v283, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v284, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v286,
Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v287, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v289, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v290, Boolean {http://schemas.microsoft.com/BizTalk/2003/var}var:v292,
String {http://schemas.microsoft.com/BizTalk/2003/var}var:v295)
at <xsl:template name="compiler:generated"> (12)(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
at <xsl:template match="/s2:Root">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
at <xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)Hi,
It is clearly an issue in your map. You can test your map out of Orchestration to make sure it is working.
"Exception has been thrown by the target of an invocation" is a very generic exception. you
need the inner exception to see the actual error. You can also try to test the map in the MapTester tool. It also shows also the inner exception. It's designed for BizTalk 2010 but with the .exe file you maybe also can test BizTalk 2006 maps,.
http://code.msdn.microsoft.com/Execute-a-BizTalk-map-from-26166441
If this answers your question please mark as answer. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
Hello,
I am getting issue in BPEL code while executing XSLT file. If I have performed the 10 mappings in XSLT file and one of them has error in assigning source to target values. Its just mentioned that following XSLT file has error and doesn't mention the exact line where the error has been occured.
Any best way to debug XSLT so it can provide the exact error ?
ThanksYes, It is the part of BPEL. But I am using Oracle SOA 10 g. Can you please elaborate how can I debug the XSLT is BPEL using BPEL Console in 10g ?? Actually when I am getting issue in XSLT, it's hard to find out where I am having the problem. If I am performing more than 20 transformation in XSLT file it's impossible for me to highlight the exact line where I have an issue.
Thanks -
Now I use XSLT to transform xml.I meet many problem.I can't find a best way to debug my program.
who can help me? thanks.A lot of people use XMLSpy, I hear.
-
How to debug AIA XSLT transformation in Jdeveloper ?
Hi AIA forum members,
I need to Test and debug an AIA XSL transformation. Can i use Jdeveloper to do this ?
I understand that we can test by right clicking and using the "Test" option but then again it fails while processing the XSL as it is unable to execute lookupXRef, lookupDVM and also is not able to recognise the oracle xpath extension functions.
Rgds,
VikHi Vik,
If you are on 10g, I suggest you run a search on Metalink for AIA Jdeveloper Patch download. Install the patch for Jdeveloper on windows and then you should be able to test the XSLs.
If its on 11g, am not sure, as I have just started looking for that patch.
Cheers,
- AR -
Hi ALL,
I am using i scinario in my project of type IDOC to PI to SOAP . In this one my mapping is of type ABAP-XSLT . the interface is runnign fine for all the idocs except one idoc. When that particula idoc comming from r/3 it is giving short dump and the message is staying at queue as scheduled. When i am trying to reprocess the message it is giving the same dump. In the ST22 t code it is saying the XSLT_RUNTIME_ERROR and the error is XSLT "xxxx"program was termintaed scince it encounterd a statement that could not be executed. I tried to monitor the trace for the both successful messages on the same inteface. But the both the traces are same it seems. what could be the reason how to eliminate.
Regards,
RamaHi,
I think there is an option to debug the XSLT programs that are generated using call transformation command:
http://help.sap.com/saphelp_nw70/helpdata/en/07/88273c3f2b3c7ce10000000a11402f/content.htm
Can you try debugging the XSLT program?
Also check if there are any invalid characters like angled braces, ampersands etc in your IDOC data.
It might sometimes create issues.
Regards,
Ravi kanth Talagana -
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" -
Hi-
I'm trying to use the latest Xercies/Xalan classes in OC4J 10.1.3 as described in the How-To swap XML Parsers document:
http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html
What I can see happening is that the oracle.xml shared library is successfully 'turned off', but the xalan libraries are not added. Instead, the default xml classes that are distributed with the JDK become visible. For instance, using a slightly modified version of the index.jsp page from the how-to, I get this result:
------ Output from JSP page ----------------
TransformerFactory Instance: org.apache.xalan.processor.TransformerFactoryImpl
Transformer Instance: org.apache.xalan.transformer.TransformerIdentityImpl
Transformer Version: Xalan Java 2.4.1 (!!)
What I expect is for that last line to say version 2.7.0, which is the version of the xalan.jar included in my shared library (code to add that line to the how-to shown below).
I suspect what is happening is that the class loader is simply not letting a shared library override a system library - to do that you probably need to place the jar files in system endorsed directory.
Has anyone gotten this how-to to work - actually replacing the XML parser/transform classes with the latest Xalan classes? Are you sure it is seeing the current version you placed in the shared library?
Thanks,
Eric Everman
---- My modified getXSLTDetails() method in the index.jsp page of the how-to -------
<!-- Additional Import -->
<%@ page import="org.apache.xalan.Version" %>
public static String getXSLTDetails()
Transformer transformer=null;
TransformerFactory transformerfactory = TransformerFactory.newInstance();
Version ver = null;
String br = "<" + "br" + ">"; //otherwise the otn forum chocks on the break.
try
transformer = transformerfactory.newTransformer();
ver = (Version) transformer.getClass().forName("org.apache.xalan.Version").newInstance();
String ret_val =
"TransformerFactory Instance: "+transformerfactory.getClass().getName() + br +
"Transformer Instance: "+transformer.getClass().getName() + br;
if (ver != null) {
ret_val = ret_val + "Transformer Version: " + ver.getVersion() + br;
} else {
ret_val = ret_val + "Transformer Version not Available" + br;
return ret_val;
catch (Exception e)
e.printStackTrace();
return e.getMessage();
}--------------------------------------------------------------------Steve - Thanks for responding on this.
The Xalan SQL extension is built into Xalan. The most painless way to try it out is to run it via JEdit: www.jedit.org
JEdit a OS Java application with a fairly painless install process (I'm assuming you already have a current JRE installed). Once its installed, you'll need to install the XSLT plugin - in JEdit goto Plugins | Plugin Manager | Install and pick the XSLT plugin. You'll need the Oracle JDBC classes on your classpath - this can be done by copying the oracle_jdbc4.jar into the [JEdit install directory]/jars directory.
Restart to load that jar and you should be all set.
I included a sample XSLT page at the bottom of this post that is somewhat of a template transform for the SQL extension - its more complicated then it needs to be, but it does some nice things with the results of the query. Save it as a file and make the appropriate changes to the 'datasource' parameter near the top of the file.
Then in JEdit, open the file and make sure the XSLT plugin is visible (Plugins | XSLT | XSLT Processor Toggle - or alternately dock it in the window via global prefs). In the XSLT plugin: Allow the current buffer to be used as the source, Add that same file as a stylesheet via the '+' button, and pick a result file at the bottom. Then click the 'Transform XML' button.
Troubleshooting: I seem to remember having some classpath errors when I tried this on windows, but others have had it work w/o issues. I do remeber that the XSLT plugin had a popup window that gave a pretty good explaintion of the problem, if it occurs. Also, for some reason the XSLT plugin will not create a new file for the output, so its often best to create a file first, then choose it as the output. Of course, you can always run a transformation from the command line or w/in an applicatoin. Full docs on the Xalan SQL extension can be found at: http://xml.apache.org/xalan-j/extensionslib.html#sql
Here is my sample XSLT transform using the SQL extension:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://xml.apache.org/xalan/sql"
xmlns:str="http://exslt.org/strings"
xmlns:xalan="http://xml.apache.org/xalan"
extension-element-prefixes="sql str xalan">
<xsl:output indent="yes"/>
<xsl:param name="driver">oracle.jdbc.OracleDriver</xsl:param>
<xsl:param name="datasource">jdbc:oracle:thin:jqpublic/jqpublic@server_name:1521:dbname</xsl:param>
<xsl:param name="jndiDatasource"><!-- jndi source for production use w/in enterprise environment --></xsl:param>
<xsl:param name="debug">true</xsl:param>
<xsl:variable name="connection" select="sql:new()"/>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
<!--
The query: You could pass parameters in to this query to build a where clause, but here is a simple example.
Also, its nice to wrap the query with a max row number to prevent huge results.
-->
<xsl:param name="query">
select * from (
SELECT
'One' FIELD_1,
'Two' FIELD_2
FROM DUAL
) where rownum < 100
</xsl:param>
<!-- Essentially, create a XConnection object -->
<xsl:variable name="connection" select="sql:new()"/>
<xsl:template match="/">
<xsl:choose><!-- Connect using JNDI -->
<xsl:when test="$jndiDatasource != ''">
<xsl:if test="not(sql:connect($connection, $jndiDatasource))">
<xsl:message>Failed to connect to db via jndi connection</xsl:message>
<xsl:comment>Failed to connect to db via jndi connection</xsl:comment>
<xsl:if test="$debug = 'true'">
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
</xsl:if>
</xsl:when>
<xsl:otherwise><!-- Connect using connection string -->
<xsl:if test="not(sql:connect($connection, $driver, $datasource))">
<xsl:message>Failed to connect to db via driver/url connection</xsl:message>
<xsl:comment>Failed to connect to db via driver/url connection</xsl:comment>
<xsl:if test="$debug = 'true'">
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<!--
The results of the query. The rowset is brought back in 'streaming' mode,
so its not possible to ask it for the number of rows, or to check for zero
rows. There is a switch to disable streaming mode, but this requires all
rows to be brought into memory.
-->
<xsl:variable name="table" select="sql:query($connection, $query)"/>
<xsl:if test="not($table)">
<xsl:message>Error in Query</xsl:message>
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
<page>
<!-- Your xalan environment -->
<xsl:copy-of select="xalan:checkEnvironment()"/>
<!-- Build a bunch of metadata about the rows -->
<meta>
<cols>
<xsl:apply-templates select="$table/sql/metadata/column-header"/>
</cols>
</meta>
<rowset>
<!--
With streaming results, you must use the apply-temmplates contruct,
not for-each, since for-each seems to attempt to count the rows, which
returns zero.
-->
<xsl:apply-templates select="$table/sql/row-set"/>
</rowset>
</page>
<xsl:value-of select="sql:close($connection)"/><!-- Always close -->
</xsl:template>
<xsl:template match="row">
<row>
<xsl:apply-templates select="col"/>
</row>
</xsl:template>
<xsl:template match="column-header">
<col>
<xsl:attribute name="type">
<xsl:value-of select="@column-typename"/>
</xsl:attribute>
<xsl:attribute name="display-name">
<xsl:call-template name="create-display-name"/>
</xsl:attribute>
<xsl:value-of select="@column-name"/>
</col>
</xsl:template>
<!-- Convert column names to proper caps: MY_FIELD becomes My Field -->
<xsl:template name="create-display-name">
<xsl:variable name="col-name">
<xsl:for-each select="str:tokenize(@column-name, '_')">
<xsl:value-of
select="concat(translate(substring(., 1, 1), $lowercase, $uppercase), translate(substring(.,2), $uppercase, $lowercase), ' ')"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="substring($col-name, 1, string-length($col-name) - 1)"/>
</xsl:template>
<!-- Creates data columns named 'col' with a column-name attribute -->
<xsl:template match="col">
<col>
<xsl:attribute name="column-name"><xsl:value-of select="@column-name"/></xsl:attribute>
<xsl:value-of select="."/>
</col>
</xsl:template>
</xsl:stylesheet> -
ABAP XSLT transformation - XML to deep structure/nested standard table
Hi all,
I was struggling with this topic recently and couldn't find a single working example or description of a possible solution. So now that I've sorted it out, I did a quick example to elustrate how it works. Here is the code with XML embeded in it and the XSLT follows:
<HR>
<PRE>
*& Report Z_XML2ABAP
*& Author: Jayanta Roy
*& Date: 03/02/2010
REPORT z_xml2abap.
DATA input_xml TYPE string.
TYPES: BEGIN OF t_address,
house_no TYPE string,
street_name TYPE string,
city_name TYPE string,
phone_no TYPE string,
END OF t_address.
TYPES: t_addresses TYPE STANDARD TABLE OF t_address with NON-UNIQUE KEY house_no.
TYPES: BEGIN OF t_person,
firstname TYPE string,
surname TYPE string,
addresses TYPE t_addresses,
END OF t_person.
input_xml = '<Friends>' &&
'<People>' &&
'<FirstName>Homer</FirstName>' &&
'<Surname>Simpson</Surname>' &&
'<Address>' &&
'<HouseNo>123</HouseNo>' &&
'<Street>Evergreen Terrace</Street>' &&
'<City>Springfield</City>' &&
'<PhoneNo>011212321</PhoneNo>' &&
'</Address>' &&
'<Address>' &&
'<HouseNo>7G</HouseNo>' &&
'<Street>Neuclear Power Plant</Street>' &&
'<City>Spring Field</City>' &&
'<PhoneNo>911</PhoneNo>' &&
'</Address>' &&
'</People>' &&
'<People>' &&
'<FirstName>Bart</FirstName>' &&
'<Surname>Simpson</Surname>' &&
'<Address>' &&
'<HouseNo>123x</HouseNo>' &&
'<Street>Evergreen Terracex</Street>' &&
'<City>Springfieldx</City>' &&
'<PhoneNo>011212321x</PhoneNo>' &&
'</Address>' &&
'</People>' &&
'</Friends>' .
DATA lt_person TYPE STANDARD TABLE OF t_person.
TRY.
CALL TRANSFORMATION xslt_person
SOURCE XML input_xml
RESULT all_people = lt_person.
CATCH cx_root.
WRITE 'Problemo!'.
ENDTRY.
WRITE 'Now, debug the program to see the values read from the XML'.
</PRE>
<HR>
and here is the XSLT Transformation program (xslt_person):
<HR>
<PRE>
<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>
<ALL_PEOPLE>
<xsl:apply-templates select="//People"/>
</ALL_PEOPLE>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="People">
<ALLMYFRIENDS> <!This element name is not relevent... needed to just group the loop>
<FIRSTNAME>
<xsl:value-of select="FirstName"/>
</FIRSTNAME>
<SURNAME>
<xsl:value-of select="Surname"/>
</SURNAME>
<ADDRESSES>
<xsl:for-each select="Address">
<ADDRESS> <!This element name is not relevent... needed to just group the loop>
<HOUSE_NO>
<xsl:value-of select="HouseNo"/>
</HOUSE_NO>
<STREET_NAME>
<xsl:value-of select="Street"/>
</STREET_NAME>
<CITY_NAME>
<xsl:value-of select="City"/>
</CITY_NAME>
<PHONE_NO>
<xsl:value-of select="PhoneNo"/>
</PHONE_NO>
</ADDRESS>
</xsl:for-each>
</ADDRESSES>
</ALLMYFRIENDS>
</xsl:template>
</xsl:transform>
</PRE>
<HR>
HTH,
Jayanta.thanks a LOT Jayanta..
I was looking for an XSLT example for some time.. this one atleast got me started in the right direction..
THANKS -
Hi,
Can I use a UDF in XSLT mapping. If yes, can anyone please guide me in the issue. When I searched the forum there is a discussion related to the attachment of Java classes to the XSLT mapping. Does this replace the use of a UDF ? Instead, can we opt for a Java Mapping. Which will be of more help? Kindly suggest your opinions with relevant explanation. Thank you very much for your time.
Krishna.Hi krishna,
check this links
http://www.topxml.com/rbnews/XML/re-55178_Remove-empty-nodes-in-BizTalk-by-using-XSLT.aspx
http://www.topxml.com/rbnews/XML/re-55176_XSLT-performance-when-mapping-large-documents-in-BizTalk.aspx
http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/frameset.htm
XI: New features in SP14
http://help.sap.com/saphelp_nw2004s/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm
How to parse "XX/YY/ZZ;AA/BB/CC;11/22/33" in message mapping.
What is UDF
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd
Java Mapping (Part I)
Difference in using java,xslt,message mapping
Java Mapping (Part I)
Java Mapping (Part II)
Java Mapping (Part III)
Testing and Debugging Java Mapping in Developer Studio
Using JAXP to both parse and emit XML in XI Java mapping programs
"JAVA MAPPING", an alternate way of reading a CSV file
Think objects when creating Java mappings
Regards
srinivas
Maybe you are looking for
-
My ipod touch will only charge on my computer. What should I do?
I have an iPod touch 3rd generation 32GB with iOS 4.3.3 that will charge and sync on my computer. But if it is plugged into a wall, car, or dock charger it will not charge. I believe it is a software problem because it works on the computer. I have a
-
Suppress the Page Header section on a specific Section
Hello, I have a single page word document I want to append to the end of a report I have, so I placed it in Report Footer b. The word document fits perfectly on a single page without any header. I tried simply supressing the Page Header on the last p
-
Is this a flash issue or can I force this game to run in the background somehow.
-
My iPod touch is running on iOS 6 and when is searching for wifi it doesn't find anything and my friend has the same iPod and his works
-
I need help opening attachments in e-mail of the xps format.
Received email with 3 attachments of xps format ( not pdf). I can not open them. They are of a business nature and of significant importance. I have: IOS 7.1, retina display, 32 gigs. Any help would be appreciated. Thanks.