Re: [xsl] That old song "document() with text-files"

Subject: Re: [xsl] That old song "document() with text-files"
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 25 Apr 2003 21:27:50 -0600 (MDT)
Alexander Johannesen wrote:
> Michael Kay <mhk@xxxxxxxxx> wrote:
> > You can use the XSLT 2.0 function unparsed-text() in Saxon 7.4.
> 
> Bingo! :) Does anyone know of similar functions in other parsers.
> (Damn those Saxon people; they've got all the cool whistles and bells,
> don't they? :) Or does it exsist an EXSLT equivalent? *hoping*

We have an extension function like that in 4Suite, but I wouldn't
choose an XSLT processor just on the basis of it having that one function.
It's probably one of the easiest extensions to write for any processor,
anyway.

There's also the option of

<?xml version="1.0"?>
<!DOCTYPE wrapper [ <!ENTITY textfile SYSTEM "mytext.txt"> ]>
<wrapper>&textfile;</wrapper>

and

<xsl:value-of select="document('wrapper.xml')/wrapper/text()"/>

although if mytext.txt is not UTF-8 encoded (or isn't UTF-16 with a BOM) then
you'll need to first ensure that mytext.txt starts with an accurate XML text
declaration like

<?xml version="1.0" encoding="iso-8859-1"?>

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

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


Current Thread