Last active
August 13, 2018 12:56
-
-
Save adamretter/47ea02a06cde84d4fe03eb887747c35d to your computer and use it in GitHub Desktop.
pedb example for Luca
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:id="pedb"> | |
<teiHeader> | |
<fileDesc> | |
<titleStmt> | |
<title>Database of persons</title> | |
</titleStmt> | |
<publicationStmt> | |
<ab/> | |
</publicationStmt> | |
<sourceDesc> | |
<ab/> | |
</sourceDesc> | |
</fileDesc> | |
</teiHeader> | |
<text> | |
<body> | |
<listPerson> | |
<person xml:id="pe0001"> | |
<note/> | |
</person> | |
</listPerson> | |
</body> | |
</text> | |
</TEI> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let $xml := document { | |
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:id="myxml"> | |
<teiHeader> | |
</teiHeader> | |
<text> | |
<body> | |
<div> | |
<p><persName ref="pe0001">Bla</persName></p> | |
</div> | |
</body> | |
</text> | |
</TEI> | |
} | |
let $xsl := document { | |
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" version="2.0"> | |
<xsl:template match="/"> | |
<xsl:variable name="pedb" select="doc('pedb.xml')"/> | |
<xsl:variable name="peid" select="./@ref"/> | |
<xsl:variable name="note" select="$pedb//tei:person[@xml:id eq $peid]//tei:note"/> | |
<data> | |
<pedb><xsl:copy-of select="$pedb"/></pedb> | |
<peid><xsl:copy-of select="$peid"/></peid> | |
<note><xsl:copy-of select="$note"/></note> | |
</data> | |
</xsl:template> | |
</xsl:stylesheet> | |
} | |
return | |
transform:transform($xml, $xsl, ()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment