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

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

Subject: 'apply-templates' on parameter of 'call-template'
From: Angus McIntyre <angus@xxxxxxxxx>
Date: Fri, 9 Apr 2004 13:07:37 -0400
xsl apply templates parameter
Is it legitimate to invoke 'xsl:apply-templates' on a parameter passed to 'xsl:call-template'? In other words, should the following fragment be expected to work:

	<xsl:template match="/">
	   <xsl:call-template name="test">
	      <xsl:with-param name="body">
	         <p>This is my body</p>
	         <matchable id="123"/>
	      </xsl:with-param>
	   </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 name="matchable">
	   <p>The value is <xsl:value-of select="@id"/></p>
	</xsl:template>

On the test platform I'm using (TestXSLT from Marc Liyanage), the different stylesheet processors all choke on this in different ways. Xalan throws an error, LibXSLT ignores it, Saxon and Sablotron blow up.

Replacing the 'xsl:apply-templates' in the named template 'test' by 'xsl:copy-of' works fine - except that, of course, the "matchable" template is never invoked.

The Xalan error ("can not convert #RTREEFRAG to a nodelist") hints that I'm trying to do something basically contrary to the spirit of XSL, or at least XSL 1.0. What I'd like to do can be described as follows: use 'call-template' to 'surround' an arbitrary block of XML, _contained in the XSL stylesheet_, by additional XML content - and have templates applied to the contained block in the usual way.

As to why I want to do this particularly horrible thing, put it down to someone else's questionable design decisions. If the nodes that I want to 'surround' were in the XML rather than the XSL, this would be trivial.

Thanks in advance for any suggestions,

Angus
--
Business:   http://www.nomadcode.com/
Personal:   http://www.raingod.com/angus/
Political:  http://www.gollum2004.com/

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.