Skip to Content
author's profile photo Former Member
Former Member

how to write XSLT codeing in file to file using XSLT mapping?

Hi ,

Experts,

I am new to XSLT coding as iam doing File to File XSLT Mapping for i have created IR and ID part and i have wriiten XSLT codeing which is not working.

source structure: Target structure

Fname Name = (Fname+Lname)

Lname

maths

science Total_marks = (mathssciencesocial)

social

<?xml version='1.0' ?>

http://www.w3.org/1999/XSL/Transform" xmlns:sap=" http://www.sap.com/sapxsl" xmlns:aash="http://xlst.file2file" xmlns:ns0="http://xlst.file2file">

<xsl:template match="/"> |

<aash:mt_student_result> this is my Naming Space

<Data>

<Name>

<xsl:value-of select="concat(ns0:mt_student/data/FName,ns0:mt_student/data/LName)"/>

</Name>

<Marks>

<Total_Marks>

<xsl:value-of select="(ns0:mt_student/data/Marks/Maths)(ns0:MT_Student/Data/Marks/Science)(ns0:mt_student/data/Marks/Social)"/>

</Total_Marks>

</Marks>

</Data>

</aash:mt_student_result>

</xsl:template>

</xsl:transform>

while testing in Interface mapping the values are not comming into result side please verify the code and suggest me the correct one.

Thanks in advance

shabeer ahmed.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2009 at 10:00 AM

    Hi Shabeer,

    PFB, the corrected XSL.

    try using it, it would work.

    <?xml version="1.0" encoding="UTF-8"?>

    http://www.w3.org/1999/XSL/Transform" xmlns:sap=" http://www.sap.com/sapxsl" xmlns:aash="http://xlst.file2file" xmlns:ns0="http://xlst.file2file">

    <xsl:template match="/"> |

    <aash:mt_student_result> this is my Naming Space

    <Data>

    <Name>

    <xsl:variable name="vFName" select="ns0:mt_student_result/Data/FName"/>

    <xsl:variable name="vLName" select="ns0:mt_student_result/Data/LName"/>

    <xsl:value-of select="concat($vFName,$vLName)"/>

    </Name>

    <Marks>

    <Total_Marks>

    <xsl:variable name="vMaths" select="ns0:mt_student_result/Data/Marks/Maths"/>

    <xsl:variable name="vScience" select="ns0:mt_student_result/Data/Marks/Science"/>

    <xsl:value-of select="concat($vMaths,$vScience)"/>

    </Total_Marks>

    </Marks>

    </Data>

    </aash:mt_student_result>

    </xsl:template>

    </xsl:transform>

    I have given input as,

    <?xml version="1.0" encoding="UTF-8"?>

    <ns0:mt_student_result xmlns:ns0="http://xlst.file2file">

    <Data>

    <FName>FName</FName>

    <LName>LName</LName>

    <Marks>

    <Maths>M</Maths>

    <Science>S</Science>

    </Marks>

    </Data>

    </ns0:mt_student_result>

    Output was,

    <?xml version='1.0' ?>

    |

    http://www.sap.com/sapxsl" xmlns:ns0="http://xlst.file2file" xmlns:aash="http://xlst.file2file"> this is my Naming Space

    <Data><Name>FNameLName</Name><Marks><Total_Marks>MS</Total_Marks></Marks></Data></aash:mt_student_result>

    It worked.Try it out.

    Regards,

    Swetha.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.