|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
2 |
| -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
3 |
| - xmlns:xs="http://www.w3.org/2001/XMLSchema" |
4 |
| - xmlns:mei="http://www.music-encoding.org/ns/mei" |
5 |
| - xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs xd mei" version="2.0"> |
| 2 | +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mei="http://www.music-encoding.org/ns/mei" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:functx="http://www.functx.com" exclude-result-prefixes="xs xd" version="2.0"> |
6 | 3 | <xd:doc scope="stylesheet">
|
7 | 4 | <xd:desc>
|
8 | 5 | <xd:p>
|
|
15 | 12 | <xsl:output method="xhtml" media-type="text/html" indent="yes" omit-xml-declaration="yes"/>
|
16 | 13 | <xsl:param name="idPrefix" select="string('')"/>
|
17 | 14 | <xsl:param name="imagePrefix" select="string('')"/>
|
| 15 | + |
| 16 | + <xsl:variable name="footnotes"> |
| 17 | + <xsl:copy-of select=".//mei:annot[@type = 'note' and @place = 'foot']"/> |
| 18 | + </xsl:variable> |
| 19 | + |
| 20 | + <xsl:variable name="footnotesBlock"> |
| 21 | + <xsl:for-each select="$footnotes/mei:annot"> |
| 22 | + <xsl:variable name="counter"> |
| 23 | + <xsl:value-of select="position()"></xsl:value-of> |
| 24 | + </xsl:variable> |
| 25 | + <xsl:variable name="content"> |
| 26 | + <xsl:apply-templates/> |
| 27 | + </xsl:variable> |
| 28 | + <div style="display:flex; color: grey; font-size: smaller; margin-bottom:0.5rem;"> |
| 29 | + <span class="superscript"> |
| 30 | + <xsl:value-of select="$counter"></xsl:value-of> |
| 31 | + </span> |
| 32 | + <div style="display: inline; margin-left: .25rem;"> |
| 33 | + <xsl:copy-of select="$content"></xsl:copy-of> |
| 34 | + </div> |
| 35 | + </div> |
| 36 | + </xsl:for-each> |
| 37 | + </xsl:variable> |
| 38 | + |
| 39 | + <xsl:function name="functx:index-of-deep-equal-node" as="xs:integer*"> |
| 40 | + <xsl:param name="nodes" as="node()*"/> |
| 41 | + <xsl:param name="nodeToFind" as="node()"/> |
| 42 | + <xsl:sequence select=" |
| 43 | + for $seq in (1 to count($nodes)) |
| 44 | + return $seq[deep-equal($nodes[$seq],$nodeToFind)] |
| 45 | + "/> |
| 46 | + </xsl:function> |
| 47 | + |
18 | 48 | <xsl:template match="/">
|
19 | 49 | <xsl:apply-templates/>
|
| 50 | + <xsl:if test="$footnotes != ''"> |
| 51 | + <hr/> |
| 52 | + <xsl:copy-of select="$footnotesBlock"/> |
| 53 | + </xsl:if> |
20 | 54 | </xsl:template>
|
21 | 55 | <xsl:template match="mei:p">
|
22 | 56 | <p>
|
|
26 | 60 | <xsl:apply-templates select="* | text()"/>
|
27 | 61 | </p>
|
28 | 62 | </xsl:template>
|
| 63 | + <xsl:template match="mei:annot[@type = 'note' and @place = 'foot']"> |
| 64 | + <xsl:variable name="footnoteCount"> |
| 65 | + <xsl:value-of select="functx:index-of-deep-equal-node($footnotes/mei:annot, .)"></xsl:value-of> |
| 66 | + </xsl:variable> |
| 67 | + <span class="superscript"><xsl:value-of select="$footnoteCount"/></span> |
| 68 | + </xsl:template> |
29 | 69 | <xsl:template match="mei:ref">
|
30 | 70 | <span class="ref">
|
31 | 71 | <xsl:choose>
|
|
0 commit comments