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

Re: dynamic template caller problems

Subject: Re: dynamic template caller problems
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sun, 30 Jul 2006 11:16:41 -0700
related fxsl.sf.net
What is asked for is described here:
    http://fxsl.sf.net
and here:
    http://www.idealliance.org/papers/extreme/proceedings/xslfo-pdf/2003/Nov
atchev01/EML2003Novatchev01.pdf


-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence.



On 7/30/06, Smoother@xxxxxx <Smoother@xxxxxx> wrote:
I got the following XML-File:

<root>
 <page1 template="template_a">
   ...
 </page1>
 <page2 template="template_b">
   ...
 </page2>
 <page3 template="template_b">
   ...
 </page3>
 ...
</root>

As you can see, the root element contains numerous nodes with different
node-names. These nodes have an attribute, called "template" which indicates
with which XSL-Template they should be transformed.

I have already written a "Master"-XSL-File which gets already the requested
node from a given path and also the related template.
Now there's the problem to call the related template from the
"Master"-XSL-File.

For example (this is my idea):


User request: /page2/

PHP & XSL-Solution returns /root/page2/ as the related XPath. (done)

XSL lookups related template: "template_b" (done)

XSL calls/applies the related template. (???)

Called template is used for the following transformations (done)




What my current xsl-file looks like:


...

<!-- "master" template - calls related template -->
<xsl:template match="/">

...

<xsl:value-of select="$template" /> <!-- e.g. 'template_b' -->

 <!-- This will not work, since name= always requires a QName :( -->
 <xsl:call-template name="$template" />

<!-- ??? how to call/apply the related template ??? -->

</xsl:template>

...

External stylesheet imported from master-file:

...

<xsl:template name="template_b"> <!-- what about match= here?? 'Cause this
template can be used for all nodes adding the attribute template="template_b"
...  -->
 <h1>template_b successfully called!</h1>
</xsl:template>

<xsl:template name="template_a"...


My question is, how I realize this idea of a dynamic template caller best.
Thanks in advance, S. Renault.
--


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal f|r Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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.