on 02-15-2012 8:28 AM
Hello comminity.
I have got a question about XSL(T) in condition to XML.
There are 2 XML-Documents, one Source-XML and one Target-XML.
And there is also a XSL(T)-Document, which transfers the Source-XML into the
Target-XML.
My Problem:
The XSL(T) is either wrong, or some lines are missing.
-
-
Source-XML: -> Correct / no mistakes
XSL(T) (Mapping): -> Anything wrong / missing in this Transformation
<!-- Transfer of the attachment-->
<xsl:for-each select="Z1ATTACH">
</xsl:for-each>
</xsl:template>
<xsl:template name="formatDate">
<xsl:param name="date">
</xsl:param>
<xsl:if test="string-length($date) > '0'">
<xsl:value-of select="concat(substring($date, '1', '4'), '-', substring($date, '5', '2'), '-', substring($date, '7','2'))"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Target-XML: -> Correct / no mistakes
<!Begin of attachments>
-
-
-
The XSL(T)-Document is either wrong, or some lines are missing as a said.
So would you be so kind and tell me the wrong / missing code ?
Thank you very much for helping.
Best Regards.
Yous XSL code is not complete , i think you just got only one mothod code.. better to write code by your self.
You requirement can be achived easily by using GUI mapping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Raja.
Thank you for your fast reply.
I also think, that there is still much missing in my XSL(T)-Code...
Can you give me a name of a so called "GUI Mapping Tool", which can solve my problem?
If there is no GUI-Mapping-Tool, could you be so kind and tell me, if there are many lines, which I have to add or only a few...
Im am still trying the whole morning, but without XSL(T)-Knowledge it's quite difficult.
Best Regards.
I have tried my self and changed my XSL(T)-Code:
<!-- Delivery of Attachment -->
<xsl:for-each select="//Z1ATTACH">
<xsl:element name="AdditionalData">
<xsl:element name="Name">
<xsl:value-of select=""/>
</xsl:element>
<xsl:element name="Value">
<xsl:value-of select="Description"/>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
So can you give me a hint why it still doesn't work?
Best Regards.
field names are case sensitive...
<xsl:value-of select="DESCRIPTION"/>
and why are u using elemnt name tags..u can directly give the target filed name like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<MT_Target>
<xsl:for-each select="//Z1ATTACH">
<AdditionalData>
<Value>
<xsl:value-of select="DESCRIPTION"/>
</Value>
</AdditionalData>
</xsl:for-each>
</MT_Target>
</xsl:template>
</xsl:stylesheet>
chk this article for xslt mapping:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/000ee4d0-be91-2d10-8aaf-ff8045bdd37d
Hi,
If you want to prepare the mapping graphically, I would definitely suggest using PI Message Mapping, especially if you are not familiar with XSLT. However, if you insist on using the XSLT, you might find this tool useful:
http://www.altova.com/xml-editor/
As far as I remember, it contains a GUI editor for preparing XSLT mappings (simply drag and drop from source to target structure), based on which an XSL Transformation file is generated. And it has a 30 days trial to let you check if it is useful for you.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello comminity.
After 2 days, I have solved the problem by myself.
There you have the code, I have written and now it works:)
<!-- Delivery of attachment -->
<xsl:for-each select="//Z1ATTACH">
<xsl:element name="AdditionalData">
<xsl:element name="Name">
<xsl:text>Z_CI_ATTACHMENT_DESCRIPTION</xsl:text>
</xsl:element>
<xsl:element name="Value">
<xsl:value-of select="DESCRIPTION"/>
</xsl:element>
<xsl:element name="AdditionalData">
</xsl:element>
</xsl:element>
<xsl:element name="Name">
<xsl:text>Z_CI_ATTACHMENT_BY_RFC</xsl:text>
</xsl:element>
<xsl:element name="Value">
<xsl:value-of select="PH_OBJID"/>
</xsl:element>
<xsl:element name="AdditionalData">
</xsl:element>
</xsl:for-each>
</xsl:template>
<xsl:template name="formatDate">
<xsl:param name="date">
</xsl:param>
<xsl:if test="string-length($date) > '0'">
<xsl:value-of select="concat(substring($date, '1', '4'), '-', substring($date, '5', '2'), '-', substring($date, '7', '2'))"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Thank you for helping.
Best Regards.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.