Skip to content

Instantly share code, notes, and snippets.

@tommorris
Created September 24, 2008 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommorris/12574 to your computer and use it in GitHub Desktop.
Save tommorris/12574 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:irc="http://irc-edelweiss.inria.fr/2008/09/irc/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns="http://www.w3.org/1999/xhtml" xmlns:sioc="http://rdfs.org/sioc/ns#">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="text()" />
<xsl:template match="log">
<html>
<head profile="http://ns.inria.fr/grddl/rdfa/">
<title>IRC Logger for <xsl:value-of select="@source"/></title>
<style type="text/css">
body {
background: #ffffff;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
ol {
display: table;
}
ol li {
/* IE doesn't understand this */
display: table-row;
/* so make the paragraph have no margins to squeeze things up */
padding-left: 0;
margin-left: -2.5em;
}
span[property~="irc:datetime"] {
display: table-cell;
color: #009200;
font-family: Courier New, Courier, mono;
}
span[property~="sioc:has_creator"] {
display: table-cell;
font-weight: bold;
padding: 0 2px 0 2px;
text-align: right;
}
span[property~="irc:content"] {
display: table-cell;
padding-left: 1em;
border-left: #999;
border-width: 0 0 0 1px;
border-style: none none none solid;
}
</style>
</head>
<body about="#" typeof="irc:ChannelLog">
<h1>Log of <xsl:value-of select="@source"/></h1>
<link about="#" href="{substring-before(@source, '%23')}{substring-after(@source, '%23')}" rel="irc:logs_channel" />
<div about="{substring-before(@source, '%23')}{substring-after(@source, '%23')}" typeof="irc:Channel">
<div>
Information about #<span property="irc:channel_name"><xsl:value-of select="substring-after(@source, '%23')"/></span>
</div>
</div>
<ol about="#{substring-after(@source, '%23')}">
<xsl:apply-templates />
</ol>
</body>
</html>
</xsl:template>
<xsl:template match="event[@name='memberParted']">
</xsl:template>
<xsl:template match="event[@name='topicChanged']">
</xsl:template>
<xsl:template match="envelope">
<li about="#{message/@id}" typeof="irc:Message" id="{message/@id}" rev="irc:has_entry" href="#">
<span property="irc:datetime" content="{substring(message/@received, 1, 4)}{substring(message/@received, 6, 2)}{substring(message/@received, 9, 2)}T{substring(message/@received, 12, 2)}{substring(message/@received, 15, 2)}{substring(message/@received, 18, 2)}{substring(message/@received, 21)}">
(<xsl:value-of select="substring(message/@received, 12, 5)"/>)
</span>
<span rel="sioc:has_creator">
<span about="[_:{normalize-space(sender/text())}]" typeof="sioc:User" property="irc:nick" class="vcard fn nick">
<xsl:value-of select="sender/text()"/>
</span>
</span>
<span property="irc:content" datatype="xsd:string">
<xsl:apply-templates mode="message" select="message" />
</span>
</li>
</xsl:template>
<!-- message -->
<xsl:template match="span[@class='member']" mode="message">
<span rel="irc:has_recipient">
<span about="[_:{normalize-space(text())}]" property="irc:nick" typeof="sioc:User" class="vcard fn nick">
<xsl:value-of select="normalize-space(text())"/>
</span>
</span>
</xsl:template>
<xsl:template match="a" mode="message">
<a href="{@href}" rel="irc:mentions_resource"><xsl:value-of select="@href" /></a>
</xsl:template>
<xsl:template match="text()" mode="message">
<xsl:value-of select="current()" />
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment