RE: [xsl] How should I structure a huge XSLT dataset best?

Subject: RE: [xsl] How should I structure a huge XSLT dataset best?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 29 Sep 2003 23:16:01 +0100
> The XML data that I will be 
> processing is usually less than 1K.
> 
> My first reaction, without any planning, is to create an XML 
> that is easily indexed to pick out the status of each 
> telephone number.  For example, if 41057 had a treatment code 
> of 5, I would first lookup 410, then 4105, then 41057, then 
> 410571.  The 410571 would not be found, so I would fall back 
> tothe 41057 answer.  

My first attempt would be to keep the data file separate from the
stylesheet, and to index the phone numbers using:

<xsl:key name="k" select="substring(.,1,3)"/>
<xsl:key name="k" select="substring(.,1,4)"/>
<xsl:key name="k" select="substring(.,1,5)"/>
<xsl:key name="k" select="substring(.,1,6)"/>

Then just do a simple lookup using key('k', $param).

Michael Kay


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


Current Thread