Handling Namspaces in XSLT xpaths...
Hi,
I'm trying to generate the SOAP envelope using XSLT mapping. The source message to my mapping program, contains two fields:
a. username
b. pwd
But they come in with attached namespaces like ns1. How do I specify the xpath to get the data from them?
Regards,
Harsh
Hi Harsh,
-me again -
put the namespace declaration into the stylesheet element. like
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="namespace1">
Now you can select with
<xsl:value-of select="//ns1:a.username"/>
Regards,
Udo
Similar Messages
-
Hi,
1.Can you differentiate these XSLT, XPath and XQuery.
2.How Do I Force a Rollback in a BPEL Flow.
Thanks in advanceshree wrote:
1.Can you differentiate these XSLT, XPath and XQuery.XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations.
XQuery is to XML what SQL is to database tables. XQuery was designed to query XML data.
XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer are both built on XPath expressions.
http://www.w3schools.com/xsl/default.asp
http://www.w3schools.com/xquery/default.asp
http://www.w3schools.com/xpath/default.asp
Cheers,
Vlad -
I want to ask you to help me. I have problem with next task :
Input data :
Input data : build.xml
<project name="name of project" default="compile" basedir=".">
<target name="all" depends="clean,compile"
description="Clean build and dist directories, then compile"/>
<target name="clean"
description="Delete old build and dist directories">
</target>
<target name="compile" depends="prepare"
description="Compile Java sources">
</target>
<target name="dist" depends="compile,javadoc"
description="Create binary distribution">
</target>
<target name="install" depends="compile"
</target>
<target name="javadoc" depends="compile"
description="Create Javadoc API documentation">
</target>
<target name="list"
</target>
<target name="prepare">
</target>
</project>
Me should build table of dependency using XSLT+XPath
Target Dependencies
clean
list
prepare
all ______ clean
________ compile
__________ - prepare
compile | prepare
dist ______ compile
___________ - prepare
javadoc
- compile
- prepare
install ____ compile
__________ -prepare
javadoc ___ compile
___________ -prepare
I have read article and done example (http://www.ibm.com/developerworks/xml/library/x-xslrecur/ )
Could you help me, please ?
My source :
<!-- -->
<tr style="background-color: gray;">
<td align="center">TARGET DEPENDENCY</td>
</tr>
<tr>
<td width="100%">
<table border="1"
class="targetDependencyANT" align="center">
<tr>
<td
style="background-color: olive">
Target
</td>
<td
style="background-color: olive">
Dependencies
</td>
</tr>
<xsl:call-template
name="printEmptyTarget" />
<xsl:call-template
name="printNotEmptyTarget" />
</table>
</td>
</tr>
<xsl:template name="printEmptyTarget">
<xsl:for-each select="project/target[not(@depends)]">
<tr>
<td>
<xsl:value-of select="@name" />
</td>
</tr>
</xsl:for-each>
</xsl:template>
<xsl:template name="printNotEmptyTarget">
<xsl:for-each select="project/target[@depends!='']">
<tr>
<td>
<xsl:value-of select="@name" />
</td>
<td>
<xsl:value-of select="@depends" />
<<<<<<<<<<<<< Start // This I have problem >>>>>>>>>>>>>>>>>>>>>>>>
<xsl:variable name="targetName" select="@name = @depends">
<xsl:value-of select="$targetName" />
<<<<<<<<<<<<< End // This I have problem >>>>>>>>>>>>>>>>>>>>>>>>
</xsl:variable>
</td>
</tr>
</xsl:for-each>
</xsl:template>
Edited by: Sun_day on Sep 14, 2007 1:48 AMshree wrote:
1.Can you differentiate these XSLT, XPath and XQuery.XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations.
XQuery is to XML what SQL is to database tables. XQuery was designed to query XML data.
XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer are both built on XPath expressions.
http://www.w3schools.com/xsl/default.asp
http://www.w3schools.com/xquery/default.asp
http://www.w3schools.com/xpath/default.asp
Cheers,
Vlad -
One or two XSLT/XPath bugs
I have an XSLT problem that may actually be two problems. My stylesheet works as expected in MSXML and Xalan but does very weird things in Oracle's XSLT processor. Below is the stylesheet, followed by some test input. It looks like just one bug if you run it on this test input (the "extra rows" generated get numbered 10-14 rather than 20-24, but $count and $remainder seem to have the right values). If you delete all COWS after SEQNUM 13, however, then $count and $remainder are both wrong. So it may be one bug, may be two.
XSLT:
====================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- output a CHICKENROW for each CHICKEN in the source document, and guarantee there's a positive multiple of 8 rows total -->
<xsl:template match="/">
<CHICKENROWS>
<xsl:for-each select="/COWS/COW[KEY1 = '1']">
<CHICKENROW seqnum="{SEQNUM}">
<xsl:value-of select="CHICKEN"/>
</CHICKENROW>
</xsl:for-each>
<xsl:variable name="count" select="count(/COWS/COW[KEY1 = '1'])"/>
<!-- uncomment this for debugging
<count><xsl:value-of select="$count"/></count>
-->
<xsl:variable name="remainder" select="$count mod 8"/>
<!-- uncomment this for debugging
<remainder><xsl:value-of select="$remainder"/></remainder>
-->
<!-- if we have fewer than a positive multiple of 8 rows, add empty rows -->
<xsl:if test="$count = 0 or $remainder > 0">
<xsl:variable name="startSeqnum">
<xsl:choose>
<xsl:when test="/COWS/COW[KEY1 = '1']/SEQNUM">
<xsl:for-each select="/COWS/COW[KEY1 = '1']/SEQNUM">
<xsl:if test="not(/COWS/COW[KEY1 = '1' and SEQNUM > current()])">
<xsl:value-of select=". + 1"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:text>1</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- insert as many empty rows as necessary to guarantee we have at least 8 rows and the total # of rows is a multiple of 8 -->
<xsl:call-template name="emptyRows">
<xsl:with-param name="seqnum" select="$startSeqnum"/>
<xsl:with-param name="endSeqnum" select="$startSeqnum + (8 - $remainder) - 1"/>
</xsl:call-template>
</xsl:if>
</CHICKENROWS>
</xsl:template>
<!--
Recursively insert empty rows with seqnums starting at $seqnum and going to $endSeqnum
-->
<xsl:template name="emptyRows">
<xsl:param name="seqnum"/>
<xsl:param name="endSeqnum"/>
<xsl:if test="$seqnum <= $endSeqnum">
<CHICKENROW seqnum= "{$seqnum}"></CHICKENROW>
<xsl:call-template name="emptyRows">
<xsl:with-param name="seqnum" select="$seqnum + 1"/>
<xsl:with-param name="endSeqnum" select="$endSeqnum"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
=======================================================
INPUT XML:
=======================================================
<COWS>
<COW>
<KEY1>1</KEY1>
<SEQNUM>1</SEQNUM>
<CHICKEN>ACMI2</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>2</SEQNUM>
<CHICKEN>ALTE</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>3</SEQNUM>
<CHICKEN>ANRO2</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>4</SEQNUM>
<CHICKEN>ARCO5</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>5</SEQNUM>
<CHICKEN>ARFR4</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>6</SEQNUM>
<CHICKEN>ARTRV</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>7</SEQNUM>
<CHICKEN>ASMO7</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>8</SEQNUM>
<CHICKEN>CAGE2</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>9</SEQNUM>
<CHICKEN>COUM</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>10</SEQNUM>
<CHICKEN>ERIOG</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>11</SEQNUM>
<CHICKEN>FEID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>12</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>13</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>14</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>15</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>16</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>17</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>18</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
<COW>
<KEY1>1</KEY1>
<SEQNUM>19</SEQNUM>
<CHICKEN>LEPID</CHICKEN>
</COW>
</COWS>... or maybe they're not bugs at all, but if they're not, they're at least a difference in implementation from MSXML and Xalan. Do I misunderstand the XPath/XSL I'm using here? Is Oracle's interpretation equally valid?
-
Hello all,
I am kind of a newbie to the xpath sort of translation.
I am curious on how to:
Grab the last element with data from the input side of my xsl ?
I appreciate any help on this.
JadenI guess I should explain what I am trying to accomplish :)
I am trying to map an inbound 856 thru the xsl transformation.
in the pack loop is the delivery detail id. under that are several item loops.
My issue is that the Item Loop has the serial number where the Pack loop has the delivery detail. I need to copy the deliver detail id for each of the items for the output side of my transformation.
I use the code /ns1:Transaction-856/ns1:Loop-HL/ns1:Segment-LIN/ns1:Element-234_1[last()]
But i get only the first number in my output?
Ty in advance
Jaden -
How to get a value from the previous element (XSLT/XPATH gurus ahoy!)
Hi All,
I am building an RTF template for a "letter of reference"-report. Sometimes there are several rows in the data, that need to be printed as one. This is due to consecutive temporary contracts, which will be printed out as one period of service.
Here's a simplified data example to illustrate the problem.
<ROW>
<START_DATE>01-01-1980</START_DATE>
<END_DATE>01-01-1988</END_DATE>
</ROW>
<ROW>
<START_DATE>01-01-1988</START_DATE>
<END_DATE>01-01-1990</END_DATE>
</ROW>
<ROW>
<START_DATE>01-01-2000</START_DATE>
<END_DATE>01-01-2005</END_DATE>
</ROW>
With the data above, I should print two lines:
01-01-1980 - 01-01-1990
01-01-2000 - 01-01-2005
I need to compare START_DATE of an element (except for the first one) with the END_DATE of the previous element, to find out whether to print the END_DATE for that element or not. How can I get that value from the previous element?
Thanks & Regards, Matildause this to get the following End_date
<?following-sibling::../END_DATE?>
Try this
<?for-each:/ROOT/ROW?>
==================
Current StartDate <?START_DATE?>
Current End Date <?END_DATE?>
Next Start Date <?following-sibling::ROW/END_DATE?>
Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
================
<?end for-each?>
o/p
==================
Current StartDate 01-01-1980
Current End Date 01-01-1988
Next Start Date 01-01-1990
Previous End Date
================
==================
Current StartDate 01-01-1988
Current End Date 01-01-1990
Next Start Date 01-01-2005
Previous End Date 01-01-1988
================
==================
Current StartDate 01-01-2000
Current End Date 01-01-2005
Next Start Date
Previous End Date 01 -
Xslt/xpath: count preceding elements which starts-with 'S'
Hi everybody,
I got the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<A1>
<FOO>1</FOO>
</A1>
<A1>
<FOO>2</FOO>
</A1>
<B1>
<FOO>3</FOO>
</B1>
<A1>
<FOO>4</FOO>
</A1>
</ROOT>
I want wo count all preceding Elements of each 3
How has the experssion has to look?
count(/ROOT/A1/FOO/preceding::[starts-with(.,'A')])
DOES not work
Any suggestions?
Regards Mario
Edited by: Mario Müller on Sep 12, 2008 2:23 AMHi Mario,
What are you using to test xsl expressions?
I am using XSL Tester, all sugestions that i gave you retrieve a solution. Therefore, this solution will depend from XML tree. For instance if you have something like this:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<A1>
<FOO>1</FOO>
<FOO>5</FOO>
<A1000>
<FOO>46</FOO>
<FOO>400</FOO>
</A1000>
<FOO>300</FOO>
</A1>
<A2>
<FOO>2</FOO>
<FO>6</FO>
</A2>
<B1>
<FOO>3</FOO>
</B1>
<A1>
<FOO>4</FOO>
<FO>7</FO>
</A1>
</ROOT>
Using this XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Result>
---- Expression ----
</Result>
</xsl:template>
</xsl:stylesheet>
Results using the expressions that i gave you, will be:
1.1
<xsl:value-of select="count(//FOO[1][starts-with(name(parent::node()),'A')])"/>
<?xml version="1.0" encoding="UTF-16"?>
<Result>7</Result>
1.2
<xsl:value-of select="count(//FOO[1][starts-with(name(parent::node()),'A')])"/>
<?xml version="1.0" encoding="UTF-16"?>
<Result>4</Result>
2.1
<xsl:value-of select="count(/ROOT/*/FOO[starts-with(name(parent::node()),'A')])"/>
<?xml version="1.0" encoding="UTF-16"?>
<Result>5</Result>
2.2
<xsl:value-of select="count(/ROOT/*/FOO[1][starts-with(name(parent::node()),'A')])"/>
<?xml version="1.0" encoding="UTF-16"?>
<Result>3</Result>
I think the last one, fits your solution. Give me more hints, maybe i can help you.
Best regards,
Pedro Pereira -
I just want to know in what kind of mapping requirements we can go with xslt mapping which is not supported in graphical mapping?
Please help me with few mapping requirements which is not supported in graphical mapping but we can achive using xslt mapping.Hi serach in SDN you will get everything ,...
anyways refer these links
A few example in which an XSLT mapping can be used:-
When the required output is other than XML like Text, Html or XHTML (html displayed as XML)
When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
When data is to be filtered based on certain fields (considering File as source)
When data is to be sorted based on certain field (considering File as source)
When data is to be grouped based on certain field (considering File as source)
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 provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
File content conversion at receiver side can be avoided in case of text or html output.
Multiple occurrences of node within tree (source XML) can be handled easily.
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.
XSLT program become lengthier as source structure fields grows in numbers.
XSLT program sometimes become complex to meet desired functionality.
Some XSL functions are dependent on version of browser.
Follow these links.
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
The following links give u step-by-step solution for 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
/people/udo.martens/blog/2006/04/26/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
Regds
Abhishek -
XSLT for payload with namespaces
Hello Experts, attn:Stefan.
I am using a XSLT to parse the input xml payload and retrieve the Value of a particular field which will be used for receiver determination.
The XSL code used by me is :
<?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"/>
<xsl:template match="/">
<ns1:Receivers xmlns:ns1="http://sap.com/xi/XI/System">
<Receiver>
<Service>
<xsl:value-of select="NemRefusionIndberetningSamling/NemRefusionIndberetningStruktur/HeaderStruktur/ReferenceAttributTekst" />
</Service>
</Receiver>
</ns1:Receivers>
</xsl:template>
</xsl:stylesheet>
And the input payload I am getting is something like:
<?xml version="1.0" encoding="utf-8"?>
<NemRefusionIndberetningSamling >
<DannetDatoTid>2010-04-22T12:14:28.036+02:00</DannetDatoTid>
<NemRefusionIndberetningStruktur xmlns="urn:oio:abc:nemrefusionindberetning:2009.07.03" MessageID="1">
<HeaderStruktur xmlns="urn:oio:abc:nemrefusionheader:2009.07.03">
<FravaerTypeKode>Sygdom</FravaerTypeKode>
<FravaerendeStruktur>
<FravaerendeTypeKode>Loenmodtager</FravaerendeTypeKode>
<LoenUnderFravaerIndikator>false</LoenUnderFravaerIndikator>
</FravaerendeStruktur>
<IndberetningUUIDIdentifikator>bf9cc44e-af15-4e19</IndberetningUUIDIdentifikator>
<ReferenceAttributTekst>S70CLNT007</ReferenceAttributTekst>
</HeaderStruktur>
</NemRefusionIndberetningStruktur>
</NemRefusionIndberetningSamling>
The XSLT works fine with above payload. But now we need to add namespaces in top level elements. So the payload will be like:
<NemRefusionIndberetningSamling xmlns="urn:oio:abc:nemrefusionsamling:2009.07.03" UUIDIdentifikator="DF8C1CB43B2E14F1A0C5005">
<DannetDatoTid>2010-04-22T12:14:28.036+02:00</DannetDatoTid>
<NemRefusionIndberetningStruktur xmlns="urn:oio:abc:nemrefusionindberetning:2009.07.03" MessageID="1">
<HeaderStruktur xmlns="urn:oio:abc:nemrefusionheader:2009.07.03">
<FravaerTypeKode>Sygdom</FravaerTypeKode>
<FravaerendeStruktur>
<FravaerendeTypeKode>Loenmodtager</FravaerendeTypeKode>
<LoenUnderFravaerIndikator>false</LoenUnderFravaerIndikator>
</FravaerendeStruktur>
<IndberetningUUIDIdentifikator>bf9cc44e-af15-4e19</IndberetningUUIDIdentifikator>
<ReferenceAttributTekst>S70CLNT007</ReferenceAttributTekst>
</HeaderStruktur>
</NemRefusionIndberetningStruktur>
</NemRefusionIndberetningSamling>
Top element being changed by addition of namespace, XSLT fails to retriev the value of required field i.e. <ReferenceAttributTekst>
Changed element:
"<NemRefusionIndberetningSamling xmlns="urn:oio:abc:nemrefusionsamling:2009.07.03" UUIDIdentifikator="DF8C1CB43B2E14F1A0C5005">"
I am sure that there should be a way to handle namespaces in XSLT. Please suggest me the correction to XSLT to handle this namespace addition to top element.
Kind Regards,
Abhijeet.In XSLT you put a prefix before the XPATH rule like this:
p1:root/p2:subnode/element
you declare the namespaces in header as attribute xmlns:p1="..."
Something like:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p1="..." ...>
In your example you have to consider, that namespaces without prefix are inherited to subnodes. That means you have to build your XPATH like this:
p1:NemRefusionIndberetningSamling/p2:NemRefusionIndberetningStruktur/p3:HeaderStruktur/p3:ReferenceAttributTekst -
Hi all,
What's the difference between the XPath and XQuery, can XPath has better performance than XQuery?
Regards,
Janeshree wrote:
1.Can you differentiate these XSLT, XPath and XQuery.XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations.
XQuery is to XML what SQL is to database tables. XQuery was designed to query XML data.
XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer are both built on XPath expressions.
http://www.w3schools.com/xsl/default.asp
http://www.w3schools.com/xquery/default.asp
http://www.w3schools.com/xpath/default.asp
Cheers,
Vlad -
Client side paging with jstl or xslt
Is there any way to provide client side paging with jstl or xslt/xpath. I have a jsp page with a limited amount of data, say less than 30 rows of data. I want to display 10 rows at a time. The data is returned to the page in xml format and I am currently using xslt to display the data (currently displays all rows on the page). I am looking for a way to update my xpath variables so I can provide paging capabilities. Is there any way to get the information from the request from the jsp to the xpath variables? Or does anyone have any other suggestions for implementing client side paging using either xslst - xpath or jstl? Thanks Vic.
I am loading the entire xml stream in the client and formatting using xslt. I only want to initially display 10 rows. I would like to implement client side paging. Is there any way to communicate with the xpath variables? Javascript?
-
Hi guys,
plz help me.plz tell me about MESSAGE-MAPPING,JAVA-MAPPING,ABAP-MAPING,XSLT-MAPPING.
with warm regards.
vikashHi,
XI provides 3 standard ways of interface mapping between source and target.
Graphical mapping
Java Mapping
XSLT Mapping
Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
ABAP mapping
XSLT mapping with ABAP Extensions
Graphical Mapping
Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
ABAP Mapping
A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
Java Mapping
Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
XSLT Mapping
One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
A few example cases in which an XSLT mapping can be used:-
When the required output is other than XML like Text, Html or XHTML (html displayed as XML)
When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
When data is to be filtered based on certain fields (considering File as source)
When data is to be sorted based on certain field (considering File as source)
When data is to be grouped based on certain field (considering File as source)\
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 provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
File content conversion at receiver side can be avoided in case of text or html output.
Multiple occurrences of node within tree (source XML) can be handled easily.
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.
XSLT program become lengthier as source structure fields grows in numbers.
XSLT program sometimes become complex to meet desired functionality.
Some XSL functions are dependent on version of browser.
Reward points if it helps......
Thanks,
Madhu -
Hi Expets,
We know that there are different mapping programs are available in XI environment like Graphical Mapping, Java Mapping, ABAP Mapping and XSLT Mapping. But on what basis we will choose one of these mapping programs?
I mean, which constraints would make me to choose specific mapping program?
Thanks,
Vijay Kumar T.Hi Vijay,
This is a very good question!!!
We need to decide mapping based on performance ,response time and complexity.It is found that, one should try Graphical mapping first, and if its not possible by this,then go for other mappings.
see here for more detalis of mapping
/people/udo.martens/blog/2006/08/23/comparing-performance-of-mapping-programs
At what situations we will go for ABAP mapping?
See these threads of similer discussion
ABAP Mapping
when we wil go for abap mapping ??
abap mapping
ABAP Mapping
A few example cases in which an XSLT mapping can be used:-
When the required output is other than XML like Text, Html or XHTML (html displayed as XML)
When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
When data is to be filtered based on certain fields (considering File as source)
When data is to be sorted based on certain field (considering File as source)
When data is to be grouped based on certain field (considering File as source)
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 provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
File content conversion at receiver side can be avoided in case of text or html output.
Multiple occurrences of node within tree (source XML) can be handled easily.
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.
XSLT program become lengthier as source structure fields grows in numbers.
XSLT program sometimes become complex to meet desired functionality.
Some XSL functions are dependent on version of browser.
see these also .. u might need this some day!!
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
JAVA mapping
How is JAVA mapping different from Graphical, XSLT and ABAP mapping?
Graphical mapping is an easiest and common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It may involve Java UDFs as a part of the mapping program. But sometimes with graphical mapping it is difficult or it may seem impossible to produce required output; for example text/html output, namespace change, sorting or grouping of records etc. A person comfortable with Object Oriented ABAP can go for ABAP mapping instead. One can also think of XSLT mapping as another option. In such cases, when java mapping is used the developer has full control over the message content and could manipulate it based on the output requirement. Hence, java mapping can prove to be an efficient approach.
A few example cases in which Java mapping can be used:-
When the required output is other than XML like Text, Html or XHTML (html displayed as XML).
When the data is to be extracted from input which is in text format.
When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
When data is to be filtered, sorted or grouped based on certain fields (considering File as source)
Advantages of using Java mapping
Java program itself defines its own target structure.
File content conversion at sender side can be avoided in case of text or html input.
File content conversion at receiver side can be avoided in case of text or html output.
Java can be used in combination with graphical mapping.
Multi-mapping is also possible using Java mapping.
Using Mapping Runtime constants we can determine all message related information such as Message ID, sender service etc.
Disadvantages of using Java mapping
Once the java mapping has been imported into XI, to incorporate any further changes one has to compile the java program and import the class file again into XI.
Thanqs
Biplab -
Transform date from dd-mon-yy to yyyy-mm-dd
Hi
I have a simple date transformation question.
my input date format is DD-MON-YY, I want this converted to YYYY-MM-DD
I did look into the xp20:format-dateTime and ora:formatDate but did not find a way
to control the input format. I did test the transformation below, and this one gives the expected output, as
long as the input is xp20:current-dateTime().
<xsl:value-of select="xp20:format-dateTime(xp20:current-dateTime(),'[Y0001]-[M01]-[D01]')"/>
How do I switch the date format to handle DD-MON-YY as input.
To be specific:
when ns:myDate=01-Aug-08' I would expect outcome as below,
<xsl:value-of select="xp20:format-dateTime(ns:myDate,'[Y0001]-[M01]-[D01]')"/> => 2008-08-01
but this is clearly not so.
any idea on how to do this, without starting a full substring-implementation?
according to this thread, it looks like we need to leave this to java, but I believe it must be possible to
handle this within xslt-transformation.
On the other hand, dd-mon-yy is not ISO, and four digit year would be unambiguous .
anyway:
Re: BPEL format Date issueI understand its frustrating to not get a solution from the xslt which is a strong language in itself. I have faced the same problem, but i got a way to do in xslt using templates.
If anybody is interested here is the solution.
My input value is for eg. '1-May-12'
Output value should be in ISO format '2012-05-01T00:00:00.000'
+<xsl:template name="formatDateTime">+
+<xsl:param name="DateTime"/>+
+<xsl:value-of select="concat('20',substring-after(substring($DateTime,oraext:last-index-within-string($DateTime,'-')),'-'))"/>+
+<xsl:text>-</xsl:text>+
+<xsl:choose>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Jan'">+
+<xsl:text>01</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Feb'">+
+<xsl:text>02</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Mar'">+
+<xsl:text>03</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Apr'">+
+<xsl:text>04</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='May'">+
+<xsl:text>05</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Jun'">+
+<xsl:text>06</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='July'">+
+<xsl:text>07</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Aug'">+
+<xsl:text>08</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Sep'">+
+<xsl:text>09</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Oct'">+
+<xsl:text>10</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Nov'">+
+<xsl:text>11</xsl:text>+
+</xsl:when>+
+<xsl:when test="substring-before(substring-after($DateTime,'-'),'-')='Dec'">+
+<xsl:text>12</xsl:text>+
+</xsl:when>+
+</xsl:choose>+
+<xsl:text>-</xsl:text>+
+<xsl:choose>+
+<xsl:when test="string-length(substring-before($DateTime,'-')) = 1">+
+<xsl:value-of select="concat('0',substring-before($DateTime,'-'))"/>+
+</xsl:when>+
+<xsl:otherwise>+
+<xsl:value-of select="substring-before($DateTime,'-')"/>+
+</xsl:otherwise>+
+</xsl:choose>+
+<xsl:text>T00:00:00.000<;/xsl:text>+
+</xsl:template>+
You can call this template on the element you want to use in the main template.
+<xsl:call-template name="formatDateTime">+
+<xsl:with-param name="DateTime" select=${your xpath}>+
+</xsl:call-template>+
Hope it helps.
Regards
Ayush -
Hi , friends pls explain abap mapping and message mapping
1) pls explain abap mapping and message mapping
send me screen shorts also.Hi
Mapping Techniques
XI provides 3 standard ways of interface mapping between source and target.
Graphical mapping
Java Mapping
XSLT Mapping
Two more additional mapping types can be activated in XI by making changes to the exchange profile. Those two mappings are
ABAP mapping
XSLT mapping with ABAP Extensions
Graphical Mapping
Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception - User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example ... text/html output, namespace change, sorting or grouping of records etc.
ABAP Mapping
A person comfortable with Object Oriented ABAP can go for ABAP mapping instead.
Java Mapping
Java Mapping uses 2 types of parsers. DOM and SAX. DOM is easier to use with lots of classes to help you create nodes and elements, but , DOM is very processor intensive.
SAX parser is something that parses your XML one after the other, and so is not processor intensive. But, it is not exaclty easy to develop either.
XSLT Mapping
One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.
A few example cases in which an XSLT mapping can be used:-
When the required output is other than XML like Text, Html or XHTML (html displayed as XML)
When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
When data is to be filtered based on certain fields (considering File as source)
When data is to be sorted based on certain field (considering File as source)
When data is to be grouped based on certain field (considering File as source)\
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 provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
File content conversion at receiver side can be avoided in case of text or html output.
Multiple occurrences of node within tree (source XML) can be handled easily.
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.
XSLT program become lengthier as source structure fields grows in numbers.
XSLT program sometimes become complex to meet desired functionality.
Some XSL functions are dependent on version of browser.
Different types of Mappings
MAPPING SUPPORTED BY XI
Message Mapping -> Graphical Design and testing environment. Default Provided By XI. Queue based modelling allow handling or large documents. Extensible via user defined functions
XSLT Mapping - > Based on openstandard, Portable across application platform, Extensible using user defined functions kewl but disadvantage is Memory overload while handling large documents.
SAX -> Simple Api For XML. -> Allows you to parse through a XML document. Doesn't consume any memory. But the message can be parsed only once from top to bottom. It Has evolved by contributions made by group of ppl itz a open architecture.
DOM -> Document Object Model -> Itz designed by W3C. Consumes Memory as the message will be loaded. Allows parsing of document in both way top down and bottom up.
Send me your email id.Shall send you very good docs for both ABAP Mapping and message mapping.
Thanks
Maybe you are looking for
-
11G: Search form always in Find Mode?
Hi, We are trying to re-do a search form that is always in Find mode. Shoud we follow what we do for 10.1.3 or there is new document we should follow? Thanks, Annie
-
Unique Constraint Error at Apply side
We have streams configured between two databases. Source database is of Version 9.2.0.3 and target database is of 9.2.0.4 I have a table TEST with primary key PK_TEST on column A. Performed the following steps on the source database: Step1: insert in
-
Adobe Reader 10.1.3 uses max CPU when closed
We're having the problem where Adobe Reader uses all of a CPU core when a user is closing the program but the .exe file is still running in the background. We're running 10.1.3 and have been using that since it was released but the problem just recen
-
How to edit contacts?
-
Time Machine - does not back up
Hello - I am new to Time Machine and have spent the last few hours trying to figure out why it is not backing up to my new 1TB hard drive. I have followed the steps in Mac 101: TM and also looked into the FAQs and have done the following: FAQ #5 - er