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[(_at_)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