|
Subject: Re: [xsl] importing from txt file From: john wa <jonni@xxxxxxxxx> Date: Mon, 3 Sep 2001 16:35:54 +0200 (MEST) |
> john wa wrote:
> > in my xsl i need to reference an external document which is a text file.
> >
> > i try to do something like <xsl:copy-of select="document('eg.txt')/" />
> > but obviously, because eg.txt isn't an xml file it won't work. is there
> > another way to import a file but treat the whole file as CDATA?
>
> You can use xml's external entities, e.g. place at the prolog of your
> stylesheet entity declaration:
>
> <!DOCTYPE xsl:stylesheet [
> <!ENTITY text SYSTEM "file://c:\text.txt">
> ]>
>
> and then in a template you can output it this way:
>
> <xsl:text>&text;</xsl:text>
>
> But be warned: non-validating xml parser may not resolve external
> entities at all, in fact ie5 does resolving but mozilla doesn't.
>
> --
> Oleg Tkachenko
this is nearly what i wanted but then i have the problem that i don't know
what the file is until half way through the processing.
my situation is that i have an xml file which has a reference to another
file which is plain text. when i output pages (to html) i need this text file to
be included.
so i have xml similar to
<file name="wibble.zip" txt="wibble.info"/>
<file name="wobble.zip" txt="wobble.info"/>
...
if every file had the same description, in my xsl i would just create a
CDATA section...
<![CDATA[
A bit of text where output is escaped
]]>
but because the txt is different for each file i would like
<xsl:copy-of select="document(@txt)" />
but somehow say that this document is all CDATA, and that there's no tags.
i'm using the gnome xsl library from perl so i can't do any funky java with
it :(
i hope this makes the problem clearer :)
--
Sent through GMX FreeMail - http://www.gmx.net
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] importing from txt file, Oleg Tkachenko | Thread | Re: [xsl] importing from txt file, David Carlisle |
| Re: [xsl] Special Language Characte, Swen Thuemmler | Date | Re: [xsl] custom for-each loop in X, Gurnandan Kaur |
| Month |