You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Wilhelmsen Tor Iver <To...@arrive.no> on 2006/12/05 12:47:17 UTC

Support for xsl:attribute-set and xsl:use

It would be nice to use these features of XSL to make it easier to reuse
the same attributes. Particularly in the first of these cases:

1) In the FO-generating stylesheet:

<xsl:attribute-set name="heading" fo:width="100%" fo:font-weight="bold"
/>

...

<fo:block xsl:use="heading">...

2) In FO (possibly generated from the XSL using xsl:element)

Is there a way to make FOP make the XSL transformer use
xsl:attribute-set and xsl:use? Is a patch needed either in FOP or the
transformer?

- Tor Iver Wilhelmsen
Developer, Arrive AS

Re: Support for xsl:attribute-set and xsl:use

Posted by Chris Bowditch <bo...@hotmail.com>.
Wilhelmsen Tor Iver wrote:
> It would be nice to use these features of XSL to make it easier to reuse 
> the same attributes. Particularly in the first of these cases:

XSLT supports this already, but with a slightly different syntax to what 
you posted.

> 
> 1) In the FO-generating stylesheet:
> 
> <xsl:attribute-set name="heading" fo:width="100%" fo:font-weight="bold" />

should be:

<xsl:attribute-set name="heading">
	<xsl:attribute name="width">100%</xsl:attribute>
	<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:attribute-set>

> 
> ...
> 
> <fo:block xsl:use="heading">...

<fo:block xsl:use-attribute-set="heading">

> 
> 2) In FO (possibly generated from the XSL using xsl:element)
> 
> Is there a way to make FOP make the XSL transformer use 
> xsl:attribute-set and xsl:use? Is a patch needed either in FOP or the 
> transformer?

Theres no way of dynamically selecting the attribute set to use I'm 
afraid you have to hard code all possibilites upfront. E.g.

<xsl:choose>
<xsl:when test="name()='element1'>
	<element1 xsl:use-attribute-set="element1"/>
</xsl:when>
<xsl:when test="name()='element2'>
	<element2 xsl:use-attribute-set="element2"/>
</xsl:when>

....
</xsl:choose>	

Chris