[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: RE: XPath expression to perform 'keyword' query
> > I forgot to mention that the keywords are supplied to the > processor as a > parameter and are therefore a string of white-space separated values. > > I've just (I think) found a solution with SAXON: > > <xsl:for-each select="//item[.//* = saxon:tokenize($keywords)]"> > I suggest you take the call on saxon:tokenize out of the predicate, put the result in a global variable. (Saxon will attempt to optimize, but it's difficult to optimize calls on extension functions very much). You didn't mention that each keyword was a separate element in your data. Given this property, you should get much better performance by doing <xsl:key name="k" match="item" use=".//*[not(*)]"/> <xsl:variable name="search" select="saxon:tokenize($keywords)"/> <xsl:variable name="result" select="key('k', $search)"/> <xsl:template match="/"> <xsl:copy-of select="$results"/> </xsl:template> However, this relies on re-using the index built to support the key across multiple transformations. Saxon will do this provided that both the source document and the compiled stylesheet are only built once, and not rebuilt for each transformation. Michael Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|