xsl-list
[Top] [All Lists]

Re: question on calling templates

2002-08-29 15:27:18
Noel Golding wrote:
try

<xsl:call-template name="{$currentTemplate}"/>

I guess he could try, but it won't work. Attribute value templates
(setting attribute values by putting an expressing within {}s) only
works with literal attributes on literal result elements, e.g.:

  <foo bar="{$baz}" />

and on certain attributes within XSLT, namely those attributes on
instructions (XSLT elements used within templates) that expect literal
values. It doesn't work on any select/test/match attribute (which hold
XPaths) or on attributes that hold a (qualified) name that needs to be
understood by the processor at compile time (e.g. the 'name' attribute
on xsl:call-template or xsl:variable or the 'mode' attribute on
xsl:apply-templates).

The best place to check whether an attribute on an XSLT instruction is
interpreted as an attribute value template is the XSLT Rec. In the
syntax specifications in the Rec, all the attributes that can hold
attribute value templates are indicated by {}s around the
specification of the attribute value. For example, xsl:sort is defined
as:

<xsl:sort
  select = string-expression 
  lang = { nmtoken }
  data-type = { "text" | "number" | qname-but-not-ncname }
  order = { "ascending" | "descending" }
  case-order = { "upper-first" | "lower-first" } /> 

showing that all the attributes except for the select attribute can
hold attribute value templates.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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



<Prev in Thread] Current Thread [Next in Thread>