|
Subject: RE: Using a tree read with document() as a hash-table -- working solution From: Thorbjørn Ravn Andersen <TRA@xxxxxxxx> Date: Wed, 14 Jun 2000 14:55:03 +0200 |
Thank you for your prompt reply! With these modifications the following code works:
<xsl:param name="packtypefile" select="'packtype.xml'" />
<!-- Load the packtypes from the external file -->
<xsl:variable name="packtypetree" select="document($packtypefile)"/>
[...]
<xsl:variable name="packinfopacktype" select="PACKINFO/@PACKTYPE"/>
<value><xsl:apply-templates select="$packtypetree//ROW[packcode=$packinfopacktype][1]" mode="hashlookup"/></value>
[...]
(PACKINFO/@PACKTYPE is the value I want to look up in the external file in a ROW/packnode, and I need the corresponding ROW/modultxt, which I get with
<xsl:template match="ROW" mode="hashlookup">
<xsl:message>HASH</xsl:message>
<xsl:value-of select="modultxt"/>
<xsl:message>HSAH</xsl:message>
</xsl:template>
A quick test showed that the template-call could be avoided by using
<value><xsl:value-of select="$packtypetree//ROW[packcode=$packinfopacktype][1]/modultxt"/></value>
instead. This is just what I needed for a hash-lookup!
On a final note - would a key() make this faster? I still have a bit of a problem understanding how it works.
Best regards,
--
Thorbjørn Ravn Andersen
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| numbering footnotes, Anita Fend | Thread | (Inlined CSS properties) - A dynami, Svante Schubert |
| RE: What do brackets [ ] mean?, Kay Michael | Date | Re: what if use of up-to-date xslt , alex chang |
| Month |