Re: [xsl] xsl:include statement is "unexpected element".

Subject: Re: [xsl] xsl:include statement is "unexpected element".
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 11 Mar 2010 19:37:10 +0100
Tim Hibbs wrote:

Ah HA!

I have it several levels down, which is undoubtedly the problem:
<xsl:stylesheet>...
   <xsl:template>...
      <xsl:if>...
         <xsl:include>...

It must be a child, and not a descendant, apparently. Thank you.

Is there a way to package and include templates at a level lower than
child-of-stylesheet-or-transform?

No, the file you include must itself be a stylesheet (i.e. have an xsl:stylesheet or xsl:transform root element).
This is what the XSLT 1.0 specification says about xsl:include:


"The inclusion works at the XML tree level. The resource located by the href attribute value is parsed as an XML document, and the children of the xsl:stylesheet element in this document replace the xsl:include element in the including document. The fact that template rules or definitions are included does not affect the way they are processed."


--


	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread