cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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' ?>

<xsl:transform version="1.0" xmlns:xsl="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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Shabeer,

PFB, the corrected XSL.

try using it, it would work.

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

<xsl:transform version="1.0" xmlns:xsl="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' ?>

|

<aash:mt_student_result xmlns:sap="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.