[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Hierarchy problem
Subject: RE: [xsl] Hierarchy problem From: DPawson@xxxxxxxxxxx Date: Mon, 22 Jul 2002 10:37:37 +0100 |
David C wrote: > > is (or is not) a direct descendant of another node (e.g. > level2[id='l2']) > > or if there are intervening levelX elements. > > if $x is an element node and $y is another element node then > > count($x/*|$y) = count($x/*) > > just if $y is a child of $x which is what I think you mean by direct > descendant. > > count($x//*|$y) = count($x/*) > > if $y is a descendent of $x I'm clearly not clear again. xml <level1 id='l1'> <h1>Level1</h1> <level2 id='l2'> <h2>Level2</h2> <!-- bad navPoint 1 --> <level3 id='l3'> <!-- good navPoint 2 --> <h3>level3</h3> <note id="noteId"> <!-- navLabel target --> <p>Note content</p> </note> </level3> </level2> </level1> (My definitions) level3 is a 'direct descendant' of level2 level3 is not a 'direct' descendant of level1 (since level2 intervenes). I.e. I'm only interested in the wrapper levels (level1 level2 level3) Testing with <xsl:variable name='x' select='/level1/level2'/> <xsl:variable name='y' select='/level1'/> <xsl:template match="/"> <xsl:message>Y is a child of X:<xsl:value-of select="count($x/*|$y) = count($x/*)"/></xsl:message> <xsl:message>X is a child of Y:<xsl:value-of select="count($x//*|$y) = count($x/*)"/></xsl:message> Gives Y is a child of X:false X is a child of Y:false I.e. its implying that level2 is not a direct descendant of level1, which according to my definitions, it is. Is that any clearer David? Regards DaveP - NOTICE: The information contained in this email and any attachments is confidential and may be legally privileged. If you are not the intended recipient you are hereby notified that you must not use, disclose, distribute, copy, print or rely on this email's content. If you are not the intended recipient, please notify the sender immediately and then delete the email and any attachments from your system. RNIB has made strenuous efforts to ensure that emails and any attachments generated by its staff are free from viruses. However, it cannot accept any responsibility for any viruses which are transmitted. We therefore recommend you scan all attachments. Please note that the statements and views expressed in this email and any attachments are those of the author and do not necessarily represent those of RNIB. RNIB Registered Charity Number: 226227 Website: http://www.rnib.org.uk XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Hierarchy problem, Michael Kay | Thread | Re: [xsl] Hierarchy problem, Jeni Tennison |
RE: [xsl] XSLT, frames and javascri, Jarno . Elovirta | Date | RE: [xsl] Generating the xml: names, Michael Kay |
Month |
Keywords