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

Abstracting XPath queries

Subject: Abstracting XPath queries
From: "Peter Eschenbrenner" <cen_sys@xxxxxxxxxxx>
Date: Wed, 26 Feb 2003 10:23:20 -0600
xsl currentrow
I am working on moving the code base of an existing application to and
XML/XSL engine.  The engine makes decisions based on rules that it gets
from one of 3 files:

workspace.xml
project.xml
global.xml

For example, if I want the display name for a field I am pulling from a
database:

<xsl:template name="displayName">
	<xsl:param name="currentRow" />
	<xsl:choose>
		<xsl:when
test="document('workspace.xml')/ROW[TableName=$tableName and
FName=$currentRow]">
			<xsl:value-of
select="document('workspace.xml')/ROW[TableName=$tableName and
FName=$currentRow]/FDisplay" />
		</xsl:when>
		<xsl:when
test="document('project.xml')/ROW[TableName=$tableName and
FName=$currentRow]">
			<xsl:value-of
select="document('project.xml')/ROW[TableName=$tableName and
FName=$currentRow]/FDisplay" />
		</xsl:when>
		<xsl:when
test="document('global.xml')/ROW[FName=$currentRow]">
			<xsl:value-of
select="document('global.xml')/ROW[FName=$currentRow]/FDisplay" />
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="@name" />
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>



Now the problem I am encountering is scaling this query. There are 20
rules.  Some are only used once, some are used multiple times.  Then
there are an arbitrary number of rows in the table.

(3 file queries) * (~50 rule calls) * (Number of rows in table)

It gets out of hand quickly.

Options I have been considering:
Redesigning the rules file schemas to make them easier to navigate.
Pull all the needed rules at once and compile them into a stored
node-set.


Note:
I am still learning.  This project is the first time I have ever used
XSL in a production environment.  Up to this point I have been using it
without all but basic XPath queries.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.