[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to get the previous node(s)
Hi Srini, You have to place double quotes around your attribute-values and you need to add a root-element: <messages> <message parentid="0" messageId="1"> <content>first message</content> </message> <message parentid="1" messageId="3"> <content>re : first message</content> </message> <message parentid="3" messageId="4"> <content>re : re :first message</content> </message> <message parentid="0" messageId="2"> <content>second message</content> </message> <message parentid="2" messageId="5"> <content>re : re second message</content> </message> </messages> Do you want to search for the parent-message, for each messageId? If yes, maybe this helps you on the way: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:output method="html"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="message"> <p> current message: <em>ID: <xsl:value-of select="@messageId"/>-<xsl:value-of select="content"/></em> <xsl:variable name="parentMessageId" select="@parentid"/> <xsl:variable name="parentMessageNode" select="//messages/*[@messageId=$parentMessageId]"/> parent message: <em>ID: <xsl:value-of select="$parentMessageNode/@messageId"/>-<xsl:value-of select="$parentMessageNode/content"/></em> </p> </xsl:template> </xsl:stylesheet> Greetings Rene { @ @ } ^ \__/ "You don't need eyes to see, you need vision!" -----Oorspronkelijk bericht----- Van: Sri ni [SMTP:srini75@xxxxxxxxxxx] Verzonden: maandag 18 juni 2001 14:38 Aan: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Onderwerp: RE: How to get the previous node(s) HI, Hre is how my xml file looks: <message parentid=0 messageId=1> <content>first message</content> </message> <message parentid=1 messageId=3> <content>re : first message</content> </message> <message parentid=3 messageId=4> <content>re : re :first message</content> </message> <message parentid=0 messageId=2> <content>second message</content> </message> <message parentid=2 messageId=5> <content>re : re second message</content> </message> Regards Srini >From: Rene de Vries <RdVries@xxxxxxxxxxx> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >To: "'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> >Subject: RE: How to get the previous node(s) >Date: Mon, 18 Jun 2001 13:43:43 +0200 > >Srini, > >Tell us first how your XML-file is looking.... > >Greetings Rene > { @ @ } > ^ > \__/ > >"You don't need eyes to see, you need vision!" > >-----Oorspronkelijk bericht----- >Van: Sri ni [SMTP:srini75@xxxxxxxxxxx] >Verzonden: maandag 18 juni 2001 12:49 >Aan: xsl-list@xxxxxxxxxxxxxxxxxxxxxx >Onderwerp: How to get the previous node(s) > >Hi all, > >I am having a output like this > >First Message [ parentid=0 messageid=1 ] >re: Ist mesg [ parentid=1 messageid=3 ] > re: re: Ist mesg [ parentId=3 messageId=5 ] > >Second Message [ parentid=0 messageId=2 ] > re: 2nd Mesg [ parentId=2 messageid=4 ] > >If i click the "re: re: Ist mesg" or "re: Ist Mesg", I have to loop through >all the way UP to its parentNode whose parentId=0. Can anyone help me out >in this one please??. > >Thanks, >Srini > > > >From: kokchoon@xxxxxxxx > >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > >Subject: XML translate to XML with XSL ? > >Date: Tue, 19 Jun 2001 05:53:10 +0800 > > > >hi friends, > > > >I am now developing a system that need to translate one XML file to >another > >XML file with a XSL > >file, its work ! but the output not very nice to view, all in one line... > >so, is there any > >method to format it ? > > > >Note: I have tried the <xsl:output method="xml"/> but the output ( XML >file > >) still in one line. > >Note: I use xalan-java to do the translation. > > > > > > > >Thank you. > > > > > >From: > > ^^ > >-----00''00----- Kok Choon > > > >-------------------------------------------------------- > >E-mail: kokchoon@xxxxxxxx > >Date: 06/19/01 > >Time: 05:53:10 > > > >This message was sent by Z-Mail Pro - from NetManage > >NetManage - delivers Standards Based IntraNet Solutions > >-------------------------------------------------------- > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > >_________________________________________________________________________ >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|