Skip to content

Instantly share code, notes, and snippets.

@LeifW
Created January 3, 2011 23:51
Show Gist options
  • Select an option

  • Save LeifW/764196 to your computer and use it in GitHub Desktop.

Select an option

Save LeifW/764196 to your computer and use it in GitHub Desktop.
FOAF 'em all
#!/usr/local/bin/pxsl
stylesheet -version=1.0 -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -xmlns=http://xmlns.com/foaf/0.1/ -xmlns:bio=http://purl.org/vocab/bio/0.1/ -xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# -xmlns:rdfs=http://www.w3.org/2000/01/rdf-schema# -xmlns:epdx=http://epdx.org/schema
import util.xsl
output -indent=yes
template /
rdf:RDF
rdf:Description -rdf:about=http://twitter.com -rdfs:label=Twitter
rdf:Description -rdf:about=http://github.com -rdfs:label=GitHub
apply-templates
template groups
apply-templates
template group
Group -rdf:about={epdx:urlize(name)}
apply-templates
template members
for-each member
member -rdf:resource={concat('/people/',epdx:urlize(name))}
template name
name
value-of .
template url
homepage -rdf:resource={.}
template email
mbox -rdf:resource={concat('mailto:',.)}
template photo-file-name
depiction -rdf:resource={concat('http://epdx.org/system/photos/',../id,'/medium/',.)}
template twitter
twitterID
value-of .
template bio
bio:biography
value-of .
template location
epdx:location
value-of .
template tags
apply-templates
template tag
epdx:tag
rdf:Description -rdf:about={concat('/tags/',id)} -rdfs:label={name}
template technologies
apply-templates
template technology
epdx:technology
rdf:Description -rdf:about={concat('/technologies/',id)} -rdfs:label={name}
template *[@nil='true']
template *
template text()
stylesheet -version=1.0 -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -xmlns=http://xmlns.com/foaf/0.1/ -xmlns:bio=http://purl.org/vocab/bio/0.1/ -xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# -xmlns:rdfs=http://www.w3.org/2000/01/rdf-schema#
output -indent=yes
template /
rdf:RDF
rdf:Description -rdf:about=http://twitter.com -rdfs:label=Twitter
rdf:Description -rdf:about=http://github.com -rdfs:label=GitHub
apply-templates
template people
apply-templates
template person
Person -rdf:about={twitter} -- use twitter id for URI
apply-templates
template first-name
givenName
value-of .
template last-name
familyName
value-of .
template url
homepage -rdf:resource={.}
template email
mbox -rdf:resource={concat('mailto:',.)}
template avatar-url
depiction -rdf:resource={.}
template twitter
twitterID
value-of .
template bio
bio:biography
value-of .
template *[@nil='true']
template *
template text()
stylesheet -version=1.0 -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -xmlns=http://usefulinc.com/ns/doap# -xmlns:foaf=http://xmlns.com/foaf/0.1/ -xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# -xmlns:rdfs=http://www.w3.org/2000/01/rdf-schema#
output -indent=yes
template /
rdf:RDF
apply-templates
template repositories
apply-templates
template repository
Project -rdf:about={name}
apply-templates
template name
name
value-of .
template language
programming-language
value-of .
template homepage
homepage -rdf:resource={.}
template url
repository
GitRepository
browse -rdf:resource={.}
location -rdf:resource={concat(.,'.git')}
template *[@nil='true']
template *
template text()
#!/usr/local/bin/pxsl
stylesheet -version=1.0 -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -xmlns:func=http://exslt.org/functions -extension-element-prefixes=func -xmlns:epdx=http://epdx.org/schema
func:function -name=epdx:urlize
param string
func:result -select=<<translate($string,'ABCDEFGHIJKLMNOPQRSTUVWXYZ ','abcdefghijklmnopqrstuvwxyz_')>>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:mp="http://musicpath.org/scene#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<title property="foaf:name"/>
<script src="/js/jquery-1.4.4.min.js" ></script>
<script src="webapp/js/underscore-min.js"></script>
<script src="webapp/js/jquery.childrenUntil.js"></script>
<script src="/js/edit.js" ></script>
</head>
<body>
<div>
<p>
<label>First name:</label>
<span property="foaf:givenname"></span>
</p>
<p>
<label>Last name:</label>
<span property="foaf:familyName"></span>
</p>
<p>
<label>Email:</label>
<span rel="foaf:mbox" href=""></span>
</p>
<p rel="foaf:holdsAccount">
<span typeof="foaf:OnlineAccount">
<b>
<a rel="foaf:accountServiceHomepage" href="http://twitter.com/">Twitter:</a>
</b>
<a rel="foaf:accountProfilePage" href="http://twitter.com/" property="foaf:accountName"></a>
</span>
</p>
<p>
<b>Url:</b>
<a rel="foaf:homepage" href=""></a>
</p>
<br/>
<h4>Projects</h4>
<ul rel="foaf:currentProject">
<li>
<a href="">
<strong property="doap:name"></strong>
</a>
</li>
</ul>
</div>
</body>
</html>
div(rel="foaf:primaryTopic" resource="#me")
p
label First name:
span(property="foaf:givenname")
p
label Last name:
span(property="foaf:familyName")
p
label Email:
span(rel="foaf:mbox" href="")
p(rel="foaf:holdsAccount")
span(typeof="foaf:OnlineAccount")
b
a(rel="foaf:accountServiceHomepage" href="http://twitter.com/") Twitter:
a(rel="foaf:accountProfilePage" href="http://twitter.com/" property="foaf:accountName")
p
b Url:
a(rel="foaf:homepage" href="")
br
h4 Projects
ul(rel="foaf:currentProject")
li
a(href="")
strong(property="doap:name")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment