RE: grouping (was: if or template?)

Subject: RE: grouping (was: if or template?)
From: Thorbjørn Ravn Andersen <TRA@xxxxxxxx>
Date: Wed, 7 Jun 2000 12:33:55 +0200
>   <xsl:key name="xxx" match="/Tasks/Task/Owner" use="."/>

This is a very interesting approach indeed, but I would like to have the string matched be an externally defined parameter instead.

Attempting to use 

<xsl:param name="pattern" select="text()"/>
<xsl:key name="xxxx" match="$pattern" use="."/>

fails in Saxon with 

	Error in expression $pattern: Unxpected token in pattern, found $

so there must be another way.

What do I need it for? 

I have a large XML-file suited for feeding to XSQL (organised in rows) except that an element on each row needs to be replaced with another element, the value of which is based on a translation table in another quite large XML-file.

My current thoughts are to generate an XSL-file automatically which does the mapping in the usual fashion.  The XSL-file which outputs the tailored stylesheet should therefore take parameters in crucial places, but fails with errors similar to the above.

My heavily hacked code looks like

<xsl:template match="*">
<xsl:if test="local-name() = $key">
<xsl:value-of select="{./$value}"/>

where the problem again is a $-sign, but here in the xsl:value-of tag.

What would be a better way to do this?


 XSL-List info and archive:

Current Thread