Xslt to replace map in orchestration
I have created a map and then created an xslt by validating the map. I have added few more changes to the xslt file after it's been created. Now how do I call the xslt in the transform shape of the orchestration? I do not want the map to be used in orchestration,
in place of that I want xslt to be used. how do I use xslt in place of map in orchestration?
You have to use this XSLT along with the map.
Right-click the map surface, and select Properties.
Click the ellipsis next to the Custom XSLT Path property, and open the file containing the custom XSLT.
Compile the map. The XSLT file is included in the BizTalk assembly and does not need to be deployed separately.
Using External XSLT in the BizTalk Mapper
If you follow the above way you would execute the XSLT for the transformation. There is no harm is using the map and if you have some complex
logic in XSLT then the above way would ensure that the XSLT would be used for transformation.
For some reason if you want the XSLT without the standard map, then only option I can think off is to call an external .NET assembly and call
the XSLT through it by passing the input message. This way is certainly not a suggested way. Use standard map and invoke custom transformation using your XSLT thru map.
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.
Similar Messages
-
Any website for XSLT AND ABAP mapping
Hi XI experts,
I am looking for any good website/Material for XSLT and ABAP Mapping with examples.
So experts if you any one of you have any clue , i would appreciate it , if you post the info here .
Regds,
Ram.Hi,
For XSLT mapping, please try to create msg types for sender and recv, import these two into XML Mapforces (This is a software which enables us to do mapping this you can download from altova mapforce site) , do mapping in that mapforce , late click on XSLT icon , one XSLT file will be c reated that file , prepare zip and late come to xi , import under imported archieves,do Interface mapping by selecting the XSLT mapping option, select imported archieve..
See below examples..
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
http://www.troobloo.com/tech/xslt.toc.shtml
http://www.w3schools.com/xsl/
http://www.w3.org/TR/xslt
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples/generic%20xslt%20mapping%20in%20sap%20xi%2c%20part%20i.pdf
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
Required XSLT Mapping tips!
Regards
Chilla.. -
Hello friends,
Can any one know that how to create a XSLT and Java Mapping file(Jar File).
I am not able to find any of the example so if you create a example or find some where please let me know on that How to create such files...
Thanks...
Gaurav JainHi,
I am trying to invoke a Java Extension Function from a XSLT. I added both the class file and the XSLT file to a folder, then zipped the entire folder and uploaded into the Archive for my Interface MApping.
The CLASS gets loaded but the runtime engine gives an error when calling the JAVA Function.
Here is what it says:
Creating mapping sequence with 2 steps. --- Creating Java mapping Deliveries/stringHandler --- Creating mapping sequence with 2 steps. --- Creating XSLT mapping Deliveries/test1 --- Using MappingResolver with context URL /sapmnt/XD1/global/xi/mapping/http%3A%2F%2Fwolterskluwer%2Ecom%2Fxi%2F wk_midas_deliveries%2Ftest/cd2e6820267511d9cb52c3c5143c3524/ --- Loaded class Deliveries.stringHandler --- com.sap.aii.ibrun.server.map.MappingRuntimeException: at com.sap.aii.ibrun.server.map.MappingRuntimeException.code_STYLESHEET_OR_CLASS_NOT_FOUND(MappingRuntimeException.java:91) at com.sap.aii.ibrun.server.map.RUMappingJava.instantiate(RUMappingJava.java:168) at com.sap.aii.ibrun.server.map.RUMappingJava.execute(RUMappingJava.java:41) at com.sap.aii.ibrun.server.map.RUSequence.execute(RUSequence.java:50) at com.sap.aii.ibrun.server.map.RURunner.run(RURunner.java:58) at com.sap.aii.ibrun.server.map.RUManager.run(RUManager.java:66) at com.sap.aii.ibrun.sbeans.map.MappingRequestHandler.handleRequest(MappingRequestHandler.java:67) at com.sap.aii.ibrun.sbeans.map.MappingServiceImpl.processFunction(MappingServiceImpl.java:83) at com.sap.aii.ibrun.sbeans.map.XMappingServiceObjectImpl0.processFunction(XMappingServiceObjectImpl0.java:24) at com.sap.aii.ibrun.sbeans.map.MappingServiceKey.processFunction(MappingServiceKey.java:10) at java.lang.reflect.Method.invoke(Native Method) at com.inqmy.services.rfcengine.RFCDefaultRequestHandler.invokeBean(RFCDefaultRequestHandler.java:83) at com.inqmy.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:50) at com.inqmy.services.rfcengine.RFCJCOServer.handleRequest(RFCJCOServer.java:69) at com.sap.mw.jco.JCO$Server.dispatchRequest(Unknown Source) at com.sap.mw.jco.rfc.MiddlewareRFC$Server.nativeListen(Native Method) at com.sap.mw.jco.rfc.MiddlewareRFC$Server.listen(Unknown Source) at com.sap.mw.jco.JCO$Server.listen(Unknown Source) at com.sap.mw.jco.JCO$Server.run(Unknown Source) at java.lang.Thread.run(Thread.java:513) --
Please tell me what is the problem?
Thanks for your time
A -
Orchestration Variable in Custom XSLT in Biztalk Map
Hi,
I have a custom xslt for mapping HL7 messages to CRM fields.
For one field, I 'll get the data from DB so it is stored in my orchestration variable. How can I use that variable in my custom xslt file? Thanks.
Regards,
LakshmiHi Laxme,
As far I know, there is no way you can access Orchestration variable in custom XSLT.
Workaround : you can create a intermediate message with a field and assign the variable value (the data from DB) to it and later use message assignment to assign this value to the field which you want to the mesage which you created using custom
xslt.
Maheshkumar
S Tiwari|User
Page|Blog|BizTalk
2013: Inserting RawXML (Whole Incoming XML Message) in SQL database -
Is it possible to call XSLT from Java Mapping Class?
Hi,
does someone have experience with this? Or any ideas?
And, if yes, how can be this XSLT called? Is it necessary to specify special path? Or it is the XSLT file placed in the same directory?
Thanx in advance, Peter
Message was edited by: Peter JarsunekHi SUdhir,
Thanx 4 your answer. I have seen this link before, but there is only Java->Java or XSLT->Java calling.. I need Java->XSLT.. When I create Java mapping, I want to use stored XSLT stylesheet to convert the message. Because, my problem is,that my primary message contains characters which I want to be changed. For this reason I need java class - to replace the characters. And then I want to do transformation with the XSLT stylesheet. Can you post some example?
Thanx, Peter -
Abnormal behavior of Map inside orchestration
Hi Guys,
I have a sequential convoy orchestration where each XML message gets transformed to 837P.
In map I am using StringParam.Replace("-","").PadRight(9,'0') function inside scripting functoid to remove dashes from ZipCode.
The solution was working before I did some changes in the map (did not touch this part). Now my problem is that I get dash removed from the only first XML messages, all other subsequent messages' ZipCode gets mapped as is with dashes.
Can someone point me in the direction why my map is behaving abnormally?
Thanks,
Dhiraj BhavsarHi Guys,
I have a sequential convoy orchestration where each XML message gets transformed to 837P.
In map I am using StringParam.Replace("-","").PadRight(9,'0') function inside scripting functoid to remove dashes from ZipCode.
The solution was working before I did some changes in the map (did not touch this part). Now my problem is that I get dash removed from the only first XML messages, all other subsequent messages' ZipCode gets mapped as is with dashes.
Can someone point me in the direction why my map is behaving abnormally?
Thanks,
Dhiraj Bhavsar
To me it sounds like a loop problem, If this is applied on some segment is occurs multiple times. if you don't loop over that, it will only map first occurence of segment. If possible please post a snapshot of your map (relevant portion only) -
Give me description for ABAP and XSLT and JAVA Mapping
i want detailed description for XSLT AND ABAP,JAVA Mapping and where they require coding and some examples for this items and differences for these mappings and message mapping and some examples which shows difference between these items
Hi,
Java mapping:
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
ABAP Mapping:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
XSLT mapping
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
ABAP XSLT mapping
/people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping
Regards
Vijaya -
Current Date in XSLT 1.0 Mapping
Hi All,
Very Good Morning...
I have one issue my XSLT mapping, One filed is required current date and time.But in XSLT 1.0 there is no standard date function. But XSLT 2.0 version is aviable.
I am using the XSLT1.0 version.i saw in SDN some threads are related to this issue. XSLT supported for Java extensions.
Upto now i am n't working with JAVA mapping. How i can create a JAVA extension and how i can import to Integration Respoistery....
Kindly give me suggestion about this issue.
Thank you very much.
SateeshDear Sateesh,
Declare xlst variables at start of xsl program like below
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="today_formatted" select="java:java.text.SimpleDateFormat.new('yyyyMMdd')"/>
<xsl:variable name="time_formatted" select="java:java.text.SimpleDateFormat.new('HHmmss')"/>
and use them in xsl mapping
<xsl:value-of select="substring(concat(java:format($today_formatted, $date),$blanks),1,8)"/>
<xsl:value-of select="substring(concat(java:format($time_formatted, $date),$blanks),1,6)"/>
thanks,
madhu -
Issue at runtime with Mapping in orchestration.
Hi All,
I am getting the below issue at runtime in the orchestration.
Exception thrown from: segment 1, progress 16
Inner exception: Error encountered while executing the transform C_BT.Orchestrations.CheckInvalidRecords. Error:Invalid input/output document into/from the transform. Does not have a single root node..
I have a simple mapping which is mapping to 2 same files as per the input data..Please note that when the inputmsgpart0 is getting even a single records, the error is not coming, however when all the records are getting mapped to inputmsgpart1, I am getting
the above error.
So it is because of empty node for Output message part 0, can someone help with the solution ?
FYI, screenshot below of mapping
Thanks, VarunHi Varun,
you are mapping 1 source message to two destination messages but can you please help me to understand what you are implementing using this. because your destination does not have the single root. as per as i know it is not going to create two separate message
when mapping is done.
with multiple input to single message it is possible as suggested by qiangs but not vice-versa. to implement same you need to make sure your output has only one root not many as you are having two roots.
also is your input message Telegram record is single or repeating record, if repeating record then you might need to use looping mechanism in your map.
Regards, Amit More -
Handling Multi hierarchial Structure using XSLT or Java Mapping in XI
Hello Experts,
I have an requirement wherein i have sender as IDOC and File as Receiver.My target File structure is multi hierarchial with parent level and many child sub level node.
I tried to generate flat structure using graphical mapping by creating an intermediate structure and then mapping it to flat structure but that seems to be very complex for my scenario as there are many sub level at target structure..
Is there any simple way of handlng these????
ThanksHi ,
I tried to implement your solution ..I am able to convert my idoc to XMLusing XLST but i have a question that how to convert that XMP to flat file as XI Receiver File adapter understand only 1st level of hierarchy..It doesnt understand nested level of hierarchy which is in my case...
Below is the xslt code which i have written:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<MT_SALES_PO_DATA_INBOUND>
<xsl:value-of select="WPUBON01/IDOC"/>
<xsl:for-each select="WPUBON01/IDOC/E1WPB01">
<E1WBBB01>
<Store_ID>A001</Store_ID>
<SYS_INVOICE_NO>
<xsl:value-of select="substring(BONNUMMER,'3','15')"/>
</SYS_INVOICE_NO>
<Cashier_ID>
<xsl:value-of select="KASSID"/>
</Cashier_ID>
</E1WBBB01>
</xsl:for-each>
<xsl:for-each select="WPUBON01/IDOC/E1WPB01/E1WPB02">
<E1WBB02>
<Transaction_Type>
<xsl:value-of select="VORGANGART"/>
</Transaction_Type>
<Article_Description>
<xsl:value-of select="QUALARTNR"/>
</Article_Description>
<ITEM_CODE>
<xsl:value-of select="ARTNR"/>
</ITEM_CODE>
<xsl:for-each select="WPUBON01/IDOC/E1WPB01/E1WPB02/E1WBB03">
<E1WBB03>
<Condition_Type>
<xsl:value-of select="KONDITION"/>
</Condition_Type>
<xsl:for-each select="">
<E1WBB04>
<TAX_Code>
<xsl:value-of select="MWSKZ"/>
</TAX_Code>
<TAX_Amount>
<xsl:value-of select="MWSBT"/>
</TAX_Amount>
</E1WBB04>
</xsl:for-each>
</E1WBB03>
</xsl:for-each>
</E1WBB02>
</xsl:for-each>
</MT_SALES_PO_DATA_INBOUND>
</xsl:template>
</xsl:stylesheet>
Any idea how do i convert these XML to falt file USing XSLT or File Receiver adapter in XI???
Thanks -
XML to string using xslt or java mapping
Hi Experts,
I want to put xml into string and i need to change lessthan symbol to "<" and greaterthan symbol to ">" , can anyone please help me how to do this??? can you provide code for java mapping or XSLT mapping to achive this.
SOURCE
<?xml version="1.0" encoding="UTF-8"?>
<ns0:source_mt xmlns:ns0="urn:ppp:prototype">
<row>
<name1>IT</name1>
<name2>SOLUTIONS</name2>
</row>
</ns0:source_mt>
TARGET
<?xml version="1.0" encoding="UTF-8"?>
<ns0:target_mt xmlns:ns0="urn:ppp:prototype">
<row>
<Body>"<"name1">" IT"<"/name1">" "<"name2">" SOLUTIONS"<";/name2">" </Body>
</row>
</ns0:target_mt>Hi ,
here is the XSLT code to obtain the desired output
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<ns0:target_mt xmlns:ns0="urn:ppp:prototype">
<xsl:for-each select="//row">
<row>
<Body>
<xsl:for-each select="name1">
<xsl:value-of select="concat('*"<"name1">"*',normalize-space(.),'*"<"/name1">"*')"></xsl:value-of>
</xsl:for-each>
<xsl:for-each select="name2">
<xsl:value-of select="concat('*"<"name2">"*',normalize-space(.),'*"<"/name2">"*')"></xsl:value-of>
</xsl:for-each>
</Body>
</row>
</xsl:for-each>
</ns0:target_mt>
</xsl:template>
</xsl:stylesheet>
output produced as viewed in browser is
http://postimage.org/image/1lqbgw8kk/
Now to obtain exactly the output you posted earlier here is the code
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<ns0:target_mt xmlns:ns0="urn:ppp:prototype">
<xsl:for-each select="//row">
<row>
<Body>
<xsl:for-each select="name1">
<xsl:value-of select="concat('*"&lt"name1"&gt"*',normalize-space(.),'*"&lt"/name1"&gt"*')"></xsl:value-of>
</xsl:for-each>
<xsl:for-each select="name2">
<xsl:value-of select="concat('*"&lt"name2"&gt"*',normalize-space(.),'*"&lt"/name2"&gt"*')"></xsl:value-of>
</xsl:for-each>
</Body>
</row>
</xsl:for-each>
</ns0:target_mt>
</xsl:template>
</xsl:stylesheet>
output you can see from link below
http://postimage.org/image/2c7bzo478
Hope this helps.
Hi,
Could you please kindly let us know if the solution is working properly as per your requirement?
regards
Anupam
Edited by: anupamsap on Jul 26, 2011 6:29 AM
Edited by: anupamsap on Jul 26, 2011 4:10 PM -
How to choose between XSLT & JAVA Mapping.
HI
Usually Java mapping is preferred when the target structure is relatively complex and the transformation cannot be accomplished by simple graphical mapping.
When to use Java mapping
1) Java mapping are used when graphical mapping cannot help you.
Advantages of Java Mapping.
1)you can use Java APIs and Classes in it.
2) file look up or a DB lookup is possible
3) DOM is easier to use with lots of classes to help you create nodes and elements.
Java mapping can be used when you have complex mapping structures.
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
Java Mapping (Part I)
https://Difference in using java,xslt,message mapping
Java Mapping (Part I)
Java Mapping (Part II)
Check these for JAVA Mapping
Java Mapping (Part I)
Java Mapping (Part II)
Java Mapping (Part III)
Testing and debugging
Testing and Debugging Java Mapping in Developer Studio
Implermenting JAVA Mapping in PI
Implementing a Java Mapping in SAP PI
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/400ee77e-f9d6-2a10-2b8c-99281a4dcf6b
XSLT mappings can be imported into the Integration Repository; java methods can be called from within the XSLT style sheet. Advantages of this mapping are: open standard, portable, extensible via Java user-defined functions
XSLT Mapping
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15
xpath functions in xslt mapping
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=xslt+mapping&adv=false&sortby=cm_rnd_rankvalue#
XSLT MAPPING:
Generic XSLT Mapping for SAP XI,Part I
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
Generic XSLT Mapping for SAP XI,Part II
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
XSLT: Recursive Templates
XSLT: Recursive Templates
Easy RFC lookup from XSLT mappings using a Java helper class
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14
Step u2013 By u2013 Step Simple Approach for XSLT Mapping
Step By Step Simple Approach for XSLT Mapping
Advantages of using XSLT mapping
XSLT program itself defines its own target structure.
XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
XSLT can be used in combination with graphical mapping.
Multi-mapping is also possible using xslt.
XSLT can be used with ABAP and JAVA Extensions.
Disadvantages of using XSLT mapping
Resultant XML payload can not be viewed in SXMB_MONI if not in XML format (for service packs < SP14).
Interface mapping testing does not show proper error description. So errors in XSLT programs are difficult to trace in XI but can be easily identified outside XI using browser.
XSLT mapping requires more memory than mapping classes generated in Java.
It all depends upon the required Scenario and the requirement , which mapping has to be used.
cheers -
Using custom xslt file for mapping
I have a map using custom xsl. I deployed it to different enviroment. When my BTS application ran, it complained
There was a failure executing the receive pipeline: "WS.Pipeline.MsgTransformDebatchPipeline, WS.Pipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c7f3bdebaae529db" Source: "MsgTransformDecoder" Receive Port: "WS_Debatch"
URI: "C:\TestData\WS\InternalInput\*_batch.xml" Reason: Could not find file 'C:\WS\BTS\WS.Map\BatchOrder_to_CanonicalBatchOrder.xsl'.
I have to create corresponding path and copy my xsl file there to make it work. Why?
I tried Microsoft.Samples.BizTalk.ExtendingMapper.OverridingMapXslt sample. I compiled and deployed it, then I modified OverridingMapXslt.xslt to OverridingMapXslt2.xslt. I dropped input file and there was no complaint about missing OverridingMapXslt.xslt.
I thought .xsl is treated like any other source code file and is compiled into the assembly at build time. Why I got this error?
Thanks in advance!!!Unless you've compiled the .xsl into your custom component as a Resource, then yes, that exact path has to exist anywhere it will run.
However, as la Cour points out, a BizTalk Map has a Custom XSLT Path property that will take care of that for you. -
Hi Folks,
please, i need a step by step Solution for calling Value Mapping with XSLT Mapping Program.
best regards MichaelXSLT call Value Mapping
Maintain the value mapping using the option available in the Integration directory. The following values should be entered for maintaining the value mapping. In the XSLT Mapping use the Java function Valuemappingaccessor to read the values from the table.
Class ValueMappingAccessor
This class is used read the Value mapping stored in the Integration server (Java Cache). Class has a method getValueMapping. The Class is imported into the SWC Eyyy_xxxx under namespace http://xxx.ash.com/COMMON/Common
Method public static String getValueMapping(String srcContext, String dstContext, String srcAgency, String srcSchema, String dstAgency, String dstSchema, String key, Map inputParam, String throwException)
Paramters Description
srcContext Source context in the Integration server (Java Cache) under which, the value is stored.
For example, if the source values are stored using standard Value mapping table in the ID, then use source context as http://sap.com/xi/XI
dstContext Destination context in the Integration server (Java Cache) under which the value is stored
For example, if the source values are stored using standard Value mapping table in the ID, then Target context as http://sap.com/xi/XI
srcAgency Source Agency, a unique identifying value, value to be used is not yet decided.
srcSchema Source Schema, For example this can be source field name
key Source field value, that is required to determine the target, In the figure 1 shown below, We need to send IN to get India
dstAgency Destination Agency, a unique identifying value, value to be used is not yet decided
dstSchema Destination Schema, For example this can be target field name
inputParam Mapping transformation constants, to write the trace into the header of the message
throwException An indicator to throw an exception, if the value is not found in the cache. If the parameter is set to true or TRUE, an exception is raised & message fails in the mapping step of the Pipe line.
Returns the value, that is stored in the Value mapping context for the given parameters
If the value mapping is maintained using Integration Directory value mapping, then we need to call the value mapping function as follows
If it has to be called using XSLT Mapping., then the sample code shows how to use the java class the java class ValueMappingAccessor.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.ashok.com/idoctofile/employee" xmlns:ValueMap="java:com.xxx.yyy.ValueMappingAccessor">
<xsl:param name="CountryCode">
<xsl:value-of select="ns0:MT_EMPDETAILS/Country"/>
</xsl:param>
<xsl:param name="inputparam"/>
<xsl:template match="/">
<ns0:MT_EMPADDRESS xmlns:ns0="http://www.ashok.com/idoctofile/employee">
<EmployeeNo>
<xsl:value-of select="ns0:MT_EMPDETAILS/EmployeeNo"/>
</EmployeeNo>
<FirstName>
<xsl:value-of select="ns0:MT_EMPDETAILS/FirstName"/>
</FirstName>
<LastName>
<xsl:value-of select="ns0:MT_EMPDETAILS/LastName"/>
</LastName>
<Address1>
<xsl:value-of select="ns0:MT_EMPDETAILS/AddressLine1"/>
</Address1>
<Address2>
<xsl:value-of select="ns0:MT_EMPDETAILS/AddressLine2"/>
</Address2>
<City>
<xsl:value-of select="ns0:MT_EMPDETAILS/City"/>
</City>
<State>
<xsl:value-of select="ns0:MT_EMPDETAILS/State"/>
</State>
<Country>
<xsl:if test="function-available('ValueMap:getValueMapping')">
<xsl:value-of select="ValueMap:getValueMapping('http://sap.com/XI/xi', 'http://sap.com/XI/xi', 'Canonical','Country', 'KCRS', 'Country', $CountryCode, $inputparam, 'TRUE')"/>
</xsl:if>
</Country>
<ZipCode>
<xsl:value-of select="ns0:MT_EMPDETAILS/Zipcode"/>
</ZipCode>
</ns0:MT_EMPADDRESS>
</xsl:template>
</xsl:stylesheet>
If the values are maintained using Value mapping replication technique
Edited by: Ashok Reddy Thatigutla on Feb 15, 2008 9:43 AM
Edited by: Ashok Reddy Thatigutla on Feb 15, 2008 9:44 AM
Edited by: Ashok Reddy Thatigutla on Feb 15, 2008 10:06 AM -
Very simple XSLT string replacing question
Hi,
This is a really simple question for you guys, but it took me long, and i still couldn't solve it.
I just want to remove all spaces from a node inside an XML file.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<root insertedtime="2008-05-01T14:03:00.000+10:00" pkid="23421">
<books>
<book type='fiction'>
<author>John Smith</author>
<title>Book title</title>
<year>2 0 0 8</year>
</book>
</books>
</root>in the 'year' node, the value should not contain any spaces, that's the reason why i need to remove spaces using XSLT. Apart from removing space, i also need to make sure that the 'year' node has a non-empty value. Here's the XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//books/book[@type='fiction']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="id">101</xsl:attribute>
<xsl:call-template name="emptyCheck">
<xsl:with-param name="val" select="year"/>
<xsl:with-param name="type" select="@type"/>
<xsl:with-param name="copy" select="'true'"/>
</xsl:call-template>
<xsl:value-of select="translate(year, ' ', '')"/>
</xsl:copy>
</xsl:template>
<!-- emptyCheck checks if a string is an empty string -->
<xsl:template name="emptyCheck">
<xsl:param name="val"/>
<xsl:param name="type"/>
<xsl:param name="copy"/>
<xsl:if test="boolean($copy)">
<xsl:apply-templates select="node()"/>
</xsl:if>
<xsl:if test="string-length($val) = 0 ">
<exception description="Type {$type} value cannot be empty"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>The 'emptyCheck' function works fine, but the space replacing is not working, this is the result after the transform:
<?xml version="1.0" encoding="utf-8"?>
<root insertedtime="2008-05-01T14:03:00.000+10:00" pkid="23421">
<books>
<book type="fiction" id="101">
<author>John Smith</author>
<title>Book title</title>
<year>2 0 0 8</year>2008</book>
</books>
</root>The spaced year value is still there, the no-space year is added outside the 'year' tags'
anyone can help me, your help is extremely appreciated!
Thanks!You should add a template for 'year' :<xsl:template match="year">
<year><xsl:value-of select="translate(.,' ','')"/></year>
</xsl:template>and remove the translate call in the 'book' template.
It would be better to add a 'priority' attribute at each template so it would be explicit which template to use because match="@*|node()" could be interpreted by another transform engine as the unique template to be used !
Maybe you are looking for
-
I can't find my touch id in the settings app on my iphone 5s that i restored today
i got my 5s about a week ago and i was able to access my touch id OPTION at that time but i was not able to activate it until today. but after a while (about 8 hours) later my phone wasn't displaying the home screen even after i would press the sleep
-
Production Variance Analysis for External Process Cost
Dear all, We are on 4.7 R3. In production order we have routing/operation with mutliple external processes. The problem is production order cost analysis (CO03) displayed the external process cost variance in lump sum (it adds multiple external proce
-
With the latest version of Firefox (running on Windows Vista Business), the separate frame which is opened by 'Verified by Visa' after a purchase transaction, is now blocked saying that I am trying to connect to an untrustworty site. I guess this is
-
Hi, what is the default URL for a Peoplesoft HR system installed with Weblogic 8.1 on Win 2003 server ? I mean If I install it with all default options on myserver should it be something like this : http://myserver.com:80/myhrsystem Otherwise is ther
-
No guardar cambios de lenguaje
Después de cambiar idioma a Español al entrar nuevamente a SBO vuelve a estar Czech. El usuario de la estación de trabajo es Administrador de su equipo. ¿A que se debe esta situación y como se resuelve? Gracias