on 04-03-2012 6:57 AM
Hi Experts,
I am having requirement that if in the source mapping, particular node is not exists then i need to map any constant value to source node
like "map with default " in graphical mapping.
what should i have to do in XSL style sheet transformation.
thanks and regards
anup banerjee
Hi,
it is very easy,create one varaible in XSL and the vairable should have address of your source field(XPATH)
refer below link it helps you to frame the logic
http://www.tek-tips.com/viewthread.cfm?qid=1273804
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think there is no other way....in XSLT mapping you have to check the existence of the filed and then do your further operations...
http://scn.sap.com/thread/1602917
I would suggest that you can add one extra message mapping before the xslt and there you can check whether the source filed exist or not. So by doing this you always make sure that xslt will get value (actual one or default value)..
Thanks
Amit Srivastava
You could avoid the "<xsl:if>" clausule with this way:
<xsl:variable name="color">
<xsl:choose>
<xsl:when test="@color">
<xsl:value-of select="@color"/>
</xsl:when>
<xsl:otherwise>green</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Declare a variable named "color". Set its value to the color attribute of the current element. If the current element has no color attribute, the value of "color" will be "green":
Extracted from: http://www.w3schools.com/xsl/el_when.asp
But I prefer the clausule if, it isn't too bad
Regards.
Hi,
Why don't you use graphical mapping then, if your requirement is to use one of its typical features? With XSLT, you would have really a lot of additional work (declaring a variable for each field and so on), and no chance to debug once something goes wrong in the future. Changing the whole mapping into a graphical one might still turn out to be the simplest solution.
Hope this helps,
Greg
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.