On Fri, Dec 23, 2005 at 04:35:45AM -0800, kavitha ramesh wrote: > Hi, > > I have the following xml file.I would like to check if the filename inside the > bigfiles equals the filename inside the smallfiles.if so i would like to > display the error of the corresponding filename,,,if someone knows pls help > me,,, > > <report> > > <bigfiles> > <filename>aaa</filename> > </bigfiles> > > <smallfiles> > <file1> > <filename>aaa</filename> > <error>aaa</error> > </file1> > <file2> > <filename>bbb</filename> > <error>bbb</error> > <file2> > <file3> > <filename>ccc</filename> > <error>ccc</error> > <file3> > </smallfiles> > > </report>
Hello Kavitha, First your sample xml is not well-formed. Closing tags for file2 and file3 missing. Here's a sample xsl file to start with after you've added closing tags for file2 and file3: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/report"> <xsl:apply-templates select="smallfiles"/> </xsl:template> <xsl:template match="smallfiles"> <xsl:apply-templates select="*/filename"/> </xsl:template> <xsl:template match="filename"> <xsl:choose> <xsl:when test=". = /report/bigfiles/filename"> <xsl:value-of select="."/> <xsl:text> eq </xsl:text> <xsl:value-of select="/report/bigfiles/filename"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> <xsl:text> ne </xsl:text> <xsl:value-of select="/report/bigfiles/filename"/> </xsl:otherwise> </xsl:choose> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> Best regards, Fred Vos -- |E R | D F | |fred at fredvos dot org |5235 DG 52 NL +31 73 6411833 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
