[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: presenting sourcecode through XSL

Subject: Re: presenting sourcecode through XSL
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Mon, 15 May 2000 20:11:24 +0100
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.