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(_at_)CraneSoftwrights(_dot_)com
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--