- From: Axel Polleres <axel.polleres@deri.org>
- Date: Mon, 04 Feb 2008 20:34:00 +0000
- To: shylaja.sannegowda@wipro.com
- CC: public-sparql-dev@w3.org
shylaja.sannegowda@wipro.com wrote: > Hello, > > Please let me know how I should convert sparql results into html format. > > *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 > well, does that XSL below for example serve your purposes? (credits to Gennaro, a student of mine) Axel <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ruleml="http://www.ruleml.org/0.9/xsd" xmlns:spr="http://www.w3.org/2007/SPARQL/results#"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:variable name="nvars" select="count(//spr:variable)"/> <xsl:variable name="nres" select="count(//result)"/> <xsl:element name="table"> <xsl:attribute name="border">1</xsl:attribute> <xsl:element name="tr"> <xsl:element name="th"> <xsl:attribute name="colspan"> <xsl:value-of select="$nvars"/> </xsl:attribute>Results </xsl:element> </xsl:element> <xsl:element name="tr"> <xsl:for-each select="//spr:variable"> <xsl:element name="th"> <xsl:value-of select="@name"/> </xsl:element> </xsl:for-each> </xsl:element> <xsl:for-each select="//spr:result"> <xsl:element name="tr"> <xsl:apply-templates/> </xsl:element> </xsl:for-each> </xsl:element> </xsl:template> <xsl:template match="spr:binding"> <xsl:element name="td"> <xsl:copy-of select="child::node()/child::node()"/> </xsl:element> </xsl:template> <xsl:template match="text()|@*"/> </xsl:stylesheet>
Received on Monday, 4 February 2008 20:34:27 UTC