[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Extending Xhtml2fo.xsl to handle CLASS attributes
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;"">►</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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|