xsl-list
[Top] [All Lists]

Re: If Current Node Is Ancestor!

2005-04-11 21:34:11
On Tue, Apr 12, 2005 at 09:23:40AM +0530, 
omprakash(_dot_)v(_at_)polaris(_dot_)co(_dot_)in 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[(_at_)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(_at_)shell        To:     
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com                              
     
                    .izap.com>            cc:     (bcc: omprakash.v/Polaris)  
                                      
                                          Subject:     Re: [xsl] 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[(_at_)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
?


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>