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

Forbidden with several xsl:attribute from xsl:apply-te

Subject: Forbidden with several xsl:attribute from xsl:apply-templates?
From: "Erik Beijnoff" <erik@xxxxxxxxxxxx>
Date: Mon, 30 Jun 2003 17:09:18 +0200
xsl border bottom width
I'm having a problem with two consecutive <xsl:apply-templates> that
both should output <xsl:attribute>. I'm having a feeling that I'm trying
to do a forbidden thing, but I figured I'd turn to the list to be sure.

Im running FOP togheter with Xalan to create PDF:s. So the first step is
the transformation of xml via xslt to xsl:fo then to pdf via FOP.
However, problems occur.

The execution is as follows:

1. A template gets called when an element with a "class" attribute is
the active node.
2. The first apply-templates applies any template that is specific for
elements with that name
3. The second apply-templates applies any template that is specific for
elements with that class name

In point three, the output "Cannot add attribute font-family after child
nodes or before an element is produced. Attribute will be ignored." gets
output at the command line.

I'm aware that all <xsl:attribute> must appear in template data before
any child nodes, but I'd figured that since both <apply-templates> only
outputs <xsl:attribute>, it should work. Well, it seems like it perhaps
doesn't work that way after all.


<!-- The template where the error occurs-->
<xsl:template match="p">
   <fo:block>
	<!-- First apply works -->
     <xsl:apply-templates select="." mode="elementselection"/>

     <!-- Second gets it attribute output ignored -->
     <xsl:apply-templates select="." mode="classselection"/>

     <xsl:apply-templates/>
   </fo:block>
</xsl:template>	

<!-- Attributes for a specific type of element is output -->
<xsl:template match="h1" mode="elementselection">	
   <xsl:attribute name="font-family">sans-serif</xsl:attribute>
   <xsl:attribute name="font-size">20pt</xsl:attribute>
   ...
</xsl:template>

<!-- Attributes for an element with a specific class is output -->
<xsl:template match="*[@class = 'leadtext']" mode="classselection">
   <xsl:attribute name="border-bottom-color">sans-serif</xsl:attribute>

   <xsl:attribute name="border-bottom-width">0.5pt</xsl:attribute>
   ...
</xsl:template>

Regards Erik Beijnoff
erik@xxxxxxxxxxxx
erik@xxxxxxxxxxxxxx



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.