Topic
  • No replies
SystemAdmin
SystemAdmin
1391 Posts

Pinned topic how to compare 2 xml files using xslt

‏2011-02-20T07:49:56Z |
Hello experts,
i am kinda new to xslt and stuff, i wanted to know how to compare two xml files using xslt

this is my file1.xml
<xml>
<employeedetails>
<employee>
<empname>kiran</empname>
<empid>1231</empname>
<emploc>chennai</emploc>
</employee>
<employee>
<empname>kumar</empname>
<empid>1232</empname>
<emploc>chennai</emploc>
</employee>
</employeedetails>
</xml>

this is my file2.xml
<xml>
<employeedetails>
<employee>
<empid>1231</empid>
<empid>1232</empid>
<empid>1233</empid>
</employee>
</employeedetails>
</xml>
this is my xslt
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="1">
<xsl:for-each select="document('emp.xml')/*/employee/employeeinf/empid" >
<xsl:for-each select="document('employee.xml')/*/employee/empid):>
<xsl:if test= "string(document('emp.xml')/*/employee/employeeinf/empid)=string(document('employee.xml')/*/employee/empid)">
<tr>
<td><xsl:value-of select="string(document('employee.xml')/*/employee/empid)"/></td>
<td><xsl:value-of select="string(document('employee.xml')/*/employee/empname)"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

i am getting only 1 result i.e 1231 's result
how to break the inner loop when the condition is met and get to the next node for another comparision
expers help me
any help is very much appreciated