Re: [xsl] Findings: Merging XSL:FO & HTML Style Sheets

Subject: Re: [xsl] Findings: Merging XSL:FO & HTML Style Sheets
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Wed, 06 Mar 2002 09:29:48 +0100
Peter Davis <pdavis152@xxxxxxxxx> wrote:
> I've had to solve something very similar to your problem in the past, but I
> came up with a slightly different solution.  It's kind of a hack to get
> around that <apply-templates mode="{}"> and <call-template name="{}"> cannot
> be specified dynamically,
...
You might also want to look into Dimitre Novatchev's functional programming
style. Simplified, it looks like this
 <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:f="uri:my.name.space">

   <f:myfunc/>

   <xsl:template match="f:myfunc">
     <xsl:param name="theNode"/>
     ... do stuff ...
   </xsl:template>

   <!-- use it somewhere -->
   ...
     <xsl:apply-templates select="document('')/*/f:myfunc">
       <xsl:with-param name="theNode" select="."/>
     </xsl:apply-templates>
   ...
 </xsl:stylesheet>

In this approach, what you think of as "mode" is the select referring
to the f:myfunc element, and what goes into the select in a moded
template invocation now goes into the "theNode" parameter. You can
store the f:myfunc node in a variable and pass it around in parameters.
Dimitres website has deeper and more precise explanations and examples,
as has the list archive. It's not quite as elegant as having the mode
attribute to be an AVT, but it has the same expressive power.

Regards
J.Pietschmann

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread