Re: [xsl] Setting a foreign attribute

Subject: Re: [xsl] Setting a foreign attribute
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 31 Oct 2009 17:22:42 -0400
At 2009-10-31 14:15 -0700, Mark Wilson wrote:
FOP does not like this fragment and calls <xsl:use-attribute-sets> a foreign attribute.

Right ... xsl:use-attribute-sets= is recognized by XSLT processors and you are putting that attribute into an XSL-FO file which doesn't recognize it because it isn't part of the FO vocabulary so FO processors rightfully complain.

<xsl:when test="parent::Item">
<xsl:attribute name=" xsl:use-attribute-sets">article0</xsl:attribute>
<xsl:when test="parent::Level1">
<xsl:attribute name=" xsl:use-attribute-sets">article1</xsl:attribute>
<xsl:when test="parent::Level2">
<xsl:attribute name=" xsl:use-attribute-sets">article2</xsl:attribute>
<xsl:when test="parent::Level3">
<xsl:attribute name=" xsl:use-attribute-sets">article3</xsl:attribute>


Is there a way to set <xsl:attribute-sets> similar to my unacceptable construction, or do I have to create all six attributes for each <xsl:when>?

The latter. You've overlooked what is happening where in the process. xsl:use-attribute-sets= is acted on during the building of the result tree and isn't recognized when placed directly in the result tree.

If you change:

  <xsl:attribute-set name="article0">


  <xsl:template name="article0">

Then you can use <xsl:call-template name='article0'/> in order to add all of the attributes, but it means that everywhere where you have:

  <fo:block xsl:use-attribute-sets="article0">

you will need to have:

    <xsl:call-template name='article0'/>

But there are features of xsl:use-attribute-sets= that might mean you can't just do that everywhere.

I hope this helps.

. . . . . . . . . . Ken

Upcoming:  hands-on XSLT, XQuery and XSL-FO Washington DC Nov 2009
Interested in other classes?
Crane Softwrights Ltd.
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:
Video overview:
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07
Legal business disclaimers:

Current Thread