This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: grouping (was: if or template?)



>   <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:message>Found</xsl:message>
<xsl:value-of select="{./$value}"/>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>

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

What would be a better way to do this?

--
  Thorbjørn


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]