Note that there are some explanatory texts on larger screens.

plurals
  1. POXSLT transformation from RDF to html
    text
    copied!<p>I am trying to transform an RDF file to HTML using XSLT.</p> <p>I am using the template that i've found on the web: <a href="http://snippets.dzone.com/posts/show/1164" rel="nofollow">http://snippets.dzone.com/posts/show/1164</a></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:foo="http://purl.org/rss/1.0/"&gt; &lt;xsl:output method="html"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:apply-templates select="/rdf:RDF/foo:channel"/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="/rdf:RDF/foo:channel"&gt; &lt;h3&gt;&lt;xsl:value-of select="foo:title"/&gt;&lt;/h3&gt; &lt;p&gt;&lt;xsl:value-of select="foo:description"/&gt;&lt;/p&gt; &lt;ul&gt; &lt;xsl:apply-templates select="/rdf:RDF/foo:item"/&gt; &lt;/ul&gt; &lt;/xsl:template&gt; &lt;xsl:template match="/rdf:RDF/foo:item"&gt; &lt;li&gt; &lt;a href="{foo:link}" title="{substring(dc:date, 0, 11)}"&gt;&lt;xsl:value-of select="foo:title"/&gt;&lt;/a&gt; &lt;p&gt;&lt;xsl:value-of select="foo:description" disable-output-escaping="yes" /&gt;&lt;/p&gt; &lt;/li&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>It works perfectly with an RDF file like that: (Here is the <strong>link</strong> to the complete file) <a href="http://dl.dropbox.com/u/2232733/rdfexample.xml" rel="nofollow">http://dl.dropbox.com/u/2232733/rdfexample.xml</a></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;!-- generator="wordpress/1.2" --&gt; &lt;rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" &gt; &lt;channel rdf:about="http://www.wasab.dk/morten/blog/rdf"&gt; &lt;title&gt;Binary Relations&lt;/title&gt; &lt;link&gt;http://www.wasab.dk/morten/blog&lt;/link&gt; &lt;description&gt;Reflections on the web&lt;/description&gt; &lt;dc:language&gt;en&lt;/dc:language&gt; &lt;dc:date&gt;2004-05-29T23:02:37Z&lt;/dc:date&gt; &lt;admin:generatorAgent rdf:resource="http://wordpress.org/?v=1.2"/&gt; &lt;sy:updatePeriod&gt;hourly&lt;/sy:updatePeriod&gt; &lt;sy:updateFrequency&gt;1&lt;/sy:updateFrequency&gt; &lt;sy:updateBase&gt;2000-01-01T12:00+00:00&lt;/sy:updateBase&gt; &lt;items&gt; &lt;rdf:Seq&gt; &lt;rdf:li rdf:resource="http://www.wasab.dk/morten/blog/archives/2004/05/30/wordpress-plugin-linkifier"/&gt; ... &lt;rdf:li rdf:resource="http://www.wasab.dk/morten/blog/archives/2004/05/20/yet-another-semweb-blogger"/&gt; &lt;/rdf:Seq&gt; &lt;/items&gt; &lt;/channel&gt; &lt;item rdf:about="http://www.wasab.dk/morten/blog/archives/2004/05/30/wordpress-plugin-linkifier"&gt; &lt;title&gt;WordPress Plugin: Linkifier&lt;/title&gt; </code></pre> <p>However, I can't make it work for an RDF\XML that i get from lastfm.rdfize.com/: (here is the <strong>link</strong> for the file) <a href="http://dl.dropbox.com/u/2232733/metallica_rdf_xml.xml" rel="nofollow">http://dl.dropbox.com/u/2232733/metallica_rdf_xml.xml</a></p> <p>It has a different structure and I can't figure out what tags in XSTL should i use to make an HTML from it:</p> <pre><code>rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:terms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:mo="http://purl.org/ontology/mo/" xmlns:ov="http://open.vocab.org/terms/" xmlns:event="http://purl.org/NET/c4dm/event.owl#" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:v="http://www.w3.org/2006/vcard/ns#"&gt; &lt;rdf:Description rdf:about="http://lastfm.rdfize.com/artists/Metallica"&gt; &lt;rdf:type rdf:resource="http://purl.org/ontology/mo/MusicArtist"/&gt; &lt;rdfs:label&gt;Metallica&lt;/rdfs:label&gt; ... </code></pre> <p>So my question is - how should I form an XSLT to process my RDF? Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload