Debian Codegraph @

texmf-dist/doc/bibtex/bibhtml/bibhtml-extract-aux.xslt

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 ! bibhtml-extract-aux.xslt
4 !
5 ! Part of bibhtml, version 2.0.2, released 2013 September 8
6 ! Hg Node 7076ce83a035.
7 ! See <http://purl.org/nxg/dist/bibhtml>
8 !
9 ! This sample script processes an XML file which contains elements like
10 ! <span class='cite'>citation</span>, extracting each of the `citation'
11 ! strings and emitting a .aux file which, once a \bibdata line has been
12 ! appended, is suitable for processing with BibTeX. Adapt or extend as
13 ! appropriate.
14 !-->
15 <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"
16 version="1.0"
17 exclude-result-prefixes="h"
18 xmlns:h="http://www.w3.org/1999/xhtml">
19
20 <output method="xml"
21 version="1.0"
22 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
23 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
24 omit-xml-declaration="yes"/>
25
26 <template match="/">
27 <text>\relax
28 </text>
29 <apply-templates select="//h:span[@class='cite']"/>
30 <apply-templates select='//processing-instruction("bibliography")'/>
31 <!--
32 <call-template name="make-tex-command">
33 <with-param name="command">bibstyle</with-param>
34 <with-param name="content">plainhtml</with-param>
35 </call-template>
36 -->
37 </template>
38
39 <template match="h:span[@class='cite']">
40 <!--
41 <h:a>
42 <attribute name='href'>
43 <text>#</text>
44 <copy-of select='.'/>
45 </attribute>
46 <copy-of select='.'/>
47 </h:a>
48 -->
49 <call-template name="make-tex-command">
50 <with-param name="command">citation</with-param>
51 <with-param name="content">
52 <copy-of select="."/>
53 </with-param>
54 </call-template>
55 </template>
56
57 <template match='processing-instruction("bibliography")'>
58 <choose>
59 <when test='string-length(.) = 0'>
60 <text>% No bibliography file specified!
61 </text>
62 </when>
63 <when test='contains(.," ")'>
64 <call-template name='make-tex-command'>
65 <with-param name='command'>bibdata</with-param>
66 <with-param name='content'>
67 <value-of select='substring-before(.," ")'/>
68 </with-param>
69 </call-template>
70 <call-template name='make-tex-command'>
71 <with-param name='command'>bibstyle</with-param>
72 <with-param name='content'>
73 <value-of select='substring-after(.," ")'/>
74 </with-param>
75 </call-template>
76 </when>
77 <otherwise>
78 <call-template name='make-tex-command'>
79 <with-param name='command'>bibdata</with-param>
80 <with-param name='content'>
81 <value-of select='normalize-space(.)'/>
82 </with-param>
83 </call-template>
84 </otherwise>
85 </choose>
86 </template>
87
88 <template name="make-tex-command">
89 <param name="command"/>
90 <param name="content"/>
91 <text>\</text>
92 <value-of select="$command"/>
93 <text>{</text>
94 <value-of select="$content"/>
95 <text>}
96 </text>
97 </template>
98
99 </stylesheet>