This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: How to get the previous node(s)
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] How to get the previous node(s)
- From: Rene de Vries <RdVries at PCL-HaGe dot nl>
- Date: Mon, 18 Jun 2001 15:50:57 +0200
- Organization: PCL HaGé b.v.
- Reply-To: xsl-list at lists dot mulberrytech dot com
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@hotmail.com]
Verzonden: maandag 18 juni 2001 14:38
Aan: xsl-list@lists.mulberrytech.com
Onderwerp: RE: [xsl] 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@PCL-HaGe.nl>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: "'xsl-list@lists.mulberrytech.com'" <xsl-list@lists.mulberrytech.com>
>Subject: RE: [xsl] 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@hotmail.com]
>Verzonden: maandag 18 juni 2001 12:49
>Aan: xsl-list@lists.mulberrytech.com
>Onderwerp: [xsl] 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@brel.com
> >Reply-To: xsl-list@lists.mulberrytech.com
> >To: xsl-list@lists.mulberrytech.com
> >Subject: [xsl] 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@brel.com
> >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