[xsl] document() function in XT with relative file not working?

Subject: [xsl] document() function in XT with relative file not working?
From: sara.mitchell@xxxxxxxxx
Date: Fri, 23 Mar 2001 16:14:44 -0500
I'm totally baffled on why I'm getting this problem, especially
since so many examples from books etc. look just like this. I'm using the
document() function with the XT processor (Windows, not Java version)
pointing to a document with no path information. The function
appears to be returning an empty node set and I have no idea
why. Any suggestions would be helpful. 

I have a simple source document (doctest.xml), a simple XSL
(doctest.xsl) and another simple XML file (colors.xml) all
in the same directory. When I run XT from the command line, 
the HTML output I get shows no nodes from the colors.xml file
--which I'm assuming means that XT is not finding colors.xml. 

Here's the files: 

doctest.xml
------------------------------------------------
<?xml version="1.0"?>
<test>
<title>Testing document() in XT</title>
<para>This is solely to allow a generic test of document() 
in XT.</para>
</test>

doctest.xsl
-------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
   xmlns:xt="http://www.jclark.com/xt";
   extension-element-prefixes="xt"
   exclude-results-prefixes="xt">

<xsl:output method="html" version="4.0" 
indent="yes" encoding="iso-8859-1"/>

<xsl:template match="/">
<html>
<body>
<xsl:variable name="colors" select="document(colors.xml)/colors"/>
<p>Nodes in color <xsl:value-of select="count($colors)"/></p>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

colors.xml (abbreviated)
-----------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<colors>
<dark>
 <container name="help">
  <category name="internet" version="1">990000</category>
  <category name="intranet" version="1">0839a6</category>
 </container>
 <container name="book">
  <category name="developer" version="1">088ea6</category>
  <category name="tools" version="1">017701</category>
  <category name="default" version="1">0839a6</category>
 </container>
 <container name="article">
  <category name="developer" version="1">088ea6</category>
  <category name="tools" version="1">017701</category>
  <category name="default" version="1">0839a6</category>
 </container>
</dark>
</colors>

and the HTML output from this command:

xt doctest.xml doctest.xsl doctest.htm
-----------------------------------------------------------
<html>
<body>
<p>Nodes in color 0</p>
Testing document() in XT
This is solely to allow a generic test of document() in XT.
</body>
</html>

Thanks, 

Sara Mitchell

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread