[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Optimization using keys

Subject: Optimization using keys
From: António Mota <amsmota@xxxxxxxxx>
Date: Wed, 16 Feb 2005 12:21:58 +0000
treemenu xml
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.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.