Skip to content

Instantly share code, notes, and snippets.

@CJHArch
Created April 11, 2015 00:22
Show Gist options
  • Save CJHArch/b166828a085fac424d98 to your computer and use it in GitHub Desktop.
Save CJHArch/b166828a085fac424d98 to your computer and use it in GitHub Desktop.
From a list of links in XML, extracts information (in this case, title and partner) from XHTML finding aids
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xs" version="2.0">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:for-each select="root/a">
<xsl:variable name="FA">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:value-of select="normalize-space(document($FA)/xhtml:html/xhtml:head/xhtml:title)"/>
<xsl:text>; </xsl:text>
<xsl:value-of select="normalize-space(document($FA)//xhtml:div[@class='socialmedia'][1]/xhtml:a)"/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment