Re: [xsl] Optimization using keys

Subject: Re: [xsl] Optimization using keys
From: António Mota <amsmota@xxxxxxxxx>
Date: Wed, 16 Feb 2005 19:39:39 +0000
I'm also trying to optimize this template

(indentity template)

       <xsl:template match="Menu">
                                <xsl:variable name="pai" select="Menu_K"/>
select="@*|node()[not(name()='MenuTipo' or name()='Filhos' )]"
name="xmldoc" select="document(concat($xmluri,'?Menu_K=',Menu_K,'&amp;Pai_K=',$pai))"/>
name="filhos" select="Filhos"/>
name="orelhas" select="Orelhas"/>
<xsl:apply-templates select="$xmldoc/Menus/Menu" mode="menu">
<xsl:with-param name="filhos" select="$filhos"/>
<xsl:with-param name="orelhas" select="$orelhas"/>
                                        <xsl:apply-templates select="*"/>

      <xsl:template match="Menu" mode="menu">
                <xsl:param name="filhos"/>
                <xsl:param name="orelhas"/>
                        <xsl:apply-templates mode="menu"/>
                        <xsl:if test="$filhos">
                                <xsl:copy-of select="$filhos"/>
                        <xsl:if test="$orelhas">
                                <xsl:copy-of select="$orelhas"/>

but it is too slow and i don't know why. I thought it was the document
($xmluri is pointing to a ASP that returns a chunk of XML), but i've
tested with a small xml input tree and it's fast enough, so it seems
the problem is with the XML size. However i don't want to do much
things with it.

I'll fraze it (poor) english. Given a XML with nested Menu structures,
i want to copy all the nodes to the output tree *except* the one that
corresponds to the $pos position, wich i want to replace with the
result from document.

For each of the resulting document() nodes i want to append the
original <Filhos> and <Orelhas>.

So is there a optimized way to do this? Including the "simple copy" of
the nodes?

Thanks again.

Current Thread