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

RE: Extending Xhtml2fo.xsl to handle CLASS attributes

Subject: RE: Extending Xhtml2fo.xsl to handle CLASS attributes
From: Graham Hannington <Ghannington@xxxxxxx>
Date: Tue, 17 Dec 2002 14:57:24 -0000
no template exists named
In brief: how can I call a named template, where the name of the template I
want to call is stored in a variable?

In detail:

I have the following XHTML tag:

<span class="symbol">|</span>

When I view this tag in Internet Explorer, the behavior that is associated
with the "symbol" class translates the "|" character into a right-pointing
arrow (looks better than a "greater than" symbol in  strings like "Start >
Programs > ...").  (Actually, the behavior replaces the <span> tag with
"<span style=""font-family: Arial;"">&#9658;</span>".)

I want to do something similar in XSL (starting with the same XHTML tag).
I'm thinking that the best way to do this is via named templates.

Specifically, I'd like to "bolt on" a template name (as an attribute) to the
syntax I've developed for converting class attributes to style attributes.
For example (see the "span.symbol" rule):

<css:stylesheet>

	<rule selector="span.note">font-weight: bold;</rule>
	<rule selector="span.normal">font-weight: normal;</rule>
	<rule selector="span.symbol" template="process-symbol" />

</css:stylesheet>

I want to use the value of the template attribute to call a named template.
Trouble is, it looks like the name you specify in an <xsl:call-template> tag
must be the literal name of the template (not a string expression whose
result is the name).

I've been trying to specify:

<xsl:call-template name="$rule[@template]">

(where $rule is the <rule selector="span.symbol"> tag, from the listing
above)

but Saxon gives me the error:

No template exists named $rule[@template]

How do I do this?

Graham Hannington

 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.