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

Re: Setting a foreign attribute

Subject: Re: Setting a foreign attribute
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 31 Oct 2009 17:22:42 -0400
Re:  Setting a foreign attribute
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.


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


                                   .....
                       </fo:block>

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:attribute-set>

to:

  <xsl:template name="article0">
    ...
  </xsl:template>

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:

  <fo:block>
    <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?  http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.