Subject: [xsl] To display the output depending upon condition From: srini vasan <srinivi27@xxxxxxxxx> Date: Thu, 18 Oct 2001 08:45:32 -0700 (PDT) |
I have the following XML: <Sections> <Messages> <Message dbMessageId="927" parentId="0">third message</Message> <Message dbMessageId="910" parentId="0">first title</Message> <Message dbMessageId="911" parentId="910">reply to first title</Message> <Message dbMessageId="928" parentId="0">fourth title</Message> <Message dbMessageId="929" parentId="928">reply to fourth title</Message> </Messages> </Sections> I have the following XSL to display this XML: <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" encoding="iso-8859-1"/> <xsl:strip-space elements="*"/> <xsl:template match="*|text()|@*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="Sections"> <xsl:apply-templates select="Messages" /> </xsl:template> <xsl:template match="Messages"> <xsl:apply-templates select="Message[@parentId=0]"/> </xsl:template> <xsl:template match="Message"> <xsl:variable name="messageId"><xsl:value-of select="@dbMessageId"/></xsl:variable> <xsl:apply-templates select="../Message[@parentId=$messageId]"/> </xsl:template> </xsl:stylesheet> This is working fine and good. But What I need is: 1. Now the grouping starts with parentId=0 and then grouping all the child with them. 2. At this point I need to check whether that particular parentId !=0 and if yes I need to display that message as a particular left not a part of tree. 3. The reason for this query was if I do a search via my web interface I might get some data whose parentId !=0, since this XSL starts with parentId=0, I AM NOT GETTING THAT TREE AT ALL. Please help me to solve this problem. Many Thanks Srini __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Problems switching from Xalan, Mark Burmei | Thread | Re: [xsl] To display the output dep, Jörg Heinicke |
[xsl] Problems switching from Xalan, Mark Burmei | Date | RE: [xsl] Passing params between ja, Nathalie Pult |
Month |