[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

To display the output depending upon condition

Subject: To display the output depending upon condition
From: srini vasan <srinivi27@xxxxxxxxx>
Date: Thu, 18 Oct 2001 08:45:32 -0700 (PDT)
srini vasan
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.