xsl-list
[Top] [All Lists]

Re: Optimization using keys

2005-02-17 08:28:36
António Mota wrote:
Yes, it is global. My intention even was to do

 <xsl:template match="$snode">

or
 <xsl:template match="(//Menu)[number($pos)]">

but no can do, i'm in 1.0 (i recall it can be done in 2.0).

If i could do this i expected a speed increase, because i can just
copy evrithing without checking wath it is and just treat the one
selected...

Now i have to check for all Menu nodes if it's the one i want, and
there are currently 317 and counting...

I can't seem to think of anything else to improve this...



Hi,

I haven't followed the whole thread (was on a little vacation...), but it seems like you want something like the following. It looks like you have your current focused node in a variable, so you can apply-templates on it. When you match it you can apply-templates on its parent in a mode to get a view of the current menu state.

...
<div class="menu">
  <xsl:apply-templates select="$snode" mode="start-menu"/>
</div>
...

<xsl:template match="*" mode="start-menu">
  <xsl:apply-templates select="parent::*" mode="menu"/>
</xsl:template>

<xsl:template match="*" mode="menu">
  <xsl:apply-templates mode="menu"/>
</xsl:template>

Then use the templates I provided in the beginning of your thread (if I remember correctly) on dealing with hierarchical menus.

best,
-Rob

--~------------------------------------------------------------------
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>