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

Re: 'apply-templates' on parameter of 'call-template'

Subject: Re: 'apply-templates' on parameter of 'call-template'
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 10 Apr 2004 11:26:25 -0400
how to test xsl template
At 2004-04-10 11:17 -0400, Angus McIntyre wrote:
Of all the good suggestions and comments I've received, this one seems to be closest to what I'd like to do, as I'm trying to make some particularly skanky stylesheets written by someone else as nearly 'self-documenting' as I can, and being able to 'separate out' a chunk of data in its own namespace has considerable appeal in terms of cleanliness and clarity.

I'm still missing something though, as the processors don't seem to love your suggestion, at least the way I tried implementing it.

You've made a mistake that many of my students do when they rush:


<xsl:template name="test">
...
<xsl:template name="matchable">

You want match= not name=


Have I overlooked something obvious,

It is a common mistake ... you look at the stylesheet for hours and cannot figure out what is going wrong.


I hope this helps.

......................... Ken

T:\ftemp>type angus.xsl
<?xml version='1.0' encoding='iso-8859-1'?>

<xsl:stylesheet version='1.0'
        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
        xmlns:myns="my-namespace"
        exclude-result-prefixes="myns">

<xsl:output method='html' version='1.0' encoding='iso-8859-1' indent='no'/>

<myns:data1>
        <p>This is some text</p>
        <matchable id="123"/>
</myns:data1>


<xsl:template match="/"> <xsl:call-template name="test"> <xsl:with-param name="body" select="document('')/*/myns:data1/node()"/> </xsl:call-template> </xsl:template>

<xsl:template name="test">
<xsl:param name="body">no body</xsl:param>
<xsl:apply-templates select="$body"/>
</xsl:template>

<xsl:template match="matchable">
<p>The value is <xsl:value-of select="@id"/></p>
</xsl:template>

<xsl:template match="p">
<p><xsl:apply-templates/></p>
</xsl:template>

</xsl:stylesheet>

T:\ftemp>saxon angus.xsl angus.xsl

        <p>This is some text</p>
        <p>The value is 123</p>

T:\ftemp>


-- Public courses: Spring 2004 world tour of hands-on XSL instruction Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18

World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc

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.