Subject: [xsl] compare 2 node set??? From: aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx Date: Thu, 8 Aug 2002 10:32:56 +0530 |
Hello Everyone, How can run through 2 different set of nodes & compare whether set 1 exists within set 2 ??? i.e do a recursive search.... I am able to process in case the node is present in both sets but how do I go ahead in case it is not. i.e how can I keep track in case the node does not exist in the other set... Following is the code... <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"> <xsl:param name="file1" select="document('d:/aruniima/CompareXml/Validator_Response.xml')" /> <xsl:template match="/"> <html> <body> <table> <xsl:for-each select="$file1//SrcData/*"> <td><xsl:variable name="node_1" select="name()"/></td> <xsl:value-of select="$node_1"/> <tr> <xsl:call-template name="search"> <xsl:with-param name="node_res" select="$node_1"/> </xsl:call-template> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> <xsl:template name="search"> <xsl:param name="node_res"/> <xsl:for-each select="//SrcData/*"> <xsl:variable name="node_2" select="name()"/> <xsl:call-template name="compare"> <xsl:with-param name="node_response" select="$node_res"/> <xsl:with-param name="node_request" select="$node_2"/> </xsl:call-template> </xsl:for-each> </xsl:template> <xsl:template name="compare"> <xsl:param name="node_response"/> <xsl:param name="node_request"/> <xsl:if test="ms:string-compare($node_response,$node_request) = 0"> <xsl:call-template name="display"> <xsl:with-param name="status" select="'Present'"/> <xsl:with-param name="in_request" select="$node_response"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="display"> <xsl:param name="status"/> <xsl:param name="in_request"/> <td><xsl:value-of select="$in_request"/></td> <td><xsl:value-of select="$status"/></td> </xsl:template> </xsl:stylesheet> Regards, aruniima ---------------------------------------------------------------------------- This message contains privileged and confidential information and is intended only for the individual named. If you are not the intended recepient you should not disseminate, distribute, store, print, copy or deliver this message. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and immediately delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. -------------------------------------------------------------------------- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Re: attribute closest mat, Matthew L. Avizinis | Thread | RE: [xsl] compare 2 node set???, Michael Kay |
[xsl] Re: attribute closest match, Dimitre Novatchev | Date | Re: [xsl] compare 2 node set???, Kalyan Kumar Mudumba |
Month |