New Atom/RDF XSLT

1 view
Skip to first unread message

David Powell

unread,
Apr 22, 2006, 10:44:40 AM4/22/06
to atom...@googlegroups.com

Hi,

Just thought I'd give you guys an update to where I am:

I've been working on some improvements to the Atom/RDF XSLT transform.
The old version made quite a bit of use of xsl:for-each, which for a
data-oriented format like Atom, isn't a big deal, but it unfortunately
made things a bit monolithic. For example, I wanted to make it
possible to process atom:entry documents and RSS2 feeds (that might
contain atom: namespaced extensions), using the same code-base.

Another issue was extensions. Whilst I like support for generic
extensions, it should be possible to override this with specific
support for well-known extensions.


So - the new stylesheet has the following major features:

* Modular support for other feed formats. Added support for RSS2 to
Atom/RDF (although it only currently supports core RSS2 elements, I'd
like to enhance it to work with "funky" extensions like
content:encoded, xhtml:div etc too).

* Pluggable extension support - by creating a couple of rules and
importing the stylesheet, you can add customized support for specific
extensions, instead of, or as well as generic extension support. Eg:

<xsl:template mode="query-pluggable-extension" match="foaf:firstName">plugin</xsl:template>
<xsl:template mode="pluggable-extension" match="foaf:firstName">
<xsl:value-of select="." />
</xsl:template>

A pretty simple example, but you can handle arbitrarily complex
structured extensions too.

* Rewritten to use xsl:apply-templates and "mode" extensively, which
makes it more reusable.


Anyway, new stylesheet is:
<http://djpowell.net/atomrdf/0.1/files/atom2rdf-13.xsl>

Here is an example, that transforms Sam's feed:
<http://www.w3.org/2000/06/webdata/xslt?xslfile=http%3A%2F%2Fdjpowell.net%2Fatomrdf%2F0.1%2Ffiles%2Fatom2rdf-13.xsl&xmlfile=http%3A%2F%2Fwww.intertwingly.net%2Fblog%2Findex.atom&transform=Submit&contentbase=http%3A%2F%2Fwww.intertwingly.net%2Fblog%2Findex.atom>


The RSS parser supports the RFC822 date format, including bizarre
obsolete formats such as dates with inline comments. The date parser
has been pulled out into a seperate stylesheet. You can try it out
with this in-browser test-case:

http://djpowell.net/atomrdf/0.1/files/rssdates.xml

(It was a lot easier to write than the URIRef parser!)

--
Dave

Henry Story

unread,
Apr 25, 2006, 11:25:16 AM4/25/06
to atom...@googlegroups.com
Cool. I'll be looking at this more in detail soon, as I will want to
inspire myself to write an xslt for atom-owl (an improved one I need
to write that would take into account a lot of the points discussed
on this list). As I am really bad at xslts, this may take some time.

Henry

Reply all
Reply to author
Forward
0 new messages