Re: Question

Subject: Re: Question
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Feb 1999 17:41:57 -0500
At 99/02/03 15:12 -0600, Paul Prescod wrote:
>What I need is to do something like this:
>
><xsl:template match="METHODREF">
>   <xsl:value-of select="ancestor(CLASS)/METHOD[@name=***]">
></xsl:template>
>
>The problem is that at the point of the *** I've lost the context of the
>METHODREF and don't have a way to get its @name anymore.

James posited a solution to one of my problems that would solve your problem:

At 99/01/18 09:33 +0700, James Clark wrote:
>"G. Ken Holman" wrote:
>
>> (4) - so, I need to walk the source tree at each level of interest and
>> determine if where I am (or my ancestor module is) is where I was before I
>> started walking, and at each step render different information calculated
>> from where I am walking:
>
>If XSL had local constants/variables, you could express exactly that
>   ...
>   <xsl:constant name="current-node-name" value="{@id}"/>
>   <xsl:constant name="current-module-name"
>                value="{ancestor-or-self(intro|module|exit)/@id}"/>
>   <xsl:for-each select="/course/intro|/course/module|/course/exit">
>     <xsl:choose>
>       <xsl:when test="@id=constant(current-module-name)">
>          <!-- render green button without hyperlink -->


I suppose your solution would then be:

<xsl:template match="METHODREF">
  <xsl:constant name="where-am-i" value="{@name}"/>
  <xsl:value-of select="ancestor(CLASS)/METHOD[@name=constant(where-am-i)]"/>
</xsl:template>

I don't think it can be done today.  I'm hoping to see this feature added
to XSL.

Is there anything preventing you from using ID/IDREF instead?  That would
work fine with today's XSL.

.......... Ken

--
G. Ken Holman         mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.  http://www.CraneSoftwrights.com/s/
Box 266,                                V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0            F: +1(613)489-0995
Training:   http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm
Next XSL Training:      X-Tech:1999-03-07  WWW8:1999-05-11


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread