RE: [xsl] Keys

Subject: RE: [xsl] Keys
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 9 Sep 2004 08:41:41 +0100
It is not permitted in XSLT 1.0 for the use expression in a key definition
to refer to any variables.

This restriction is removed in XSLT 2.0 (they have to be global variables,
of course).

So you could write use="*[name()=$TABLE_NAME]".

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Karl J. Stubsjoen [mailto:karl@xxxxxxxxxxxxxxxxxxxx] 
> Sent: 09 September 2004 06:43
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Keys
> 
> How do you manage this sort of key:
> <xsl:key name="attType"
> match="/root/*/xml/s:Schema/s:ElementType/s:AttributeType"
> use="/root/*[@name()]"/>
> 
> I am trying to create a "USE" on a specific node who's name 
> can very so:
> 
> root/class
> root/house
> root/bird
> 
> This select works great:
> <xsl:for-each
> select="/root/*[name()=$TABLE_NAME]/xml/s:Schema/s:ElementType
> /s:AttributeTy
> pe">
> 
> Where $TABLE_NAME is a variable.
> 
> Karl

Current Thread