[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Lookup efficiency in XALAN?
> I have to do some validation in my xsl. > > I'm doing the following type statement 20,000 times, and the > lookup file is around 50,000 lines of id's <id key="XXYYZZJ"/>. > > <xsl:when > test="not(document('../master/ids-master.xml')/ids/id[@key=$id])"> > > It works for a while, then dies with an out of memory error, > and it sure is slow! > > > Any ideas for a faster/reliable search? > Anything like this should be vastly improved by using keys. As Wendell explained, it's a bit clumsy in XSLT 1.0 because you have to change the context document to use a key; you may have to write something like: <xsl:variable name="test"> <xsl:for-each select="document('../master/ids-master.xml')"> <xsl:if test="key('k', $id)">true</xsl:if> </xsl:for-each> </xsl:variable> <xsl:when test="$test='true'"> Having said that, I'm a little surprised at the "out of memory" error. What you're doing seems expensive in time, but not in memory. 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
|