Query on XSLT mapping
how to build a scenario with XSLT mapping
Hi
Go through these
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
Some scenarios
/people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
Similar Messages
-
XML not well formed in - XSLT mapping
Hi,
I am doing a simple xslt mapping wherein my Source data structure is
MT
|__ details
|__ Records
|_emp_no
|_ emp_name
|_emp_dno
In XSL file i hv specified <xsl:template match="MT">
and I am using <for-each select="details/Records">
when I m testing it in Interface mapping, it is giving me error "XML not well formed"
can anybody please suggest whats the problem in the code??
Thank you,
Anu SinghalHi Anu,
I think in the select query in xslt mapping u have to mention the expression "//" so that for each iteration it can go according the path.
< for-each select = " //details/records">
I have some sample code of same type...just check it..
<xsl:template match="/">
<MT_EMP_TARGET>
<xsl:for-each select="//EMP_DATA">
<EMP_DATA>
<xsl:variable name="fname" select="//EMP_DATA/First_Name"/>
<xsl:variable name="lname" select="//EMP_DATA/Last_Name"/>
<Emp_Code><xsl:value-of select="//EMP_DATA/Emp_Code"/></Emp_Code>
<Name><xsl:value-of select="concat($fname,' ',$lname)"/></Name>
<Join_Dt><xsl:value-of select="//EMP_DATA/Join_Dt"/></Join_Dt>
<Designation><xsl:value-of select="//EMP_DATA/Level"/></Designation>
<Dept><xsl:value-of select="//EMP_DATA/Dept"/></Dept>
</EMP_DATA>
</xsl:for-each>
</MT_EMP_TARGET>
</xsl:template>
For more info:
http://www.w3schools.com/xsl/el_for-each.asp
Cheers,
Prasanthi.
Reward marks if helpful. -
Position function query in XSLT
I have a query regarding XSLT mapping
I have two E1EDK03 segments for the same qualifier. But I want the values based on posiotion
Example:
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110720</DATUM>
</E1EDK03>
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110905</DATUM>
</E1EDK03>
If position = 1, I need the 1st set of E1EDK03
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110720</DATUM>
</E1EDK03>
If position = 2, I need the 2nd set of E1EDK03
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110905</DATUM>
</E1EDK03>
How to achieve that using XSLT
ThanksHi,
Since we have E1EDK03 with same qualifier 012, I don't have any other identifier to distinguish them, because at one instance I need 1st occurrence of E1EKD03 structure and another instance I need the 2nd occurrence of E1EDK03.
If you observe, only DATUM will have different values. I was trying to do that using position function
I have defined a variable to copy the segments and later trying to get the each segment based on position
<!--copying all the E1EDK03 qualifier 012 segments -->
<xsl:variable name="e1edk03_qual_012">
<xsl:for-each select="//IDOC/*">
<xsl:if test="starts-with(name(), 'E1EDK03') and IDDAT = '012'">
<xsl:copy-of select="."></xsl:copy-of>
</xsl:if>
</xsl:for-each>
</xsl:variable>
Now the above code has
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110720</DATUM>
</E1EDK03>
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110905</DATUM>
</E1EDK03>
I want to split these into two E1EDK03 segments and use further in the XSLT mapping and populate in the target
Thanks -
Hi All
I have done a XSLT mapping to map a flat file structure to a hierarchical structure. But my 3rd level node is getting repeated for 2nd level node. Please find the details below
Source Structure - flat file
Header - 1
Record - 1....unbound
Forecast - 1....unbound
Target Structure
level1 - MessageHeader - 1
level1 - ProductActivity - 1
level 2 Record - 1...unbound
level 3 Forecast - 1...unbound
*Sample Format of Source file*
Header
Record1
Forecast1.1
Forecast1.2
Record2
Forecast 2.1
Forecast 2.2
Now after execution of XSLT mapping the output I am getting contains all Forecast nodes for every record. For example output of above mentioned format is
*Sample Format of target structure*
MessageHeader
ProductActivity
Record1
Forecast1.1
Forecast1.2
Forecast2.1
Forecast2.2
Record2
Forecast1.1
Forecast1.2
Forecast2.1
Forecast2.2
Expected Output
MessageHeader
ProductActivity
Record1
Forecast1.1
Forecast1.2
Record2
Forecast2.1
Forecast2.2
Here is code for forcast row
<!-- TimeSeries: Net demand forecast(Dynamic replenishment) and Planned Receipt (SNI)-->
<xsl:if test="$ProcessFlag= 'SM'">
<OrderForecastTimeSeries>
<xsl:for-each select="//Forecast">
<Item>
<ValidityPeriod>
<StartDateTime><xsl:value-of select="substring(./ForecastDate, 1,4)"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="substring(./ForecastDate,5,2)"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="substring(./ForecastDate,7,2)"/>
<xsl:text>T</xsl:text>
<xsl:text>00:00:00</xsl:text>
</StartDateTime>
<EndDateTime>
<xsl:value-of select="substring(./ForecastDate, 1,4)"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="substring(./ForecastDate,5,2)"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="substring(./ForecastDate,7,2)"/>
<xsl:text>T</xsl:text>
<xsl:text>00:00:00</xsl:text>
</EndDateTime>
</ValidityPeriod>
<Quantity>
<xsl:attribute name="unitCode"><xsl:value-of select="Unit"/></xsl:attribute>
<xsl:value-of select="Quantity"/>
</Quantity>
</Item>
</xsl:for-each>
</OrderForecastTimeSeries>
</xsl:if>
Edited by: Amol on Jul 21, 2009 3:26 AMHi Amol,
Try the below mentioned and see if can achieve this:
Hi Amol,
Try to do it this way and see if it works:
In side loop for <xsl:for-each select = "/Record">
Dont use for-each for ForeCast.
Take the count of "ForeCast" by using the Count() function. Now use it as a predicate for ForeCast.
EG: /ForeCast [CountValue - (CountValue-i)]
Here i should be 1 and every time the loop is incremented, i should also increment by one.
Just try if you can achieve this.
Regards,
Anshul
Warm Regards,
Anshul -
IDOC Generation Using XSLT Mapping[Query]
Hi,
I am working on File to IDOC scenario. I have used XSLT mapping. It is necessary to generate EDI_DC40 segment for IDOC in XSLT?
-KavitaHi Kavita,
please take a look at note: 728792
(Fields of the IDoc control record )
it describes your scenario
Regards,
michal -
XSLT Mapping :-- End to End Scenario
Can any one provide XSLT Mapping End to End scenario with screen shots?
HI
XSLT Mapping
XSLT stands for EXtensible Stylesheet Language Transformations. It is an XML based language for transforming XML documents into any other formats suitable for browser to display, on the basis of set of well-defined rules.
Using XSLT mapping in a ccBPM scenario
File to Multiple IDocs (XSLT Mapping)
Steps required for developing XSLT Mapping
u2022 Create a source data type and a target data type
u2022 Create Message types for the source and target data types.
u2022 Create Message Interfaces includes Inbound Message interface and Outbound Message interface.
u2022 XSLT Mapping does not require creation of Message mapping, so donu2019t create any Message mapping.
u2022 Create an .XSL file which converts source data type into target data type.
u2022 Zip that .xsl file and import it into Integration Repository under Imported Archives.
u2022 In Interface Mapping choose mapping program as XSL and specify this zip program. (Through search help you will get XSL Mapping programs that you imported under Imported Archives, select your corresponding XSL Program)
u2022 Test this mapping program by navigating to Test tab.
By having look at above steps you can easily find out that this mapping is no where different from other mapping programs, here the challenging lies in creating an XSLT file. If you spend couple of minutes in studying XPATH tutorial you would be in ideal position to create an XSL Transformation (.xsl extension).
If you still find difficulties in generating XSL Transformation, then you can make use of a tool u201CAltova MapForceu201D which will create XSL file for you.
Steps for creating XSL file using this tool:
1. Open the Alto MapForce, import the source .xml and .xsd file in it
2. Similarly import the target .xml and .xsd in MapForce.
3. These two data files should match with source and target data types in Integration Repository.
4. Complete the graphical mapping using extensive list of XSLT functions available there.
5. Save the mapping file.
6. Click the XSLT tab. You will have the entire xslt logic there.
7. Copy that content and save it as .xsl file.
8. Zip above .xsl file and import the same into IR under Imported Archives.
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#
complete mapping guide:
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
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
http://www.devguru.com/Technologies/xslt/quickref/xslt_element_applytemplates.html
cheers
Edited by: vemuganti naga phalguna on Jul 2, 2008 8:59 AM
Edited by: vemuganti naga phalguna on Jul 2, 2008 9:07 AM -
Is it possible to replace XSLT mapping in place of Graphical mapping
Is it possible to do XSLT mapping in place of Graphical mapping, in any normal scenario?
Means the fuctionality we do by using Graphical mapping(like the operations by using node functions etc...) could possible to do with XSLT Mapping?HI
yes it is possible to replace the graphical mapping with the XSLT mapping.
But using XSLTs degrade the performance of the interface and moreover they are not easily maintainable.
Refer the below links for assistance on XSLT Mapping:
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
http://www.devguru.com/Technologies/xslt/quickref/xslt_element_applytemplates.html
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#
Using XSLT mapping in a ccBPM scenario
File to Multiple IDocs (XSLT Mapping)
Comparsion of Different mappings:
Comparing Performance of Mapping Programs
Complete mapping guide url:
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
cheers -
A null object loaded from local variable 'o' in XSLT mapping
Hi experts,
We are facing an issue in XSLT mapping for one of the inbound scenario.
While executing the source message at mapping level, it is failing with the error text - "javax.xml.transform.TransformerException: com.sap.engine.lib.xsl.xpath.XPathException: Error parsing query -> java.lang.NullPointerException: while trying to invoke the method java.lang.Object.toString() of a null object loaded from local variable 'o'
Kindly help us on this issue!
FYI - We are facing this issue in PO 7.4 version.
Best Regards,
Uday.HI Hareesh,
Thanks for your inputs...
We are migrating the interface from PI7.1 to PI 7.4 at this one we are getting the error as mentioned the earlier. we are uanle to run it in the mapping level as well.
Why are we getting the error?As this is working in PI7.1 version
Please help us on this. -
Java Error in RFC Lookup in XSLT Mapping usinf Java helper class
Hi All,
I am doing RFC Lookup in XSLT Mapping using Java Helper class.
The Lookup works fine when called one RFC at a time However my requirement is I want to do 2 Lookups.
Both Lookups works when done individually however when I call both lookups in one mapping I get following error "javax.xml.transform.TransformerException: DOMSource whose Node is null."
Following is the code I have written in XSLT for the lookup:
<xsl:template name="Lookup_1">
<xsl:param name="STDPN"/>
<rfc:RFC_READ_TABLE>
<QUERY_TABLE>KNA1</QUERY_TABLE>
<OPTIONS><item><TEXT>
<xsl:value-of select="$STDPN"/>
</TEXT></item>
</OPTIONS>
<FIELDS>
<item>
<FIELDNAME>KUNNR</FIELDNAME>
</item>
</FIELDS>
</rfc:RFC_READ_TABLE>
</xsl:variable>
<xsl:variable name="response" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request, 'BS_D, 'cc_RfcLookup', $inputparam)"/>
<xsl:element name="STDPN">
<xsl:value-of select="$response//DATA/item/WA"/>
</xsl:element>
</xsl:template>
<xsl:template name="Lookup_2">
<xsl:param name="BELNR"/>
<xsl:variable name="Query">AGMNT = '<xsl:value-of select="$BELNR"/>'</xsl:variable>
<xsl:variable name="request1">
<rfc:RFC_READ_TABLE>
<QUERY_TABLE>ZTABLE</QUERY_TABLE>
<OPTIONS><item><TEXT>
<xsl:value-of select="$Query"/>
</TEXT></item>
</OPTIONS>
<FIELDS>
<item>
<FIELDNAME>KUNAG</FIELDNAME>
</item>
</FIELDS>
</rfc:RFC_READ_TABLE>
</xsl:variable>
<xsl:variable name="response1" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request1, 'BS_D','cc_RfcLookup', $inputparam)"/>
<xsl:element name="BELNR">
<xsl:value-of select="$response1//DATA/item/WA"/>
</xsl:element>
</xsl:template>
My Question: Am I doing anything wrong? Or Is it possible to call multiple lookups in one XSLT?
Thanks and Regards,
AtulHi Atul,
I had the same problem like you had.
The main Problem is that with the example code the request variable is created as NodeList object. In XSLT a variable is somekind of a constant and can't be changed. As the request object is empty after the first request the programm fails at the following line:
Source source = new DOMSource(request.item(0));
So I've created a workaround for this problem.
In the call of the template I've put the request as a parameter object at the template call:
<xsl:with-param name="req">
<rfc:PLM_EXPLORE_BILL_OF_MATERIAL xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<APPLICATION>Z001</APPLICATION>
<FLAG_NEW_EXPLOSION>X</FLAG_NEW_EXPLOSION>
<MATERIALNUMBER><xsl:value-of select="value"/></MATERIALNUMBER>
<PLANT>FSD0</PLANT>
<VALIDFROM><xsl:value-of select="//Recordset/Row[name='DTM-031']/value"/></VALIDFROM>
<BOMITEM_DATA/>
</rfc:PLM_EXPLORE_BILL_OF_MATERIAL>
</xsl:with-param>
With this change the request will be provided as a String object and not as a NodeList object.
Afterwards the RfcLookup.java has to be changed to the following:
package com.franke.mappings;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sap.aii.mapping.lookup.Channel;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.lookup.RfcAccessor;
import com.sap.aii.mapping.lookup.LookupService;
import com.sap.aii.mapping.lookup.XmlPayload;
* @author Thorsten Nordholm Søbirk, AppliCon A/S
* Helper class for using the XI Lookup API with XSLT mappings for calling RFCs.
* The class is generic in that it can be used to call any remote-enabled
* function module in R/3. Generation of the XML request document and parsing of
* the XML response is left to the stylesheet, where this can be done in a very
* natural manner.
* TD:
* Changed the class that request is sent as String, because of IndexOutOfBound-exception
* When sending multiple requests in one XSLT mapping.
public class RfcLookup {
* Execute RFC lookup.
* @param request RFC request - TD: changed to String
* @param service name of service
* @param channelName name of communication channel
* @param inputParam mapping parameters
* @return Node containing RFC response
public static Node execute( String request,
String service,
String channelName,
Map inputParam)
AbstractTrace trace = (AbstractTrace) inputParam.get(StreamTransformationConstants.MAPPING_TRACE);
Node responseNode = null;
try {
// Get channel and accessor
Channel channel = LookupService.getChannel(service, channelName);
RfcAccessor accessor = LookupService.getRfcAccessor(channel);
// Serialise request NodeList - TD: Not needed anymore as request is String
/*TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
Source source = new DOMSource(request.item(0));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamResult streamResult = new StreamResult(baos);
transformer.transform(source, streamResult);*/
// TD: Add xml header and remove linefeeds for the request string
request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+request.replaceAll("[\r\n]+", "");
// TD: Get byte Array from request String to send afterwards
byte[] requestBytes = request.getBytes();
// TD: Not used anymore as request is String
//byte[] requestBytes = baos.toByteArray();
trace.addDebugMessage("RFC Request: " + new String(requestBytes));
// Create input stream representing the function module request message
InputStream inputStream = new ByteArrayInputStream(requestBytes);
// Create XmlPayload
XmlPayload requestPayload =LookupService.getXmlPayload(inputStream);
// Execute lookup
XmlPayload responsePayload = accessor.call(requestPayload);
InputStream responseStream = responsePayload.getContent();
TeeInputStream tee = new TeeInputStream(responseStream);
// Create DOM tree for response
DocumentBuilder docBuilder =DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = docBuilder.parse(tee);
trace.addDebugMessage("RFC Response: " + tee.getStringContent());
responseNode = document.getFirstChild();
} catch (Throwable t) {
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
trace.addWarning(sw.toString());
return responseNode;
* Helper class which collects stream input while reading.
static class TeeInputStream extends InputStream {
private ByteArrayOutputStream baos;
private InputStream wrappedInputStream;
TeeInputStream(InputStream inputStream) {
baos = new ByteArrayOutputStream();
wrappedInputStream = inputStream;
* @return stream content as String
String getStringContent() {
return baos.toString();
/* (non-Javadoc)
* @see java.io.InputStream#read()
public int read() throws IOException {
int r = wrappedInputStream.read();
baos.write(r);
return r;
Then you need to compile and upload this class and it should work.
I hope that this helps you.
Best regards
Till -
How can i access value mapping table using xslt mapping
Hi All,
I have maintained value mapping table in integration directory.I want to access the data from the value mapping table in XSLT mapping using java function.PLease suggest me to do this.
Thanks
Pullarao.Value mapping that thread should solve your query !!!
-
Dear SDN,
In an integration scenario we are using sender File Adapter and a ABAP XSLT Mapping.
Is there any way to get the source FileName from such mapping. Im trying to use the adapter-specific message attributes, but it doesn't work, and I didn´t find an example, probably I and doing somthing wrong.
regards,
GPThank you for your help,
I just try to access the adapter-specific attibutes using:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
<xsl:variable name="filename" select="key:create('http://sap.com/xi/XI/System/File', 'Directory')" />
</xsl:stylesheet>
but the following error raised:
<SAP:Stack>Error while calling mapping program YXSLT_TEST (type Abap-XSLT, kernel error ID CX_XSLT_RUNTIME_ERROR) Call of unknown function</SAP:Stack>
have you had this situation? -
In which cases we will go for XSLT MAPPING?
What are different functions available in altova map force ? please provide me the helpful material regards this?Hi,
Check this link..
http://help.sap.com/saphelp_nwpi711/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
STEPS.
1. Open the Alto MapForce, import the source .xml and .xsd file in it
2. Similarly import the target .xml and .xsd in MapForce.
3.These two data files should match with source and target data types in Integration Repository.
4.Complete the graphical mapping using extensive list of XSLT functions available there.
5. Save the mapping file.
6.Click the XSLT tab. You will have the entire xslt logic there.
7.Copy that content and save it as .xsl file.
8. Zip above .xsl file and import the same into IR under Imported Archives.
Thanks. -
XSLT mapping Help Required.
XSLT mapping Help Required.
Hi Experts,
I am New to XSLT Mapping. I am practising the below Example:
InputXML File:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Persons111.xsl"?>
<ns0:MT_XSLT_Source xmlns:ns0="http://XYZ.com/gen">
<Person>
<FirstName>Anshul</FirstName>
<LastName>Chowdhary</LastName>
<Gender>Male</Gender>
<Address>
<Street>2nd Main</Street>
<Houseno>83/b</Houseno>
<City>Mysore</City>
</Address> </Person>
</ns0:MT_XSLT_Source>
XSL StyleSheet File:
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/Gen"
Xmlns:ns1=”http://XYZ.com/Test”>
<xsl:template match="/">
<ns1:MT_XSLT_Target>
<Title> <xsl:value-of select="ns0:MT_XSLT_Source/Person/Gender"/> </Title>
<Name> <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '), ns0:MT_XSLT_Source/Person/LastName)"/>
</Name>
<Street> <xsl:value-of select="concat(concat(ns0:Mt_XSLT_Source/Person/Address/Houseno,' '),
ns0:Mt_XSLT_Source/Person/Address/Street)"/> </Street>
<City> <xsl:value-of select="ns0:Mt_XSLT_Source/Person/Address/City"/> </City>
</ns1:MT_XSLT_Target>
</xsl:template>
</xsl:stylesheet>
The Desired Output shuold be:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:MT_XSLT_Target xmlns:ns1="http://XYZ.com/Test">
<Title>Male</Title>
<Name>Anshul Chowdhary</Name>
<Street>83/b 2nd Main</Street>
<City>Mysore</City>
</ns1:MT_XSLT_Target>
I have refered the xsl in xml and i am getting the below Oupt in a Single line like this:
Anshul Chowdhary Male 2nd Main 83/b Mysore
I am Unable to display in Target XML Fomrat as shown above. Please check and do the needful.
Regards,
GIRIDHARHi,
I have used below for testing.
Input xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Persons111.xsl"?>
<ns0:MT_XSLT_Source xmlns:ns0="http://XYZ.com/gen">
<Person>
<FirstName>Anshul</FirstName>
<LastName>Chowdhary</LastName>
<Gender>Male</Gender>
<Address>
<Street>2nd Main</Street>
<Houseno>83/b</Houseno>
<City>Mysore</City>
</Address> </Person>
</ns0:MT_XSLT_Source>
xsl code:
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://XYZ.com/gen"
xmlns:ns1="http://XYZ.com/Test">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<ns1:MT_XSLT_Target>
<Title> <xsl:value-of select="ns0:MT_XSLT_Source/Person/Gender"/> </Title>
<Name> <xsl:value-of select="concat(concat(ns0:MT_XSLT_Source/Person/FirstName,' '), ns0:MT_XSLT_Source/Person/LastName)"/>
</Name>
<Street> <xsl:value-of select="concat(concat(/ns0:MT_XSLT_Source/Person/Address/Houseno,' '),
/ns0:MT_XSLT_Source/Person/Address/Street)"/> </Street>
<City> <xsl:value-of select="/ns0:MT_XSLT_Source/Person/Address/City"/> </City>
</ns1:MT_XSLT_Target>
</xsl:template>
</xsl:stylesheet>
For testing in PI ,change the extension from .txt to .xsl and zip it and upload into PI as an imported archive .
Regards
Venkat -
Hi All
I am working on PI 7.1 where I have customized standard XSLT mapping according to my requirement.
I have to add 2 fields in the standard data type ReplenishmentOrder_Notfication from SNC 7.0 SWCV.
In standard scenario once IDOC STPPOD.DELVRY03 is released from ECC the PI scenario send this to SNC Proxy ReplenishmentOrderNotification_In.
In my requirement I have to send XML file generated from IDOC to one of Application Folder. I have customized data type, message type, operation mapping, service interface by coping standard things.
So the changes I have done in standard XSLT mapping are just changin name of data type and not added any mapping for the two new fields I have added to the data type as its not require at the moment.
When I am running test I am getting follwoing error in Trace. Here please notice that its mentioning standard xslt mapping program name only though on the top you see customized names.
Please give your inputs to resolve the issue. Thanks.
Operation Mapping
StppodDelvry03_MT_ReceivedDeliveryNotification_01
Name
StppodDelvry03_MT_ReceivedDeliveryNotification_01
Namespace
http://sap.com/xi/SNC/Global
Runtime error
TransformerException occurred during XSLT mapping StppodDelvry03_ReceivedDeliveryNotification_01 (http://sap.com/xi/SNC/Global, 46c20a71-248e-11dc-c4be-dd500a115642, -1)
<Trace level="1" type="B">CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV</Trace> <Trace level="1" type="T">Interface Mapping http://sap.com/xi/SNC/Global StppodDelvry03_ReceivedDeliveryNotification_01 </Trace> <Trace level="1" type="T">TransfromerException during XSLT processing: Thrown: javax.xml.transform.TransformerException: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(, row:1, col:8)(, row=1, col=8) -> com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(, row:1, col:8) at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:251) at com.sap.aii.ib.server.mapping.execution.AbstractMappingTransformer.transform(AbstractMappingTransfor
Edited by: Amol on May 22, 2009 3:26 PMHi Amol
for the error CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV
<Trace level="1" type="B">CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV</Trace> <Trace level="1" type="T">
just check this Thread issue is solved by restarting the service verifySenderAgreement
at thread
Re: Wrong Sender Agreement
Thanks
Abhishek -
Hi,
I have a scenario in which I need to post the data in JMS queue from a proxy call.
[Proxy>PI>JMS]. Here the MQ message is fed to a web application.
The scenario contains two mapping viz message and XSLT mapping.
The first one is message mapping and then XSLT is called.
Now in the XSLT mapping CDATA tag is called to skip the xml parsing and send to JMS queue for HTML output in web application.
My doubt is how can I achieve table formatting from PI. Few options can be
1) incorporate xsl in CDATA tag of XSLT mapping for HTML tag for table format?
2) instead of JMS queue, should I need to post in HTTP receiver directly?
3) Is it the xsl need to add in Web application side for the sending xml from PI?
Please help in my understanding.
Thanks
PV.Hi,
Try with Java Proxy,you can directly update data in to web application or if you web application team ready to accept data in the form of web service then you no need to generate output in the form of HTML.
Regards,
Raj
Maybe you are looking for
-
I'm having a heck of a time trying to move a video from a camcorder (.dv file) into iMovie and then burned onto a DVD. It was suggested by one customer service guy (for the DVD burner, Lacie) to compress it into Quicktime and then move to burner. But
-
New to forum. I have a Dell 2135cn printer that I bought one month ago. My brother just purchased a Mac Pro. I would love to get a Mac also, however how do I get my printer to work with my printer?
-
ACE20 Context - how to reset context configuration?
Hi, is there a way to reset/clear a particular context's configuration? I see there is a 'wri erase' within a context, but no reload/reset - neither from the context itself nor from the Admin... puzzling... I dont want to reload an entire blade just
-
Drop-down list is crashing my interactive PDF document
Hello, I'm using LiveCycle Designer 7.0 on Windows XP. I'm attempting to create some simple editable PDF documents for use by my security staff. I've created the forms and most fields work correctly, except for a simple drop-down list field with abou
-
Anyone knows when the ios 6 is going to be released?
?