[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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 |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Applying a named template to arbitr, Iain Huxley | Thread | Re: Applying a named template to ar, Iain Huxley |
FOP, Marta Lobato | Date | RE: XSL processor authors - how abo, Kay Michael |
Month |
Keywords