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

Re: Managing XSLTS for XSLFO - Shared templates and a

Subject: Re: Managing XSLTS for XSLFO - Shared templates and attribute sets
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 27 Mar 2008 07:48:59 -0400
Re:  Managing XSLTS for XSLFO - Shared templates and  a
At 2008-03-27 22:31 +1100, Kamal wrote:
I have a number of XSLTs for our clients that produce XSL FO. Right now, I make extensive use of attribute sets. I basically setup all my attribute sets at the start of the file and call them as I need them. This works great, just as long as you don't want to share templates. Unfortunately, I am going to need to share some of those templates in the future, but the attributes used may be different (obviously, these attributes are defining styling).

Any thoughts as to how I can have my cake and eat it too?

Have a stylesheet fragment defining common sets and common behaviours, then have different stylesheet fragments for each distinct environment import the common fragment. Each environment will then have their own distinct amalgam of their specific styles and the common styles.


To see an example of this, there is a free stylesheet library in the developer resources section of our web site (linked below) for presenting instances of the Universal Business Language (UBL) to both HTML and PDF. This library illustrates the importation of common fragments, including a common fragment between both HTML and XSL-FO stylesheets implementing the access to the UBL instances. This common bit is at the bottom of each import hierarchy. A number of the stylesheet fragments in this library are synthesized using another resource we make available that is a stylesheet that writes stylesheets ... so designed precisely to allow different environments to import common behaviours.

It happens that those import trees in my UBL example don't take advantage of <xsl:attribute-set>, but they do show what happens with the overriding of template rules and mode matches.

Note a difference between the importation of attribute sets and other named top-level constructs is that an importing attribute set doesn't supplant the imported attribute set, it augments the imported attribute set. For other named top-level constructs the importing construct supplants the imported construct. Because of this distinction, it is not possible through importation to prevent an attribute from an imported attribute set to be processed, thus, to "undo" a property such as font-weight="bold" it would be necessary to say font-weight="normal".

I hope this helps.

. . . . . . . . . . . . . Ken


-- Upcoming: UBL Apr.22,24; genericode code lists Apr.23; Rome,Italy World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) 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.