You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jarlath Lyons <ja...@activeindexing.com> on 2000/04/14 15:45:28 UTC

Short term fix for associating stylesheets with an XML document

The attached class should be of some use ....

I happen to be starting with a stream, so I use it like below ....

It's a rather simple api ... you create a Hashtable of lines you want to
add by
setting the Hashtable key to the destination line number.

To make it really flexible, you'd probably need to use a Vector instead
of a
Hashtable in order to insert multiple lines at 'line 1' .... but I want
higher performance ...
I don't want to be constantly scanning through all the Vector elements.
..../



----------

Hashtable styleSheetInfo = new Hashtable();

String styleSheet = ResourceBundle.....getString("stylesheet.vanilla");
...OR ...
String styleSheet = "<?xml-stylesheet
href=\"http://a.b.c/std/xsl/vanilla.xsl\"
type=\"text/xsl\"?>\n<?cocoon-process type=\"xslt\"?>";

//
// we want to add the stylesheet tags right after the first line ...
//
styleSheetInfo.put(new Integer(1),styleSheet);

FilterLineNumberReader flnr = new FilterLineNumberReader(new
InputStreamReader(... input stream ....),styleSheetInfo);


... read away .....




--
Jar Lyons
Senior Software Engineer
ActiveIndexing.com

jar.lyons@activeindexing.com
(206) 387-5117

100 West Harrison, Suite 310
Seattle, WA  98119