Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutteridge committed Feb 14, 2012
1 parent 75385ee commit c688f1f
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
9 changes: 9 additions & 0 deletions example/people.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
in: people.tsv format=tsv

delineator: likes=,

process: given=tag
process: family=tag
process: email=sha1

xslt: people.xsl
6 changes: 6 additions & 0 deletions example/people.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Given Family Tel email likes
Chris Gutteridge +442380594833 [email protected] Cheese,Fish
Pat McSweeney [email protected] Cheese,Beer,Toast
*COMMENT ignore this line
Ted Slash/annoying [email protected]

65 changes: 65 additions & 0 deletions example/people.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding='utf-8'?>
<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:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"

xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:dcat="http://www.w3.org/ns/dcat#"
xmlns:void="http://www.w3.org/ns/dcat#"
xmlns:oo="http://purl.org/openorg/"
xmlns:local="http://id.southampton.ac.uk/ns/"

xmlns:g="http://purl.org/openorg/grinder/ns/"
>

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no" />

<xsl:template match="/g:grinder-data">
<rdf:RDF>
<xsl:comment>TOP</xsl:comment>
<xsl:apply-templates select="g:row" />
</rdf:RDF>
</xsl:template>
<!--
<row filename='people.tsv'>
<given tag='Pat'>Pat</given>
<family tag='McSweeney'>McSweeney</family>
<tel></tel>
<email sha1='0b1ca0d57c8ac41adf565b20295e97c5715d585c'>[email protected]</email>
<likes>Cheese</likes>
<likes>Beer</likes>
<likes>Toast</likes>
</row>
-->

<xsl:template match="g:row">
<xsl:variable name="uri">http://example.org/id/people/<xsl:value-of select='g:given/@tag' /><xsl:value-of select='g:family/@tag' /></xsl:variable>

<foaf:Person rdf:about="{$uri}">

<foaf:name><xsl:value-of select='g:given' /><xsl:text> </xsl:text><xsl:value-of select='g:family' /></foaf:name>

<xsl:if test='g:tel/text()'>
<foaf:phone rdf:resource='tel:{g:tel}' />
</xsl:if>

<xsl:for-each select='g:likes'>
<local:likes>
<rdf:Description rdf:about='http://example.org/id/likething/{.}'>
<rdf:label><xsl:value-of select='.' /></rdf:label>
</rdf:Description>
</local:likes>
</xsl:for-each>


</foaf:Person>
</xsl:template>

</xsl:stylesheet>


0 comments on commit c688f1f

Please sign in to comment.