Posted on 2000-04-10
Last Modified: 2013-11-18
Could someone please help me figure out where i'm going wrong. I have the following files:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="animal.xsl"?>
            <name>Mr Ed</name>
            <name>Curious George</name>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="">
      <xsl:template match="/">
      <xsl:template match="animal">
            <xsl:for-each select="horse | monkey">
      <xsl:template match="name">
      <xsl:template match="legs">

Animal.xml will display as expected in IE5.0 with headings 'Name' and 'Legs' and corresponding data.
I want to add an xsl:include directive to my xsl doc (I'm putting it immediately after the xsl:stylesheet element). But I get the error:
Keyword xsl:include may not be used here.
If I change the xsl namespace to "" then I don't get the error, but my output is now just the titles 'Name' and 'Legs' and not the data .

Thank you.
Question by:fwickes
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 27

Expert Comment

ID: 2709498
The second namespace link (if it is at all used!) is ambiguous. The xsl:include MUST go in after the xsl:stylesheet element (so the spec). Are you sure that you got the xsl:include directive correct? Furthermore the include expects a complete stylesheet which it will parse and extract the children from the xsl:stylesheet element.

Author Comment

ID: 2709541
is this right?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="">
<xsl:include href="animal2.xsl"/>
rest of xsl as above

...where animal2.xsl is a valid well-formed xsl
LVL 27

Expert Comment

ID: 2709792
Providing the path to animal2.xsl is correct and your last comment also holds then - yes.
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.


Author Comment

ID: 2709854
.so can you think a possible reason I get the error
"Keyword xsl:include may not be used here" ?? Could it just be that my parser(XSpy, IE5.0) doesn't support the include directive? If this is the case do you know of one that does?
LVL 27

Expert Comment

ID: 2713685
I admit that the error message is strange "...not expected here"!? Since the spec says that it MUST be there and nowhere else. I don't know if it does support include (I'll try and find out), but you could try one last thing - try putting it BEFORE the stylesheet tag (just to see).

Accepted Solution

sistudio041900 earned 50 total points
ID: 2730471
Look at:

* "Import/Include (section 2.8). Workaround: Include can be simulated with external entities."

I checked all the possibile things with MSXML3 and there is no way! import and include just dont work in MSXML3 march release. So you need to use other means or other tools. Sorry for not giving the direct solution but this is answer to the question/problem.

you are not doing anything wrong. I copied the W3C example code and checked. MSXML3 just done have xsl:include

workaround: I wrote an commandline xsl-converter (10 lines of Delphi code, uses msxml3) that converter can be modifiled to support include file, ie the commandline tool would read al the xsl, check for include, merge and run MSXML3


Author Comment

ID: 2732315
Thank you!

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question