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

xsl:with-param and xsl:apply-templates

Subject: xsl:with-param and xsl:apply-templates
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: 25 Oct 2000 09:20:14 -0400
xsl apply template param
Hello world,

I figure there's about a 99% chance that I'm overlooking something
really, really obvious, but that's one of the problems with things
that are really, really obvious: they're so blasted easy to overlook.

Saxon, XT, and Xalan all do something other than I expect with the
following stylesheet, which leads me to believe I've forgotten
something about XSLT. What is it?

Assuming a test document of "<doc><p>foo</p></doc>", I expect
the xsl:message to produce "??? 1, doc, Rubble", but it produces
"??? 0, doc, Flintstone". Why?

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

  <xsl:output method="html"/>

  <xsl:template match="/">
    <xsl:variable name="doc" select="*[1]"/>
    <head>
      <xsl:call-template name="head.content">
        <xsl:with-param name="node" select="$doc"/>
      </xsl:call-template>
    </head>
  </xsl:template>

  <xsl:template name="head.content">
    <xsl:param name="node" select="."/>
    <title>
      <xsl:apply-templates select="." mode="title.refX">
        <xsl:with-param name="text-only" select="'1'"/>
        <xsl:with-param name="FRED" select="'Rubble'"/>
      </xsl:apply-templates>
    </title>
  </xsl:template>

  <xsl:template match="*" mode="title.refX">
    <xsl:param name="FRED" select="'Flintstone'"/>
    <xsl:param name="text-only" select="'0'"/>
    <xsl:message>
      <xsl:text>??? </xsl:text>
      <xsl:value-of select="$text-only"/>
      <xsl:text>, </xsl:text>
      <xsl:value-of select="name(.)"/>
      <xsl:text>, </xsl:text>
      <xsl:value-of select="$FRED"/>
    </xsl:message>
  </xsl:template>

</xsl:stylesheet>

-- 
Norman.Walsh@xxxxxxxxxxxx | If we lived alone in a featureless desert
XML Technology Center     | we should learn to place the individual
Sun Microsystems, Inc.    | grains of sand in a moral or aesthetic
                          | hierarchy.--Michael Frayn


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


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.