- From: Sean B. Palmer <sean@mysterylights.com>
- Date: Fri, 15 Aug 2003 21:12:08 +0100
- To: "Sam Ruby" <rubys@intertwingly.net>, "Ken MacLeod" <ken@bitsko.slc.ut.us>
- Cc: <www-archive@w3.org>
Hi, I've written an implementation in Python that, for an input Atom document with extensions in their own namespaces, will get the RDDL from that namespace, parse it to find links to xsl:templates that extend the main Atom2RDF stylesheet, and then actually extend the stylesheet and spit it out again. The files are in here:- http://infomesh.net/2003/xsltextend/ * extendedAtom.xml is a small Atom file with a new element in it, <ext:archives>, which points to the archives for a weblog. Just a whimsical extension, as a child element of <feed>. * atom2rdf.xsl is the XSLT stylesheet that we worked on the other day, that converts AtomXML into AtomRDF. Of course, it doesn't recognize the <ext:archives> extension in "extendedAtom.xml". * archives2rdf.xsl is an <xsl:template> element as a document. When this is appended to "atom2rdf.xsl", this enables it to transform Atom documents with the <ext:archives> extension. It is basically an extension to the XSLT transformation. * rddl.html is the document that is the namespace for ext: in <ext:archives>. So when you come across an xmlns:ext attribute in the extended Atom, it points to the URI of this file. * makexslt.py.txt is the Python that does the work. You can download it and extendedAtom.xml to a directory, and then run `./makexslt.py extendedAtom.xml`. You'll probably need at least version 2.2 of Python. It will find the ext: prefix, get rddl.html, parse that to find archives2rdf.xsl, and then use Python's minidom module to append that to atom2rdf.xsl before spitting the brand new stylesheet out. * extendedAtom.rdf is the example output, after applying makexslt.py's output to the extended Atom document. So the full dance for converting extendedAtom.xml to RDF is:- ./makexslt.py extendedAtom.xml > extendedAtom2rdf.xsl saxon extendedAtom.xml extendedAtom2rdf.xsl > extendedAtom.rdf Of course you can use whatever XSLT engine you want; you could even modify the Python script to do that all for you. The main disadvantages to this approach are that you have to trust people to provide good XSLT extensions, and you also have to trust them to provide them on the server. In fact, the latter isn't much of a problem since you can just filter out any unknown elements for which you can't download a stylesheet extension. The former, however, is tricky. It may be a showstopping extension problem; you don't want to break the mapping to RDF/XML, or you at least want to be able to remove the extensions that are causing you problems. Incidentally, as noted on #echo, using SSR isn't an option for extensions since it only provides references to whole document transformations. If RDF/XML syntax were used, people would have to make sure that their extensions were compliant anyway, but publishers of AtomRDF wouldn't have to worry about third parties breaking the RDF interpretation of their documents. Transformation extensions could be cached and so forth as necessary. Note that this has been CC'd to www-archive; the W3C's public mailing list archive for random technical issues and whatnot. I've decided that this should be conducted in the open, but away from the spotlight since I wanted to run the approach by you two first. Cheers, -- Sean B. Palmer, <http://purl.org/net/sbp/> "phenomicity by the bucketful" - http://miscoranda.com/
Received on Friday, 15 August 2003 16:12:40 UTC