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

Re: Applying a named template to arbitrary content

Subject: Re: Applying a named template to arbitrary content
From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Date: Mon, 13 Mar 2000 09:41:51 -0500
tname templates
> I'm trying to make a generic template which will, in effect, 
> simply insert stuff before and after the content.  In one case, I 
> want to do it to apply font styling parameters etc. where needed:

This is hard to do in XSLT 1.0, but quite a few people have asked for
it, so maybe evaluating the name of the template to call will come in a
future version of the language.

For now, one approach is that of Mike Kay---you can check the archive
for details, but the meat of it is this:

<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="xyz" match="xsl:template[@name='xyz']">
  <xsl:message>Hello xyz.</xsl:message>
</xsl:template>

<xsl:template match="/">
  <xsl:variable name="tname" select="'xyz'"/>
  <xsl:apply-templates
     select="document('')/*/xsl:template[@name=$tname]"/>
</xsl:template>
</xsl:stylesheet>

The other approach is to rethink your problems and solutions.  For
example, much of what you seem to want to do could probably also be
achieved by use of xsl:attribute-set, or increased use of CSS in
combination with 'class' attributes on your HTML output.

 Steve


 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.