[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Call Template with variable name
Dimitre Novatchev wrote:
"Yash" <yashdeep at ekartha dot com> wrote: Just thought that one of the techniques I am using in my "stylefree stylesheets" can apply here... What about diverting unnamed templates to use them as "variably named" templates using hook nodes in the XSLT sheet itself to match the variable names ? <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:vn="http://dyomedea.com/ns/variable-names"> <!-- just a shortcup... --> <xsl:variable name="varnames" select="document('')/xsl:stylesheet/vn:templates"/> <!-- hooks --> <vn:templates> <vn:template1/> <vn:template2>I am template 2</vn:template> <vn:template3> <info> Some more info for template 3</info> <vn:template3> </vn:templates> .../... And instead of <xsl:call-template name="$abc"/>, <xsl:apply-templates select="$varnames/*[local-name()=$abc]"/> or when the context node is important: <xsl:apply-templates select="$varnames/*[local-name()=$abc]"> <xsl:with-param name="context" select="."/> </xsl:apply-templates> and <xsl:template match="vn:template1"> ... That can do the trick for a number of applications and you can pass additional info to your templates in the "hook" elements. Eric -- Rendez-vous à Paris pour une visite guidee de la nebuleuse XML. http://dyomedea.com/formation/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com http://xsltunit.org http://4xt.org http://examplotron.org ------------------------------------------------------------------------ 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
|