Altova Mailing List Archives


RE: [xsl] keys and performance

From: "Clapham, Paul" <pclapham@------------->
To:
Date: 7/27/2001 9:26:00 AM
I don't know about performance, but in my opinion Version 1 is a better
design for the XML.  It provides a clear relationship between the key (IE)
and the value (Ireland), as they are both contained in the same element
(csl:value).  But in Version 2 the key and the value are in different
elements that are related by an implicit rule that needs to be explained,
namely that the value is in the first csl:value element following the
csl:key element that holds the key.  You'll find that the XPath to relate
keys to values will be simpler for Version 1 than for Version 2; this may
have some minor effect on performance.  In addition, and equally important
in my view, the average XSL programmer (if such a thing exists yet) would
probably work out the correct XPath for Version 1 by the second try, but
would have more difficulty with Version 2.

PC2

-----Original Message-----
From: James Pasley [mailto:James.Pasley@xxxxxxxxxxxxx]
Sent: July 27, 2001 10:00
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: [xsl] keys and performance



I am using XSLT to convert between two sets of values, using a "table"
defined in XML and a key.
Does the way the table is structured effect performance for large tables? 
For example, is either one of the following two structures better than the
other?
Or is there a better way?

Version 1: used elements will the keys stored as attributes
	<xsl:key name="CountryCodeKey" match="csl:CountryCode/csl:value"
use="@key"/>
	<csl:CountryCode default="Other">
		<csl:value key="IE">Ireland</csl:value>
		<csl:value key="FR">France</csl:value>
		<csl:value key="NL">Netherlands</csl:value>
		<csl:value key="JP">Japan</csl:value>
		<csl:value key="AU">Australia</csl:value>
	</csl:CountryCode >


Version 2: Uses separate elements for the keys and values
	<xsl:key name="CountryCodeKey" match="csl:CountryCode/csl:value"
use="preceding-sibling::cs:key[1]"/>
	<csl:CountryCode>
		<csl:key>IE</csl:key>
		<csl:value>Ireland</csl:value>
		<csl:key>FR</csl:key>
		<csl:value>France</csl:value>
		<csl:key>NL</csl:key>
		<csl:value>Netherlands</csl:value>
		<csl:key>JP</csl:key>
		<csl:value>Japan</csl:value>
		<csl:key>AU</csl:key>
		<csl:value>Australia</csl:value>
	</csl:CountryCode >

Thanks,

James Pasley

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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.