[xsl] Could not read secondary source document in XSLT stylesheet

Subject: [xsl] Could not read secondary source document in XSLT stylesheet
From: Jack Bush <netbeansfan@xxxxxxxxxxxx>
Date: Wed, 14 Jul 2010 07:32:21 -0700 (PDT)
Hi All,
 
I am getting the following error when trying to read the secondary
source from 
when loading the main source in XSLT stylesheet:
 
Error at
xsl:template on line 12 column 109 
XTSE0010: An xsl:template element must not
contain an xsl:template element
Error at xsl:template on line 12 column 109
XTSE0010: Element must be used only at top level of stylesheet
Error at
xsl:apply-templates on line 13 column 76 
XTTE0520: Required item type of
@select attribute of xsl:apply-templates is 
node();
supplied value has item
type xs:string
Warning: at xsl:variable on line 15 column 40 
SXWN9001: A
variable with no following sibling instructions has no effect
SEVERE: null
javax.xml.transform.TransformerConfigurationException: Failed to compile
stylesheet. 3 errors detected.
 
below is the stylesheet that causes this
error:
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <xsl:stylesheet
version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
4
xmlns:ns="http://www.w3.org/1999/xhtml";
5 exclude-result-prefixes="ns">
6
7
<xsl:output method="xml" omit-xml-declaration="yes"/>
8 <xsl:strip-space
elements="*"/>
9
10 <xsl:template match="employee">
11 <xsl:apply-templates
select="document('C:\\STAFF.xml')"/>
12 <xsl:template match="/ns:employee">
13
<age><xsl:apply-templates select="age"/></age>
14 </xsl:template>
15
<xsl:variable name="company">
16 <xsl:call-template name="department">
17
</xsl:call-template>
18 </xsl:variable>
19 </xsl:template>
20
21 <xsl:template
name="department" match="/">
22 .......
80 </xsl:template>
 
STAFF.xml is made
up of the following data snippet:<?xml version="1.0"?>
<
<firstname>John</firstname>
<surname>Smith</surname>
<age>25</age>
......employee xmlns="http://www.w3.org/1999/xhtml";
xmlns:html="http://www.w3.org/1999/xhtml";>
</employee>
 
I believe there is a
need to wrap the <xsl:call-template name="department"> 
within a variable in
order to retrieve the content of secondary source. Is this 
true? If so, what
is wrong with this stylesheet to have caused this errors?
Thanks a lot,
Jack

Current Thread