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

Re: Re: dynamic template caller problems

Subject: Re: Re: dynamic template caller problems
From: Smoother@xxxxxx
Date: Sun, 30 Jul 2006 22:32:22 +0200
request_uri caller
Thanks for your replies.

Based upon the idea from http://archive.gingerall.cz/archives/public/sablot2002/msg00925.html, I wrote the following:


<?xml version='1.0' encoding='utf-8'?>
    <page1 template="single" />
    <page2 template="double" />
    <page3 template="single" />
    <page4 template="float" />
    <page5 template="double" />
    <page6 template="double" />


<xsl:template match="/">
	<!-- simplifies REQUEST_URI: "/a(/)" -> "a" -->
	<xsl:variable name="REQUEST_URI" select="translate($REQUEST_URI,'/ ','')" />
	<!--<xsl:copy&#45;of select="$REQUEST_URI" />-->
	<!-- get "template" -->
	<xsl:variable name="template" select="dyn:evaluate(concat('/root/',$REQUEST_URI,'/@template'))" />
	<!--<xsl:copy&#45;of select="$template" />-->
	<!-- apply related template -->
	<xsl:apply-templates select="dyn:evaluate(concat('//',$REQUEST_URI))" />
<xsl:template match="*[@template='single']">
	<p>single template selected</p>
<xsl:template match="*[@template='float']">
	<p>float template selected</p>
<xsl:template match="*[@template='double']">
	<p>double template selected</p>

I haven't tried yet, to access the node related to the selected template from inside (=from inside of the selected template), but I'm confident of this.

Cheers, S.R.

-------- Original-Nachricht --------
Datum: Sun, 30 Jul 2006 21:23:11 +0100
Von: David Carlisle <davidc@xxxxxxxxx>
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re:  dynamic template caller problems

> just use
> <xsl:apply-templates/>
> and have (eg)
> <xsl:template match="page2[@template='template_b']">
> no need to make it difficult by using template names here.
> David


Echte DSL-Flatrate dauerhaft f|r 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl

Current Thread


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.
First Name
Last Name
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.