My Menu project is allmost finished (couldn't do it without the list,
for sure) and i'm doing some optimization.
I had two xslts at the beggining on my app, one getting from a tree
only the nodes that match a app name, including all it's childrens
(only the top level menus have a app defined)
and the second replacing some nodes by another ones (of the same input
tree) including children.
Then i changed those two xslt to do the same things in only one xslt.
I've done this.
(identity template)
<xsl:template match="Menu">
<xsl:if test="Aplicacao=$app">
<xsl:copy>
<xsl:apply-templates select="*" mode="copia"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="copia">
<xsl:copy>
<xsl:apply-templates mode="copia"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Menu[MenuTipo='REP']" mode="copia">
<xsl:apply-templates
select="document('TreeMenu.xml')//Menu[Menu_K=current()/MenuData]/Filhos/Menu"
mode="copia"/>
</xsl:template>
<xsl:template match="Orelha[MenuInfoTipo='Subst']" mode="copia">
<xsl:apply-templates
select="document('TreeMenu.xml')//Menu[Menu_K=current()/InfoData]/Orelhas/Orelha"
mode="copia"/>
</xsl:template>
It works ok but it is a little slow (curiosly is fast enough in IE but
slower in FF, and even more slower when running under IDE's). So i
have some questions:
1) Is this a case where i should/could use keys instead (i never used
keys before so it's a little puzzling to me)
<xsl:apply-templates
select="document('TreeMenu.xml')//Menu[Menu_K=current()/MenuData]/Filhos/Menu"
mode="copia"/>
2) Since the lookup document and the input tree are the same, why it
doesn't work when i changed that line to
<xsl:apply-templates
select="document('')//Menu[Menu_K=current()/MenuData]/Filhos/Menu"
mode="copia"/>
3) Is this a correct use of "modes"?
Thanks again to all.
--~------------------------------------------------------------------
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>
--~--