Re: [xsl] Optimization using keys

Subject: Re: [xsl] Optimization using keys
From: António Mota <amsmota@xxxxxxxxx>
Date: Thu, 17 Feb 2005 17:17:40 +0000
Now you totally lost me... 

The thread your refering to was not mine, i did post a answer but the
initial question was not mine, and so the problem here in question is

I'm doing a two phase approach, the first xsl only prepares a tree
that will be htmlized in the other... So i don't think your remarks
fit my needs.

I really like the idea of using 

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

but i don't know how to do it, since i'm in a identity transform. Even
if i didn't use a identity transform i can't get the results i want by
using that. I tryed several wais with no success.

So let me put it in words again.

Having a Menu node selected like this

        <xsl:variable name="snode" select="(//Menu)[number($pos)]"/>

i want to copy the entire source tree to the result tree *except* the
selected node where i want to insert another nodes (that i'll get via

So now i have 

(identity transform)

  <xsl:template match="Menu">
                        <xsl:when test="count($snode)=1 and count(.|$snode)=1">
                                   (get the document() nodes and insert then
                                        <xsl:apply-templates select="*"/>

but it seems to take too much time to do this, with 300+ Menu nodes.

Any thoughs on how can i use the

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

in this context()?


On Thu, 17 Feb 2005 07:28:36 -0800, Robert Koberg <rob@xxxxxxxxxx> wrote:
> 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

Current Thread