Re: [xsl] Optimization using keys

Subject: Re: [xsl] Optimization using keys
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Thu, 17 Feb 2005 07:28:36 -0800
Antsnio Mota wrote:
Yes, it is global. My intention even was to do

<xsl:template match="$snode">


<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

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


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"/>

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

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

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


Current Thread