XSL Transformation - cut asx:abap and asx:values
Hey all,
I'm using a XSL Transformation to create a XML-File from an internal table.
My problem is, that the transformation automatically puts the two tags "<asx:abap xmlns:asx="http://www.sap.com/abapxml">" and "<asx:values>" at the beginning of my file (or string):
<?xml version="1.0" encoding="iso-8859-1" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<ROOT>
</ROOT>
</asx:values>
</asx:abap>
Does anyone have any idea how I can easily suppress these lines?
The best course would be of course an XSL statement.
Thanks and regards,
Martin.
Will using a Simple Transformation help your case ?
Similar Messages
-
XSL Transform, double-byte characters and padding
I have a stylesheet with the following variable that is being formatted to pad a parameter named textQualifierDescription to a length of 30 by calling the template called format-string.
<xsl:variable name="textQualifierDescription2">
<xsl:call-template name="format-string">
<xsl:with-param name="myString" select="$textQualifierDescription"/>
<xsl:with-param name="numbatchspaces">30</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:template name="format-string">
<xsl:param name="myString" select="' ' "/>
<xsl:param name="numbatchspaces" select="20"/>
<xsl:param name="direction" select="right"/>
<xsl:variable name="spacesstr" select="string(' ')"/>
<xsl:variable name="padsize" select="$numbatchspaces -string-length($myString)"/>
<xsl:variable name="spacepad" select="substring($spacesstr, 1, $padsize)"/>
<xsl:choose>
<xsl:when test="$direction = 'left'">
<xsl:value-of select="concat($spacepad,$myString)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($myString,$spacepad)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>I execute the xsl transform using the following statement in a stored procedure:
transformedData := xmldata.transform(xsldata);The xsl transform works as expected until it encounters data that contains double-byte characters. My output is supposed to contain the following three fields as a single record
textQualifierDescription - padded to a length 30
lineNumber
id
If my textQualifierDescription contains a value of "Texto de posición"
Line 1 - Texto de posición 00000001POS2005
Line 2 - Texto de posición 00000001POS2005
Line 1 is the expected result.
Line 2 is the actual result. When the "format-string" function is called and even though "Texto de posición" is 17 characters in length, it looks as if oracle counts the double-byte character as 2 and calculates the string-length as 18 to come up with a padsize of 12. It then creates a spacepad of 12 spaces which is then concatenated to the 17 characters for a total length of 29. I have tested the stylesheet in xmlspy and it produces the expected result.
Has anyone ever run into this sort of situation and is able to provide me with some sort of solution to this dilemma? This is running on 10g Release 10.2.0.4.0.Your searches should have also come up with the fact that CR XI R2 is not supported in .NET 2008. Only CR 2008 (12.x) and Crystal Reports Basic for Visual Studio 2008 (10.5) are supported in .NET 2008. I realize this is not good news given the release time line, but support or non support of cr xi r2 in .net 2008 is well documented - from [Supported Platforms|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7081b21c-911e-2b10-678e-fe062159b453
] to [KBases|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do], to [Wiki|https://wiki.sdn.sap.com/wiki/display/BOBJ/WhichCrystalReportsassemblyversionsaresupportedinwhichversionsofVisualStudio+.NET].
Best I can suggest is to try SP6:
https://smpdl.sap-ag.de/~sapidp/012002523100015859952009E/crxir2win_sp6.exe
MSM:
https://smpdl.sap-ag.de/~sapidp/012002523100000634042010E/crxir2sp6_net_mm.zip
MSI:
https://smpdl.sap-ag.de/~sapidp/012002523100000633302010E/crxir2sp6_net_si.zip
Failing that, you will have to move to a supported environment...
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Edited by: Ludek Uher on Jul 20, 2010 7:54 AM -
Need help getting rid of those ASX:ABAP tags from the generated XML file!
I was able to transfer xml data from abap internal tables to a string.
Here is the content of the string:
<?xml version="1.0" encoding="iso-8859-1"?>
<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<DATA>
<item>
<UOM1 />
<UOM2>L</UOM2>
<GL_PR_SEG />
<RECORDMODE>A</RECORDMODE>
</item>
</DATA>
</asx:values>
</asx:abap>
Now my goal is to strip out a couple of tags out of that string directly using xslt.
Do you know of any way i could take out the <asx:abap> and <asx:values> tags using an xslt program. I'd like to be able to strip them out directly from the string itself.its not function. its within abap.
within your abap program, the xml code is in a string for example xml_string .
use
replace all occurrences of '<ASX:ABAP>' in xml_string with '' .
replace all occurrences of '</ASX:ABAP>' in xml_string with '' .
replace all occurrences of '<ASX:VALUES>' in xml_string with '' .
replace all occurrences of '</ASX:VALUES>' in xml_string with '' .
Hope this solves your issue.
If your question is answered, reward the helpful answers with points and close the thread.
Regards
Raja -
Simple Transformation XML to ABAP - error CX_ST_MATCH_ELEMENT
Hi all,
I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
<?xml version="1.0" encoding="iso-8859-1" ?>
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
<NETWORK>E60000000000</NETWORK>
<OPERAZIONE>0010</OPERAZIONE>
- <TABELLA>
- <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
<MANDT>300</MANDT>
<NETWORK>E60000000000</NETWORK>
<OPERAZIONE>0010</OPERAZIONE>
<ID_ACT>1</ID_ACT>
<DESC_ACT>ATTIVITÀ1</DESC_ACT>
<LONG_TXT></LONG_TXT>
<MAKE_BUY></MAKE_BUY>
<WP></WP>
<EVENTO_TECH></EVENTO_TECH>
<TIPO_LEGAME></TIPO_LEGAME>
<CONSEGNA></CONSEGNA>
</ROW>
- <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">
<MANDT>300</MANDT>
<NETWORK>E60000000000</NETWORK>
<OPERAZIONE>0010</OPERAZIONE>
<ID_ACT>2</ID_ACT>
<DESC_ACT>ATTIVITÀ2</DESC_ACT>
<LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT>
<MAKE_BUY>M</MAKE_BUY>
<WP></WP>
<EVENTO_TECH></EVENTO_TECH>
<TIPO_LEGAME></TIPO_LEGAME>
<CONSEGNA></CONSEGNA>
</ROW>
</TABELLA>
</asx:values>
</asx:abap>
my transformation is
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"></tt:root>
<tt:root name="NETWORK"></tt:root>
<tt:root name="OPERAZIONE"></tt:root>
<tt:template>
<abap>
<values>
<network>
<tt:value ref="NETWORK"></tt:value>
</network>
<operazione>
<tt:value ref="OPERAZIONE"></tt:value>
</operazione>
<tabella>
<tt:loop ref=".ROOT" name="line">
<mandt>
<tt:value ref="$line.mandt"></tt:value>
</mandt>
<network>
<tt:value ref="$line.network"></tt:value>
</network>
<OPERAZIONE>
<tt:value ref="$line.OPERAZIONE"></tt:value>
</OPERAZIONE>
<ID_ACT>
<tt:value ref="$line.ID_ACT"></tt:value>
</ID_ACT>
<DESC_ACT>
<tt:value ref="$line.DESC_ACT"></tt:value>
</DESC_ACT>
<LONG_TXT>
<tt:value ref="$line.LONG_TXT"></tt:value>
</LONG_TXT>
<MAKE_BUY>
<tt:value ref="$line.MAKE_BUY"></tt:value>
</MAKE_BUY>
<WP>
<tt:value ref="$line.WP"></tt:value>
</WP>
<EVENTO_TECH>
<tt:value ref="$line.EVENTO_TECH"></tt:value>
</EVENTO_TECH>
<TIPO_LEGAME>
<tt:value ref="$line.TIPO_LEGAME"></tt:value>
</TIPO_LEGAME>
<CONSEGNA>
<tt:value ref="$line.CONSEGNA"></tt:value>
</CONSEGNA>
</tt:loop>
</tabella>
</values>
</abap>
</tt:template>
</tt:transform>
when I execute my code
the system dump with this error
ST_MATCH_FAIL
excep. CX_ST_MATCH_ELEMENT
TRY.
CALL TRANSFORMATION ('ZT_NETWORK')
SOURCE XML lv_xml_data_string
RESULT network = l_network
operazione = l_operazione
root = it_data_tmp.
CATCH cx_sy_conversion_data_loss .
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
WRITE:/ xslt_message .
ENDTRY.
Any help?
thanks
enzoEnzo Porcasi wrote:
> I have a problem with a transformation from xml to abap. My XML file (taken from a pdf file) is
>
<?xml version="1.0" encoding="iso-8859-1" ?>
> <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
> <asx:values>
Your XML is strange, it looks like a mix of pdf form content (xfa) and identity transformation (asx).
Could you explain more ?
Anyway, I tried to find out the errors (not only cx_st_match_element, that was just a catch missing), it works with the following program. Here are the main issues I have found :
- always catch exception class cx_st_error when you use simple transformations (it contains cx_st_match_element and all other simple transformation exceptions)
- xml "asx:abap" and "asx:values" in your input XML are useless, they are only used by identity transformation ("ID"); you may keep them if you want, but I advise you to see why they are in the xml !
- Use same case in your tags (if xml contains in the transformation so that it corresponds to the input XML
- I renamed all abap names with prefix ABAP_ so that to clearly differentiate xml tags and abap field names (so that it is more easy to understand, for every sdn reader; I hope it will help as I didn't find many threads in the forum).
Simple transformation :
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ABAP_NETWORK"></tt:root>
<tt:root name="ABAP_OPERAZIONE"></tt:root>
<tt:root name="ABAP_TABELLA"></tt:root>
<tt:template>
<ROOT>
<NETWORK>
<tt:value ref=".ABAP_NETWORK"></tt:value>
</NETWORK>
<OPERAZIONE>
<tt:value ref=".ABAP_OPERAZIONE"></tt:value>
</OPERAZIONE>
<TABELLA>
<tt:loop ref=".ABAP_TABELLA" name="line">
<ROW>
<MANDT>
<tt:value ref="$line.ABAP_MANDT"></tt:value>
</MANDT>
<NETWORK>
<tt:value ref="$line.ABAP_NETWORK"></tt:value>
</NETWORK>
<OPERAZIONE>
<tt:value ref="$line.ABAP_OPERAZIONE"></tt:value>
</OPERAZIONE>
<ID_ACT>
<tt:value ref="$line.ABAP_ID_ACT"></tt:value>
</ID_ACT>
<DESC_ACT>
<tt:value ref="$line.ABAP_DESC_ACT"></tt:value>
</DESC_ACT>
<LONG_TXT>
<tt:value ref="$line.ABAP_LONG_TXT"></tt:value>
</LONG_TXT>
<MAKE_BUY>
<tt:value ref="$line.ABAP_MAKE_BUY"></tt:value>
</MAKE_BUY>
<WP>
<tt:value ref="$line.ABAP_WP"></tt:value>
</WP>
<EVENTO_TECH>
<tt:value ref="$line.ABAP_EVENTO_TECH"></tt:value>
</EVENTO_TECH>
<TIPO_LEGAME>
<tt:value ref="$line.ABAP_TIPO_LEGAME"></tt:value>
</TIPO_LEGAME>
<CONSEGNA>
<tt:value ref="$line.ABAP_CONSEGNA"></tt:value>
</CONSEGNA>
</ROW>
</tt:loop>
</TABELLA>
</ROOT>
</tt:template>
</tt:transform>
Program and XML included :
REPORT zsro2.
DATA l_network TYPE string.
DATA l_operazione TYPE string.
DATA : BEGIN OF lt_data_tmp OCCURS 0,
abap_mandt TYPE string,
abap_network TYPE string,
abap_operazione TYPE string,
abap_id_act TYPE string,
abap_desc_act TYPE string,
abap_long_txt TYPE string,
abap_make_buy TYPE string,
abap_wp TYPE string,
abap_evento_tech TYPE string,
abap_tipo_legame TYPE string,
abap_consegna TYPE string,
END OF lt_data_tmp.
DATA xslt_error TYPE REF TO cx_xslt_exception.
DATA lo_st_error TYPE REF TO cx_st_error.
DATA lv_xml_data_string TYPE string.
DATA xslt_message TYPE string.
DEFINE conc.
concatenate lv_xml_data_string &1 into lv_xml_data_string.
END-OF-DEFINITION.
*conc '<?xml version="1.0" encoding="iso-8859-1" ?>'.
*conc '<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">'.
*conc ' <asx:values>'.
conc ' <ROOT>'.
conc ' <NETWORK>E60000000000</NETWORK> '.
conc ' <OPERAZIONE>0010</OPERAZIONE> '.
conc ' <TABELLA>'.
conc ' <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
conc ' <MANDT>300</MANDT> '.
conc ' <NETWORK>E60000000000</NETWORK> '.
conc ' <OPERAZIONE>0010</OPERAZIONE> '.
conc ' <ID_ACT>1</ID_ACT> '.
conc ' <DESC_ACT>ATTIVITÀ1</DESC_ACT> '.
conc ' <LONG_TXT></LONG_TXT> '.
conc ' <MAKE_BUY></MAKE_BUY> '.
conc ' <WP></WP> '.
conc ' <EVENTO_TECH></EVENTO_TECH> '.
conc ' <TIPO_LEGAME></TIPO_LEGAME> '.
conc ' <CONSEGNA></CONSEGNA> '.
conc ' </ROW>'.
conc ' <ROW xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup">'.
conc ' <MANDT>300</MANDT> '.
conc ' <NETWORK>E60000000000</NETWORK> '.
conc ' <OPERAZIONE>0010</OPERAZIONE> '.
conc ' <ID_ACT>2</ID_ACT> '.
conc ' <DESC_ACT>ATTIVITÀ2</DESC_ACT> '.
conc ' <LONG_TXT>ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2 ATTIVITÀ2</LONG_TXT> '.
conc ' <MAKE_BUY>M</MAKE_BUY> '.
conc ' <WP></WP> '.
conc ' <EVENTO_TECH></EVENTO_TECH> '.
conc ' <TIPO_LEGAME></TIPO_LEGAME> '.
conc ' <CONSEGNA></CONSEGNA> '.
conc ' </ROW>'.
conc ' </TABELLA>'.
conc ' </ROOT>'.
*conc ' </asx:values>'.
*conc '</asx:abap>'.
DATA lv_xml_data_string_2 TYPE string.
TRY.
CALL TRANSFORMATION zsro
SOURCE
XML lv_xml_data_string
RESULT
abap_network = l_network
abap_operazione = l_operazione
abap_tabella = lt_data_tmp[].
CATCH cx_sy_conversion_data_loss .
CATCH cx_st_error INTO lo_st_error.
xslt_message = lo_st_error->get_text( ).
WRITE:/ xslt_message .
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
WRITE:/ xslt_message .
ENDTRY.
BREAK-POINT. -
Creating an XML From a Deep Structure using XSL Transformation
Hi ABAPers,
I have a requirement to use XSL Transformations on an ABAP deep type structure.
Currently i have an API that fills in this deep structure and by using CALL TRANSFORMATION ID.... i will get the BIG XML having having 100s of nodes . But actualy form the deep structure i need only some NODES (say 50)... So i tried writing an XSLT
in the transaction STRANS.. but on using this TRANSFORMATION which i wrote i am getting an error messgae like INVALID XML...
Am i going in right track or is there a good solution...
My sample transformation is as below...
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:value-of select="DATA/NODE_ELEMENTS/UUID_KEY/UUID"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/SEMANTICAL_NAME"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/STRUCT_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/USAGE_CAT"/>
<xsl:value-of select="DATA/NODE_ELEMENTS/RESTRICTED_IND"/>
<xsl:value-of select="VALUES/DATA/NODE_ID"/>.
</xsl:template>
</xsl:transform>
Please help me in solving this issue....
Thanks,
Linda.Hi Linda,
I am replying based on your sample code.
Try the below following suggestions.
here 'GRPHDR' is the node where I am selecting the data.
IGRPHDR is the name of the reference.
First calling the transformation in you program.
TYPES: BEGIN OF tl_hdr,
msgid(20) TYPE c,
END OF tl_hdr.
DATA : t_hdr TYPE STANDARD TABLE OF tl_hdr.
GET REFERENCE OF t_hdr INTO l_result_xml-value.
l_result_xml-name = 'IGRPHDR'.
APPEND l_result_xml TO t_result_xml.
TRY.
CALL TRANSFORMATION yfi_xml_read
SOURCE XML it_xml_data
RESULT (t_result_xml).
CATCH cx_root INTO l_rif_ex.
l_var_text = l_rif_ex->get_text( ).
l_bapiret-type = 'E'.
l_bapiret-message = l_var_text.
APPEND l_bapiret TO errormsgs.
EXIT.
ENDTRY.
in XSL transformation
First write a block of statement to specify from which node you are taking the data.
No matter it is a node or sub-node.
<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>
<IGRPHDR> " reference name of internal table
<xsl:apply-templates select="//GrpHdr"/>
</IGRPHDR>
</asx:values>
</asx:abap>
</xsl:template>
Next select the data from the nodes under the nodes specified in the transformation.
here msgid is the field i am selecting for value.
<xsl:template match="GrpHdr">
<item>
<MSGID> " field in the internal table t_hdr where data has to go
<xsl:value-of select="MsgId"/>
</MSGID>
</item>
</xsl:template>
reply back if further clarification is needed.
Thanks and regards,
Kannan N -
XSL transformation never works on Websphere 5
I'm doing a xsl transformation on websphere 5 and this xsl never finds the right values. When I run the exact same transformation with the same source, it finds all the values, but on the server it just return empty tags. Why? And how do I fix this?
Source xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<n:OrderResponseComplex xmlns:n="http://sirius/xml/common">
<n:AcceptedIndicator>Akseptert</n:AcceptedIndicator>
<n:RejectionReasonCode>0</n:RejectionReasonCode>
</n:OrderResponseComplex>XSL transformation:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="http://xml.apache.org/xslt">
<xsl:template match="/">
<SiebelMessage IntObjectFormat="Siebel Hierarchical" IntObjectName="TBS2 OHS Reply" MessageType="Integration Object">
<TBS2OHSReply>
<OrderEntry-Orders>
<BackOfficeErrorText><xsl:value-of select="OrderResponseComplex/RejectionReasonCode"/></BackOfficeErrorText>
<Status><xsl:value-of select="OrderResponseComplex/AcceptedIndicator"/></Status>
</OrderEntry-Orders>
</TBS2OHSReply>
</SiebelMessage>
</xsl:template>
</xsl:stylesheet>Result xml:
<?xml version="1.0" encoding="UTF-8"?>
<SiebelMessage MessageType="Integration Object" IntObjectName="TBS2 OHS Reply" IntObjectFormat="Siebel Hierarchical">
<TBS2OHSReply>
<OrderEntry-Orders>
<BackOfficeErrorText/>
<Status/>
</OrderEntry-Orders>
</TBS2OHSReply>
</SiebelMessage>You need to watch out for the namespace in the source document:
You can either specify the namespace and use it when locating paths in the source document (as below) or specify it as the default namespace.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt"
xmlns:n="http://sirius/xml/common">
<xsl:template match="/">
<SiebelMessage IntObjectFormat="Siebel Hierarchical" IntObjectName="TBS2 OHS Reply" MessageType="Integration Object">
<TBS2OHSReply>
<OrderEntry-Orders>
<BackOfficeErrorText><xsl:value-of select="n:OrderResponseComplex/n:RejectionReasonCode"/></BackOfficeErrorText>
<Status><xsl:value-of select="n:OrderResponseComplex/n:AcceptedIndicator"/></Status>
</OrderEntry-Orders>
</TBS2OHSReply>
</SiebelMessage>
</xsl:template>
</xsl:stylesheet> -
Hi All,
I like to know, is it NULL and Space value is same in ABAP, if it is not how to check null value.
Thank you.
Senthileverything is correct though some answers are not correct.
A Database NULL value represents a field that has never been stored to database - this saving space, potentially.
Usually all SAP tables are stored with all fields, empty fields are stored with their initial value.
But: If a new table append is created and the newly-added fields do not have the 'initial value' marked in table definition, Oracle will just set NULL values for them.
as mentioned: There is no NULL value to be stored in an ABAP field. The IS NULL comparison is valid only for WHERE clause in SELECT statement. WHERE field = space is different from WHERE field IS NULL. That's why you should check for both specially for appended table fields.
If a record is selected (fulfilling another WHERE condition) into an internal table or work area, NULL values are convertted to their initial values anyway.
Hope that sheds some light on the subject!
regards,
Clemens -
ABAP program to neutralize 0Unit value and 0quantity value
Hi all,
I'm not expert in ABAP, and i would like implement a small abap program (routine)in my cube.
I would like neutralize the 0UNIT value and 0QUANTITY value only when 0VTYPE = 1 or 2 :
<b>in other words, if 0vtype = 1 or 4 then 0unit = space and 0quantity = 0
b]
Can you tell me please <b>how and where</b> write the ABAP program please ?
Message was edited by:
Pontoise Pontoise
Message was edited by:
Pontoise PontoiseHi,
I amnt able to understand your requirement. But the code for which you asked is simple.
If 0vtype = 1 or 0vtype = ' '.
0unit = space.
0quantity = 0.
endif.
Regards
Aneesh. -
DBUri and xsl transform hanging
Hi All,
I'm using the DBUriServlet (oradb) to access XML data stored in Oracle. If I query the data without transforming it, E.g. http://<machine>:<port>/oradb/TABLE_NAME/...etc...?contenttype=text/xml&rowsettag=<row-tag>
Everything works fine and returns the XML in seconds.
I've got and Xpath index setup that seems to be working, according to execution plan.
However, if I try and transform this data using xsl, by feeding in "transform" on the query-string I never receive the results in the browser. E.g
http://.../oradb/..?transform=/public/xsl/trans.xsl&contenttype=text/html&rowsettag=test
The data set is trivial, 20 xml files (10-30kB); the XSL is pretty ugly but other transformers handle it OK. I've tried it with msxsl and xalan, and have no problems; however, running it through the DBUriServlet as above, causes the Oracle process to eat huge amounts of memory (very low CPU usage) and never hang.
Anyone seen this behaviour? Any ideas what to look at? Also, is anyone out there using this Servlet to access the data in a production environment? Or is the servlet only meant for demos/evaluations?
Env = 9.2.0.3 on Solaris 64 or Windows 2000.
Thanks for your help, I'm stumped and the clock stopped ticking on this project months ago! ;)
JohnThanks for the reply.
If I try
select xdburitype('path to xsl').transform(xdburitype('path to xml')) from dual;
I get ORA-00904: "SYS"."XDBURITYPE"."TRANSFORM": invalid identifier. From the docs I think transform is a function of xmltype. Please correct me if I'm wrong.
However, I tried the following:
SELECT XMLTransform( xdbUriType(path to xml).getXML( ), xdbUriType(path to xsl).getXML( ) ).getClobVal( ) FROM DUAL;
I get the first 4 lines of the HTML output. Irrespective of whay I set serveroutput or linessize to.
One thing to mention, if I use DBUri and via xpath limit the resultset of the query to be a single XML file returned, the transform works fine.
I appreciate your helps.
Cheers,
John -
XSL Transformation breaks encoding declaration
The first line in my XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
The first line in my XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
Once I do the transformation, I end up with this in my XSL-FO
file:
<?xml version="1.0" encoding="ISO8859-1"?> where it
should be ISO-8859-1.You need to watch out for the namespace in the source document:
You can either specify the namespace and use it when locating paths in the source document (as below) or specify it as the default namespace.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt"
xmlns:n="http://sirius/xml/common">
<xsl:template match="/">
<SiebelMessage IntObjectFormat="Siebel Hierarchical" IntObjectName="TBS2 OHS Reply" MessageType="Integration Object">
<TBS2OHSReply>
<OrderEntry-Orders>
<BackOfficeErrorText><xsl:value-of select="n:OrderResponseComplex/n:RejectionReasonCode"/></BackOfficeErrorText>
<Status><xsl:value-of select="n:OrderResponseComplex/n:AcceptedIndicator"/></Status>
</OrderEntry-Orders>
</TBS2OHSReply>
</SiebelMessage>
</xsl:template>
</xsl:stylesheet> -
Here is a sample of my code:
I initially have one (non-null & valid - checked that !) node (dataNode). I need to do a XSL transformation on this one using an xsl (non-null & valid String). I can do manually the transform using a program such as XMLSpy and everything's fine !!!
If I pass the initial Node to transform as a String to the following function it works fine:
* Return the transformation of an XML through an XSL
public static String getTransformedXML(String xmlSourceString, String xslSourceString) {
StreamSource xmlSource;
StreamSource xslSource;
StreamResult xmlDestination;
StringWriter sw;
try {
xmlSource = new StreamSource(new StringReader(xmlSourceString));
xslSource = new StreamSource(new StringReader(xslSourceString));
xmlDestination = new StreamResult(sw = new StringWriter());
Transformer thisTransformer = tFactory.newTransformer(xslSource);
thisTransformer.transform(xmlSource, xmlDestination);
System.out.println("xxxxx = " + sw.getBuffer());
return sw.getBuffer().toString();
} catch (TransformerConfigurationException e) {
System.out.println("TRANSFORMATION CONFIGURATION ERROR:" + e.getMessage());
return null;
} catch (TransformerException e) {
System.out.println("TRANSFORMATION ERROR:" + e.getMessage());
return null;
But I CANNOT get working this code (instead of giving a String, I give a Node):
* Return the transformation of an XML through an XSL
public static Node getTransformedXML(Node xmlSourceNode, String xslSourceString) {
DOMSource xmlSource;
StreamSource xslSource;
DOMResult xmlDestination;
try {
xmlSource = new DOMSource(xmlSourceNode);
xslSource = new StreamSource(new StringReader(xslSourceString));
xmlDestination = new DOMResult();
Transformer thisTransformer = tFactory.newTransformer(xslSource);
System.out.println("avant");
thisTransformer.transform(xmlSource, xmlDestination); // HERE IS WHERE IT CRASHES !!!!
System.out.println("apres");
return xmlDestination.getNode();
} catch (TransformerConfigurationException e) {
System.out.println("TRANSFORMATION CONFIGURATION ERROR:" + e.getMessage());
return null;
} catch (TransformerException e) {
System.out.println("TRANSFORMATION ERROR:" + e.getMessage());
return null;
While using this function, I'm receiving the DOM Exception 3
TRANSFORMATION ERROR:org.apache.crimson.tree.DomEx: HIERARCHY_REQUEST_ERR : This node is not allowed here !
Also, does someone knows a way to convert a Node in a String ??? I'd like just to be able to println a node in the form "<parentNode><node1>value</node1><node2>value</node2></parentNode>" for example.
Please help !!!!
Thanks a lot in advance to any Java/XML Guru for helping.
Eg\\*Come on ... I cannot believe that nobody saw that before. Isn't there any java/dom guru in here ;-) ?
Could it be a possibly a bug in the API ?
Thank you very much.
Eg\\* -
XSL transformation with java binding
Hi everyone!
I am trying to implement na XSL transformation that uses java code binding.
My XSL looks as follows:
<i><xsl:stylesheet xmlns:myobj="java.lang.System" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xf="http://www.sapportals.com/wcm/app/xmlforms">
<xsl:param name="myobj"/>
<xsl:value-of select="string(myobj:currentTimeMillis())"/>
</xsl:stylesheet></i>
Everything works fine - current time is displayed.
But when I try to use my custom java class the compiler returns an exception:
<i>com.sapportals.wcm.WcmException: com.sap.engine.lib.xml.util.NestedException: Could not load class: ep.UmeLookup required for execution of 'UmeLookup.isReady'</i>
My second xsl stytesheet with a reference to custom class looks as follows:
<i><xsl:stylesheet xmlns:ume="ep.UmeLookup" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xf="http://www.sapportals.com/wcm/app/xmlforms">
<xsl:param name="ume"/>
<xsl:value-of select="string(ume:UmeLookup.isReady())"/>
</xsl:stylesheet></i>
I developed java class (ep.UmeLookup), made a .jar from it, included the jar archive in a Library project and deployed the library to the J2EE engine.
It looks like my class is not 'visible' in J2EE engine, while in my opinion it should be. Does anyone know how to change that??
BR / marekAsk this lady a question. Maybe she could answer your question.
XSLT Mapping With JAVA Enhancement ( For Beginners) -
XSL transformation not working
Hi!
I am having problems when trying to generate XSL transformation from XML to XML (where XML output is actually XHTML). It always fails executing <xsl:callTemplate name="something", when <xsl:callTemplate /> is executed from another <xsl:template> which is also called with <xsl:callTemplate. Version of database is 10.2.0.4.0, received error is: ORA-00604: invalid character value 'burek' for attribute 'name'.
Transformation is working in Java and Altova XMLSpy.
PL/SQL code:
procedure process_xsl(p_xml in clob, p_xsl in clob, p_result out clob) is
w_xsl_proc dbms_XSLProcessor.Processor;
w_xsl_ss dbms_XSLProcessor.Stylesheet;
w_dom_xsl dbms_xmldom.DOMDocument;
w_dom_xml dbms_xmldom.DOMDocument;
w_parser dbms_xmlparser.Parser;
begin
--xml in xsl iz cloba v DOMDocument
w_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(w_parser, p_xml);
w_dom_xml := dbms_xmlparser.getDocument(w_parser);
dbms_xmlparser.freeParser(w_parser);
w_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(w_parser, p_xsl);
w_dom_xsl := dbms_xmlparser.getDocument(w_parser);
dbms_xmlparser.freeParser(w_parser);
--xsl procesiranje
w_xsl_proc := dbms_XSLProcessor.newProcessor;
w_xsl_ss := dbms_XSLProcessor.newStylesheet(w_dom_xsl, null); <-- Here error is received
END;
Stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></xsl:output>
<xsl:decimal-format name="dec" decimal-separator="," grouping-separator="."/>
<!-- Predefined constants from einvoice xml schema -->
<xsl:variable name="einvoiceIssuerCode" select="'II'"></xsl:variable>
<xsl:variable name="einvoiceRecipientCode" select="'IV'"></xsl:variable>
<xsl:variable name="einvoiceIssueLocationCode" select="91"></xsl:variable>
<xsl:variable name="einvoiceIssueDateCode" select="137"></xsl:variable>
<!-- Constants directly from document which is a part of transformation -->
<xsl:variable name="einvoiceNumber" select="/IzdaniRacunEnostavni/Racun/GlavaRacuna/StevilkaRacuna/text()"></xsl:variable>
<!-- Intro template -->
*<xsl:template name="burek"> <!-- Second template called with xsl:call template -->*
<xsl:text>TEST</xsl:text>
</xsl:template>
<!-- Template in which we create html structure including css -->
<xsl:template name="einvoice">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vizualizacija e-računa št. </title>
<xsl:call-template name="burek"></xsl:call-template>
</head>
<body>
</body>
</html>
</xsl:template>
<!-- Intro template -->
<xsl:template match="/">
* <xsl:call-template name="einvoice"></xsl:call-template> <!-- This call is OK -->*
</xsl:template>
</xsl:stylesheet>
XML document
<?xml version="1.0" encoding="UTF-8"?>
<IzdaniRacunEnostavni>
<Racun Id="data">
<GlavaRacuna>
<VrstaRacuna>380</VrstaRacuna>
<StevilkaRacuna>1205019908211</StevilkaRacuna>
<FunkcijaRacuna>9</FunkcijaRacuna>
</GlavaRacuna>
<DatumiRacuna>
<VrstaDatuma>137</VrstaDatuma>
<DatumRacuna>2012-05-07T00:00:00.0Z</DatumRacuna>
</DatumiRacuna>
<DatumiRacuna>
<VrstaDatuma>263</VrstaDatuma>
<DatumRacuna>2012-04-28T00:00:00.0Z</DatumRacuna>
</DatumiRacuna>
<DatumiRacuna>
<VrstaDatuma>263</VrstaDatuma>
<DatumRacuna>2012-05-27T00:00:00.0Z</DatumRacuna>
</DatumiRacuna>
<DatumiRacuna>
<VrstaDatuma>263</VrstaDatuma>
<DatumRacuna>2012-03-28T00:00:00.0Z</DatumRacuna>
</DatumiRacuna>
<DatumiRacuna>
<VrstaDatuma>263</VrstaDatuma>
<DatumRacuna>2012-04-26T00:00:00.0Z</DatumRacuna>
</DatumiRacuna>
<DatumiRacuna>
<VrstaDatuma>263</VrstaDatuma>
<DatumRacuna>2012-04-27T00:00:00.0Z</DatumRacuna>
</DatumiRacuna>
<Lokacije>
<VrstaLokacije>91</VrstaLokacije>
<NazivLokacije>Ljubljana</NazivLokacije>
</Lokacije>
</Racun>
</IzdaniRacunEnostavni>
Edited by: 938026 on 01-Jun-2012 00:35Hi,
I think your problem lies in the <title>. You are using non UTF-8 characters in the title (š), but you marked your XML as UTF-8. So change the title to have unicode charaters and it will work.
Herald ten Dam
http://htendam.wordpress.com -
XSL Transformation Action Parameters
Does anyone know how, or even if it's possible, to pass parameters to an XSLT stylesheet using the XSL Transformation action in a Business Logic Transaction?
Som,
The parameter I was referring to is not an action parameter, but a parameter in the XSLT itself. E.G. the following extracts a column from an xMII document and creates a new doc with that one column. But I want to name the column at run time, so I can use the same XSLT in various places.
[code]
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="ColumnToExtract" select="ProductAshDry"></xsl:param> <xsl:template match="/">
<Rowsets DateCreated="2007-05-31T10:58:25" EndDate="2007-05-31T10:58:25" StartDate="2007-05-31T10:58:25" Version="11.5.2">
<Rowset>
<Columns>
<Column Description="Item" MaxRange="0" MinRange="0" Name="Data" SQLDataType="1" SourceColumn="Data"/>
</Columns>
<xsl:for-each select="/Rowsets/Rowset/Row">
<Row>
<Data>
<xsl:value-of select="$ColumnToExtract"/>
</Data>
</Row>
</xsl:for-each>
</Rowset>
</Rowsets>
</xsl:template>
</xsl:stylesheet>
[/code]
ColumnToExtract is a parameter for the XSLT, which can be set at runtime with various other transform engines. I just can't see a way to set it using the xMII XSL Transformation action.
Regards,
Bill -
XSL transformation related point
Hi All,
Morning, need some assistance with this issue we are facing during XSL transformation,
During the XSL transformation we need to access mapping file lets say country-code.txt which has the details as mentioned below:
US=USA
UK=Great Britain
Now when the input data value comes as US we need to map the output tag in the xsl with the value USA at run time & if input is Uk then output tag value should be Great Britain
2.Also in another file say login-details.txt we have maintained the user-name & password like below:
user-name='Test'
password='welcome'
This also we need to get the values in the xsl transformation file within the BPEL process so that at Run Time these could be got from the file ( since if we hard code in the xsl file within the BPEL process whenever the instance login details changes everytime we would have to change in the process and re deploy again)
1.Now in Soa Suite 10g is there a way or method/steps wherein from the xslt mapping file within the BPEL process we could make a call or access these files. Also on the application server/unix directory where do we need to physically put these files at which directory location ..if this is possible.
2.Also could a similar scenario be achieved in SOA Suite 11g
Could someone please help us with this as we are currently stuck with this situation..
with regards as always..Hi ,
Thanks for your response first...have mentioned the details below
***xsl mapping ****
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:get="http://www.oracle.com/XSL/Transform/java/customclass" version="1.0">
<FinalCountryCode>
<xsl:variable name="countryCode" select="INPUT_COUNTRY_CODE"/>
<xsl:value-of select="get:getCode($countryCode)"/>
</FinalCountryCode>
****class defintion mentioned below****
(this is a custom java class created where we could try accessing the file named country_code.txt and we would try calling the getCode function of this java class from the xsl mapping as above.)
import java.io.FileInputStream;
import java.util.*;
public class customclass
public static String getCode(String p_str_CountryCode)
Properties o_countryCode = new Properties();
String v_countryCode = null;
FileInputStream o_Code = new FileInputStream("country_code.txt");
o_countryCode.load(o_Code);
v_countryCode = o_countryCode.getProperty(p_str_CountryCode);
return v_countryCode;
country_code.txt file would have details like this:
US=USA
UK=Great Britain
So during the SOA Run time if the value for INPUT_COUNTRY_CODE comes as US the final tag CountryCode3Gid should have the value as USA
1.Now where do we need to physically put the file name country_code.txt (having the country code mappings) on the application server in Soa 11g, so that it could be accessed during Run Time.
2.Also where do we put customclass so that it could be accessed during SOA Run Time
3.Also in Soa 10g & Soa 11g is there a better method or any other way/steps within Jdev and also during SOA run time that this functionality could be achieved (means call an external file which stores the mapping values which need to be referred during xsl mapping within BPEL process)
4.We are not sure whether this would be feasible method and how to make this work in 10g as well as 11g
thanks
Maybe you are looking for
-
How do I add a number to my iMessage on my iPad
I would like for my iMessage on my iPad to be the same as my phone number not my email. How do I add I'm number. It is only asking me for another email address.
-
Slight change in OWA link causes mail to stop working
My work recently changed the web address and/or something else that now keeps me from getting my mail on my BB 8320. The old link was: https://webmail.abc.gov and now the link is https://owa.abc.gov/owa/ There is also a slight change in the appeara
-
Fonts set in outbound mail appear differently in recipient's mailbox
I run all of my Mac Mail v4.2 (1078) in Verdana 11pt. I have a variety of elaborate signatures, also set to Verdana 11pt. When I author outbound mail, in Verdana 11pt, attach one of many signatures, and then view those emails on receiving computers,
-
Zen Vision M Power Adapter questi
I have a Zen Micro with the USB power adapter, i.e., the one that has an AC connection on one end a mini usb connection on the other. Can I use this to recharge a Zen Vision M? Thanks,Mark
-
When I click on the app tab in itunes it shows them all and I do not know how to distinguish the apps I have paid for from the free ones..