Re: How to convert sparql results into html format

(For toolkit specific question, you may wish to ask on the mailing list of 
that system - jena-dev@groups.yahoo.com)


The call to:
    ResultSetFormatter.outputAsXML(out, results, stylesheet);

takes the URL of the stylesheet, not the stylesheet itself.  The formatting of 
the SPARQL XML results then puts a line in the XML

<?xml-stylesheet type="text/xsl" href="STYLESHEET URL"?>

in the output.  The browser then applies the style sheet to get the HTML to 
display.  See http://www.sparql.org/query.html for an example - if yo ulook at 
the page source for the results you will see the formatting control.

To apply an inline stylesheet, you could get the XML results, then use 
whatever local XSLT processor you wish to.

	Andy


shylaja.sannegowda@wipro.com wrote:
> 
> 
> Hello,
> 
> I am very new to this technology. I have one rdf file and I am reading 
> this file using jena framework api and I am getting sparql results. I am 
> using ResultSetFormatter.outputAsXML(out, results, stylesheet) method to 
> display results. But I am getting the error message as
> 
> The XML page cannot be displayed
> 
> Cannot view XML input using XSL style sheet. Please correct the error 
> and then click the Refresh button, or try again later.
> 
>  
> 
> -------------------------------------------------------------------------------- 
> 
> 
> Invalid at the top level of the document. Error processing resource ' 
> http://localhost:8090/query/servlet/queryExample4 
> <BLOCKED::http://localhost:8090/query/servlet/queryExample4> '. L...
> 
> </xsl:stylesheet>"?>
> 
> -----------------^
> 
> I have attached rdf and java file. Please let me know how I should 
> correct this error. I am making xsl as string in my application is it ok 
> or any other way to display. Please let me know.
> 
>  
> *Thanks and Regards,
> Shylaja N.S
> Wipro Technologies., - Bangalore
> Phone : 9880648604*
> 
>  
> 
> *P** Please do not print this email unless it is absolutely necessary. 
> Spread environmental awareness.*
> 
> The information contained in this electronic message and any attachments 
> to this message are intended for the exclusive use of the addressee(s) 
> and may contain proprietary, confidential or privileged information. If 
> you are not the intended recipient, you should not disseminate, 
> distribute or copy this e-mail. Please notify the sender immediately and 
> destroy all copies of this message and any attachments.
> 
> WARNING: Computer viruses can be transmitted via email. The recipient 
> should check this email and any attachments for the presence of viruses. 
> The company accepts no liability for any damage caused by any virus 
> transmitted by this email.
> 
> www.wipro.com
> 

-- 
Hewlett-Packard Limited
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England

Received on Wednesday, 6 February 2008 12:04:47 UTC