on 03-16-2009 12:23 PM
i want to produce correct output, which is mentioned in the the blog /people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
i think there was an error in the XSLT coding.
i modified the code as follows:
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl"
xmlns:p2="urn://Mapping">
<xsl:template match="/">
<p2:MT_STUD>
<Records>
<xsl:for-each select="p2:MT_STUD_SORC/Records/Student_ID">
<Student_ID>
<Name>
<xsl:value-of select="concat(concat (p2:MT_STUD_SORC/Records/Student_ID/Fname,' '),p2:MT_STUD_SORC/Records/Student_ID/Lname)"/>
</Name>
<Year_Birth>
<xsl:value-of select="substring(p2:MT_STUD_SORC/Records/Student_ID/DOB,1,4)"/>
</Year_Birth>
<Month_Birth>
<xsl:value-of select="substring(p2:MT_STUD_SORC/Records/Student_ID/DOB,5,2)"/>
</Month_Birth>
<Date_Birth>
<xsl:value-of select="substring(p2:MT_STUD_SORC/Records/Student_ID/DOB,7,8)"/>
</Date_Birth>
<Marks>
<Science>
<xsl:value-of select="p2:MT_STUD_SORC/Records/Student_ID/Marks/Science"/>
</Science>
<Maths>
<xsl:value-of select="p2:MT_STUD_SORC/Records/Student_ID/Marks/Maths"/>
</Maths>
<Language>
<xsl:value-of select="p2:MT_STUD_SORC/Records/Student_ID/Marks/Language"/>
</Language>
<Total_Marks>
<xsl:value-of select="sum(p2:MT_STUD_SORC/Records/Student_ID/Marks/Sciense, p2:MT_STUD_SORC/Records/Student_ID/Marks/Maths, p2:MT_STUD_SORC/Records/Student_ID/Marks/Language)"/>
</Total_Marks>
</Marks>
</Student_ID>
</xsl:for-each>
<No_Students>
<xsl:value-of select="count(p2:MT_STUD_SORC/Records/Student_ID)"/>
</No_Students>
</Records>
</p2:MT_STUD>
</xsl:template>
</xsl:transform>
here inthis i got two errors, one is SUM function have improper arguments,
and the second one is, i am unable to produce the multiple students at the receiver side.
can any body modify and correct this code?
Thanks ,
kumar
thanks for valuable answer...
Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kumar,
can you provide a sample input XML and the exact error message you're facing?
Kai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi this is the input file at interface mapping testing:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_STUD_SORC xmlns:ns0="urn://Mapping">
<Records>
<Student_ID>
<Fname>a</Fname>
<Lname>s</Lname>
<DOB>19961203</DOB>
<Mail_ID>w</Mail_ID>
<Marks>
<Science>23</Science>
<Maths>34</Maths>
<Language>45</Language>
</Marks>
</Student_ID>
<Student_ID>
<Fname>we</Fname>
<Lname>op</Lname>
<DOB>19961203</DOB>
<Mail_ID>w</Mail_ID>
<Marks>
<Science>23</Science>
<Maths>34</Maths>
<Language>45</Language>
</Marks>
</Student_ID>
</Records>
</ns0:MT_STUD_SORC>
but i am not able to see the multiple no of students at out put.
and it is saying that "sum" function have improper arguments.
Thanks,
kumar
Edited by: kumar kumar on Mar 16, 2009 2:20 PM
Edited by: kumar kumar on Mar 16, 2009 2:22 PM
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
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.