Subject: Re: presenting sourcecode through XSL From: Francis Norton <francis@xxxxxxxxxxx> Date: Mon, 15 May 2000 20:11:24 +0100 |
Mattias Konradsson wrote: > > Anyway, I'm working on a XML-format for articles, course-litterature etc > where you need to insert javascript code, html and > xml source code into the document. Essentially I want an xsl stylesheets > that takes a .js .html .xml or whatetever text > format really and outputs html that displays it with exactly the same > indents, whitespace and linebreaks. Anyone worked on > something like this. I'm using MSXML. > Not as trivial as it sounds! The task has two sub-problems. First, formatting. Actually this *is* simple, if inelegent. Just wrap each document in an HTML <code> tag. Second, getting the data in. One solution is just to use XML SYSTEM entities to import the files as blocks of text. The only limitation on this is that the text is imported as PCDATA (I think - or something with the same effect). So any XML syntax in the imported document may break your master document. The solution to this is to write a little filter program to escape out the text you are importing. In fact I happened to write a part solution to this in java for the similar problem of importing directory listings, so I have just extended it to escape "<"s as well as "&"s and posted it (uncommented and untested, but with working demo data and batch file) to http://www.redrice.com/xml/xmlDir.zip - unzip it all into one directory and give it a try. Francis. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
presenting sourcecode through XSL, Mattias Konradsson | Thread | Re: presenting sourcecode through X, Francis Norton |
Re: feature request, Eric van der Vlist | Date | Re: presenting sourcecode through X, Francis Norton |
Month |