[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: xsl:include statement is "unexpected element".
Subject: Re: xsl:include statement is "unexpected element".
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 11 Mar 2010 18:48:46 -0500
|
Hi,
At 01:37 PM 3/11/2010, was written:
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."
You could, however, encapsulate the logic you want in a named
template, and call that where you've placed your xsl:include.
You can then put that template in the included module. Not hard, really.
This is not a conditional include. It is just a conditional call to
something that happens to be included (which is usually just as good).
Cheers,
Wendell
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|