with-param and context

Subject: with-param and context
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: 28 Nov 2000 12:06:17 -0500
If you apply the following stylesheet to a document that consists
simply of "<doc/>", you'll get:

text-only=0
text-only=1

(This is the consistent behavior of Saxon, xalan, and XT.)

I can't fathom what the difference in context makes to
with-param. Enlightenment, please.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

<xsl:template match="*" mode="title.ref">
  <xsl:param name="text-only" select="'0'"/>

  <xsl:message>text-only=<xsl:value-of select="$text-only"/></xsl:message>
</xsl:template>

<!-- ==================================================================== -->

<xsl:template name="head.content">
  <xsl:param name="node" select="."/>

  <xsl:apply-templates select="$node" mode="title.ref">
    <xsl:with-param name="text-only" select="'1'"/>
  </xsl:apply-templates>
</xsl:template>

<!-- ==================================================================== -->

<xsl:template match="/">
  <xsl:call-template name="head.content">
    <xsl:with-param name="node" select="."/>
  </xsl:call-template>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="doc">
  <xsl:call-template name="head.content">
    <xsl:with-param name="node" select="."/>
  </xsl:call-template>
</xsl:template>

</xsl:stylesheet>

                                        Be seeing you,
                                          norm

-- 
Norman.Walsh@xxxxxxxxxxxx | Are you not the future of all the memories
XML Technology Center     | stored within you? The future of the
Sun Microsystems, Inc.    | past?--Val\'ery


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


Current Thread