[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Lookup efficiency in XALAN vs. Saxon
Wendell, thanks for the two ideas.... Unfortunately... using a variable, allow it to die much earlier (after 30 records) with the same "(Location of error unknown)XSLT Error (java.lang.OutOfMemoryError): null" and the second method (with xsl:key) died before processing any records, again with the same "(Location of error unknown)XSLT Error (java.lang.OutOfMemoryError): null" does Saxon or any other xslt processors deal with this simple table lookup any better? Jake -----Original Message----- From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx] Sent: Thursday, November 20, 2003 3:05 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Lookup efficiency in XALAN? J, At 04:45 PM 11/20/2003, you wrote: >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! The first thing you should definitely do is collect the lookup ids into a variable, as in <xsl:variable name="keys" select="document('../master/ids-master.xml')/ids/id/@key"/> Then you can test your local ids against the keys in the variable, without parsing your lookup file every time (which it sounds like your processor might be doing): <xsl:when test="not($id = $keys])"> Try that and see if it helps. If Xalan is already optimizing the document() lookup and parse, you may get no gain from this technique -- but there's no way it could hurt. XSLT keys could also help, but since your keys are in a separate document you'd have to switch contexts to use the XSLT key function, like so: <xsl:key name="keys-by-id" match="id" use="@key"/> <xsl:variable name="keyfile" select="document('../master/ids-master.xml')"/> ... and then <xsl:for-each select="$keyfile"> <xsl:when test="not(key('keys-by-id', $id))">...</xsl:when> </xsl:for-each> but whether this helps also will depend on your processor and what kind of smarts it has inside. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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
|