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(_at_)CraneSoftwrights(_dot_)com
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