Re: [xsl] xsl:use-attribute-sets, xslt 1.0, fo output

Subject: Re: [xsl] xsl:use-attribute-sets, xslt 1.0, fo output
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Jan 2011 07:48:11 -0500
At 2011-01-19 12:41 +0000, Dave Pawson wrote:

Given an input
<line remap="LINE">Of government the properties to unfold,</line>

I want to take the the remap att value and use it as a named attribute
set.

Seems
<xsl:template match="speaker">
    <fo:block xsl:use-attribute-sets="{@remap}">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

is a no no, no AVT here.

Correct.


Can anyone think of a way of using them... or is the processing
wrong? Do I need an intermediate step first?

The xsl:attribute instructions in an attribute set work just as well in a called template (though they are executed in real time with the current node being what it is rather than the current node being the root).


Perhaps you could despatch to the appropriately named called template by creating a despatch called template that knows the name of each of the attribute set called templates (since calling a template also cannot be done through an AVT).

A bit awkward, but you don't lose the concept of an attribute set, per se, you are just creating a dynamically callable version of one rather than a pre-defined one.

I hope this helps.

. . . . . . . . . Ken

--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread