RE: document() for non-XML documents

Subject: RE: document() for non-XML documents
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Mon, 27 Sep 1999 09:41:16 -0600
> The document() function allows me to merge multiple XML input 
> documents. [...]
> 
> However, suppose I want to insert the contents of a simple text file:
> 
>   <include href="compositions.txt"/>

The document() function returns a node-set, so as you discovered, the
function does not create a node-set when the argument is the URI of a
non-XML file. Perhaps in the future, if the file exists and is not XML, the
default could be to assume there is a <document> element with the document
contents as a single child text node.

Until then, it sounds like you don't really need the included file to be
treated as a source tree. Why don't you just declare an external entity:

<!DOCTYPE xsl:stylesheet [ 
    <!ENTITY sometext SYSTEM "compositions.txt">\
    <!ENTITY nbsp "&#xA0;">
]>
...
<foo>Here's that file: &sometext;</foo>

One thing I'm not clear on is whether appending to the DTD for an XSL
document by (re)declaring it is actually valid. Anyone?


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


Current Thread