[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.