xsl-list
[Top] [All Lists]

Re: inheritance and encapsulation in xslt? / xslt for xlink?

2003-07-21 22:49:17

You don't need to add new templates. For example you could define a global
xsl:variable in the importing stylesheet module, that contains the names
of
all elements that are to be handled by a template.

The template itself could match any element, but within its code would
process only elements, whose name is the value of one of the nodes
contained
in the global variable.  Something like this:


<xsl:template match="*">
  <xsl:if test="name() = $vgNames/*">
     <!-- Process this element here -->
  </xsl:if>
</xsl:template>

In the true spirit of OOP the above code should be in the importing template
(the base class does not know how it is going to be extended by the derived
class). The code will be something like the following:

<xsl:template match="*">
  <xsl:if test="name() = $vgNames/*">
     <xsl:apply-imports/>
  </xsl:if>
</xsl:template>



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




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