Skip to content

Instantly share code, notes, and snippets.

@pbinkley
Created August 5, 2014 21:26
Show Gist options
  • Save pbinkley/85dc9f9b06e6d21493d2 to your computer and use it in GitHub Desktop.
Save pbinkley/85dc9f9b06e6d21493d2 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"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:ead="urn:isbn:1-931666-22-9"
exclude-result-prefixes="xd ead"
version="1.0">
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> Dec 20, 2010</xd:p>
<xd:p><xd:b>Author:</xd:b> pbinkley</xd:p>
<xd:p></xd:p>
</xd:desc>
</xd:doc>
<xsl:output method="html" indent="yes" encoding="utf-8"/>
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="normalize-space(ead:ead/ead:eadheader/ead:filedesc/ead:titlestmt/ead:titleproper)"/></title>
<style type="text/css">
div.c {border: 1px solid black; margin-left: 1em; padding-left: 5px;}
span.title {font-weight: bold;}
</style>
</head>
<body>
<h1><xsl:value-of select="normalize-space(ead:ead/ead:eadheader/ead:filedesc/ead:titlestmt/ead:titleproper)"/></h1>
<xsl:apply-templates select="/ead:ead/ead:archdesc/ead:dsc/ead:c"/>
</body>
</html>
</xsl:template>
<xsl:template match="ead:c">
<div class="c {@level}">
<p>
<xsl:value-of select="substring-after(@id, 'ref')"/>
<xsl:text> (</xsl:text>
<xsl:value-of select="@level"/>
<xsl:text>) </xsl:text>
<span class="title">
<xsl:value-of select="ead:did/ead:unittitle"/>
</span>
</p>
<xsl:apply-templates
select="ead:scopecontent | ead:arrangement | ead:custodhist | ead:bioghist"
/>
<xsl:apply-templates select="ead:c"/>
</div>
</xsl:template>
<xsl:template match="ead:scopecontent | ead:arrangement | ead:custodhist | ead:bioghist">
<div class="note {local-name()}">
<h3>
<xsl:value-of select="ead:head"/>
</h3>
<xsl:for-each select="ead:p">
<p><xsl:value-of select="."/></p>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment