Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2011, 02:35 AM
Authorized User
 
Join Date: Dec 2009
Posts: 30
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kirangentlebreeze1987
Default compare 2 xml files using xslt

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
Code:
<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
Code:
<xml>
<employeedetails>
<employee>
<empid>1231</empid>
<empid>1232</empid>
<empid>1233</empid>
</employee>
</employeedetails>
</xml>
this is my xslt

Code:
<?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('employee.xml')/*/employee/empid)=string(document('emp.xml')/*/employee/employeeinf/empid)">
<tr>
<td>emp<xsl:value-of select="string(document('employee.xml')/*/employee/empid)"/></td>
<td>emp<xsl:value-of select="string(document('employee.xml')/*/employee/empname)"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</table>
but i am getting getting only 1 result
i should get the details of 1231 and 1232
but i am getting the resl of 1231

Last edited by kirangentlebreeze1987; February 20th, 2011 at 02:38 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
compare 2 xml files nguna XSLT 8 March 31st, 2009 04:04 AM
XML + XSLT Compare Nodes tommyready XSLT 5 September 5th, 2007 03:18 AM
Compare two xml files using xslt sudha XSLT 0 March 10th, 2006 01:04 AM
Is there any tool available to compare 2 xml files parekh_bhakti ASP.NET 1.0 and 1.1 Professional 1 October 28th, 2005 12:59 PM
compare two xml files attributes, elements k_s_ashok XML 1 June 9th, 2004 02:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.