- From: Morten M. Christensen <mmc@mortench.net>
- Date: Wed, 21 Feb 2001 14:26:45 -0500 (EST)
- To: xsl-editors@w3.org
Dear Sirs,
I would like to add a feature to XSLT2, which allows one to
chain/forward matches in a generic way, taking into account all current
params and at best also the current mode. Such as feature could be
architected using meta-axes
which work on the XSLT code itself, as shown below.
I.e. I would like to be able to write something like this (VERY invented
syntax):
 <xsl:template match="*[@ref]" mode="*" priority="1000">
  <xsl:param name="media"/>
  <xsl:param name="pageid"/>
  <xsl:variable name="ref" select="@ref"/>
  <xsl:variable name="refNode" select="//*[@id=$ref]"/>
  <!-- Forward to declared element with all params and the same mode...
Note that I assume some axes that
       describe the XSL itself (meta axes???)
  -->
  <xsl:apply-templates select="$refNode" mode="mode::.">
     <xsl:for-each select="param::*">
        <xsl:with-param name="name()" select="value()"/>
     </xsl:for-each>
   </xsl:apply-templates>
 </xsl:template>
USE CASE:
***** XML FILE:
  <VMENU id="main-menu">
   ....
  </VMENU>
   ....
  <VMENU ref="main-menu"/>
***** GENERAL RULE:
<xsl:template match="VMENU">
 <xsl:param name="media"/>
 <xsl:param name="pageid"/>
  ...
</xsl:template>
*** FORWARD RULE (here is the problem)
  <!-- Forward processing of specific referenced elements (with
parameters and validation)
          This allows the general rule above to forget about the
possibility of referenced nodes etc.
         NOTE: This does not work with every possible param and it does
not work with modes !@#$%
  -->
 <xsl:template match="VMENU[@ref] " priority="1000">
  <xsl:param name="media"/>
  <xsl:param name="pageid"/>
  <xsl:variable name="ref" select="@ref"/>
  <xsl:variable name="refNode" select="//*[@id=$ref]"/>
  <!-- Forward: WARNING - it is NOT possible to forward all params, so
we can only guess -->
  <xsl:apply-templates select="$refNode">
   <xsl:with-param name="media" select="$media"/>
   <xsl:with-param name="pageid" select="$pageid"/>
  </xsl:apply-templates>
 </xsl:template>
----------------------------------------
Sincerely,
Morten Christensen (mmc@mortench.net)
AArhus, Denmark
Received on Thursday, 22 February 2001 04:46:34 UTC