|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: presenting sourcecode through XSL
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








