Subject: RE: [xsl] compare 2 node set??? From: aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx Date: Thu, 8 Aug 2002 10:59:37 +0530 |
The file access & the name retrieval is working... I am stuck on the logic for the search.... For eg: I cannot figure out how the keep a flag saying that the required node has been found or the node has not been found... Regards, aruniima -----Original Message----- From: Kalyan Kumar Mudumbai [mailto:kalyan_tech@xxxxxxxxxxxxxx] Sent: Thursday, August 08, 2002 10:44 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] compare 2 node set??? This might work for your case: <xsl:for-each select="//SrcData/*"> <xsl:if test="$file1//SrcData/*[local-name()=$node_name]"> </xsl:for-each> which you can write in the 'search' template. Thanks, Kalyan. On Thu, 08 Aug 2002 aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx wrote : >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 > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list ---------------------------------------------------------------------------- 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] compare 2 node set???, Kalyan Kumar Mudumba | Thread | [xsl] copying CDATA section from xm, NILESH PATEL |
Re: [xsl] compare 2 node set???, Kalyan Kumar Mudumba | Date | RE: [xsl] So many unwanted elements, abradoom |
Month |