In article <f2**********************************@w7g2000hsa.g ooglegroups.com>,
ps******@googlemail.com <ps******@googlemail.comwrote:
>I'd like to read a one-line text file using an XSLT transformation.
I'm using libxslt, so I have to use XSLT 1.0.
This post:
http://www.stylusstudio.com/xsllist/...post50080.html
is promising, but I'm afraid I can't decipher it. Can anybody help?
Mike is suggesting that you create another, XML, file that includes
your text file as an entity.
Suppose hello.txt contains your text - "hello world" for example.
Create hello.xml containing
<!DOCTYPE foo [
<!ENTITY ent SYSTEM "hello.txt">
]>
<foo>&ent;</foo>
Then when you read foo.xml with the document function it will be as
if you had a file containing <foo>hello world</foo>. Of course,
you'll be in trouble if the file contains text that is ill-formed
XML.
As an extension to this idea, to save creating a separate file, you
could put an entity reference to the text file *in the xslt stylesheet
itself*, and use document("") to refer to the stylesheet. To do this
the name of the text file would have to be fixed.
-- Richard
--
:wq