[xquery-talk] Associate external css style sheet with xquery output

Ghislain Fourny gfourny at inf.ethz.ch
Mon May 30 00:29:32 PDT 2011

Hi Hisham,

This stylesheet information is called a processing instruction (PI) and it is supported by XQuery. My guess is that you can use a direct PI constructor - note however that you will need a comma between it and your root element node (if it is at the top level of the query) for the query to parse:

<?xml-stylesheet href="style1_1_1.css" type="text/css" ?>,

If the content of the PI must be dynamically constructed, you can use a computed PI constructor, like:

processing-instruction { "xml-stylesheet" }  { 'href="style1_1_1.css" type="text/css"'},

where you can put any expression in each of the curly braces.

I hope this helps?

Kind regards,

On May 30, 2011, at 7:26 AM, hisham ben otman wrote:

> Hi
> How can I associate an external css style sheet with my xquery output. The xml declaration <?xml version ="1.0" ?> is generated automatically by the saxon processor. How can I change it to include my stylesheet information, e.g. 
> <?xml-stylesheet href="style1_1_1.css" type="text/css" ?>
> I am using saxon-B api for .Net 
> If this is not possible, is there another way to include css inline formatting in the output?
> Thank you
> Hisham
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

More information about the talk mailing list