[Home] [By Thread] [By Date] [Recent Entries]
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. 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 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>
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
|

Cart



