Subject: Re: If Current Node Is Ancestor!
From: Brian Chrisman <incubus@xxxxxxxxxxxxxx>
Date: Mon, 11 Apr 2005 21:34:11 -0700
|
On Tue, Apr 12, 2005 at 09:23:40AM +0530, omprakash.v@xxxxxxxxxxxxx wrote:
>
>
> Hi,
> Are you particular about using the ancestor axis bcos I don't think
> it is of much use here. You can do this using the descendant axis as
> follows:
>
> <xsl:if test="descendant::menu[@dept = $dept]">
> <xsl:value-of select="'node found'"/>
> </xsl:if>
>
>
> This is assuming I understood your requirement right.
Feh.. I misread the question... I was thinking he was
trying to find out whether the current element had a menu
element $depth levels deeper into the document.. :-)
... read problem.. *then* solve problem... not the
reverse.. :-)
-Brian
>
> Cheers,
> Omprakash.V
>
>
>
>
>
>
>
>
> Brian Chrisman
> <incubus@shell To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> .izap.com> cc: (bcc: omprakash.v/Polaris)
> Subject: Re: If Current Node Is Ancestor!
> 04/12/2005
> 09:04 AM
> Please respond
> to xsl-list
>
>
>
>
>
>
> On Tue, Apr 12, 2005 at 01:19:41PM +1000, Adam J Knight wrote:
> > Hi all,
> >
> > I am trying to test whether a current node is an ancestor of a menu node
> > with a dept attribute equal to $depth. I appear to be struggling with
> this
> > conceptually and would appreciate any help!!
> >
> > <xsl:if test="//menu[@dept != $dept]/ancestor::menu ">
> > <xsl:attribute name="class">nav_close</xsl:attribute>
> > </xsl:if>
>
> Here's one way I *think* you could do it.. but I haven't
> tried it.. and I don't use this functionality much..
>
> <xsl:variable name="my-depth" select="count(ancestor::*)"/>
> <xsl:if test=".//menu[(count(ancestor::*) - $my-depth) = $depth]">
> foo
> </xsl:if>
>
> >
> > Cheers,
> > Adam
> > ?
>
>
>
>
>
>
> This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.
> If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
> You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
> distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
>
> Visit Us at http://www.polaris.co.in
|