annotate summa/bilingual/merge.xpl @ 75:fad07ffd0386

add indices of questions and articles
author ht
date Tue, 05 Jan 2010 16:18:40 +0000
parents 3dd981256764
children 2a8a66db129a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
1 <?xml version='1.0'?>
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
2 <!DOCTYPE p:pipeline SYSTEM "../../../../WWW/XML/XProc/docs/schemas/xproc.dtd" >
75
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
3 <p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:x="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
4
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
5 <p:documentation>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
6 <div>Run this e.g. as follows:
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
7 xprocs --input source=../english/FP_ii.html merge.xpl lfs=../latin/sth1002.html\;../latin/sth1003.html\;../latin/sth1015.html rawpart=FP.ii</div>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
8 </p:documentation>
66
ht
parents: 54
diff changeset
9 <p:option name="lfs" required="true">
ht
parents: 54
diff changeset
10 <p:documentation>
75
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
11 <div>list of latin files, use ; as separator</div>
66
ht
parents: 54
diff changeset
12 </p:documentation>
ht
parents: 54
diff changeset
13 </p:option>
72
3dd981256764 fix summa links
ht
parents: 68
diff changeset
14 <p:variable name="rawpart" select="/x:div/@id"/>
3dd981256764 fix summa links
ht
parents: 68
diff changeset
15 <p:delete match="x:a[@href and not(text())]"/>
68
ht
parents: 66
diff changeset
16 <p:viewport match="x:div[@class='div3']" name="vp">
54
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
17 <p:xslt>
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
18 <p:input port="stylesheet">
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
19 <p:document href="fixup_e.xsl"/>
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
20 </p:input>
75
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
21 </p:xslt>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
22 <p:viewport match="x:div[@class='div4' and not(@id)]">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
23 <p:documentation>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
24 <div>Treat tail of prooemium as index</div>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
25 </p:documentation>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
26 <p:xslt>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
27 <p:input port="stylesheet">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
28 <p:inline>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
29 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:x="http://www.w3.org/1999/xhtml" exclude-result-prefixes="x xsl">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
30 <xsl:variable name="prefix" select="concat('#',substring-before(/x:div/x:p[1]/@id,'-'),'_A')"/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
31 <xsl:template match="x:p[starts-with(.,' (')]">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
32 <xsl:copy>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
33 <xsl:apply-templates select="@*"/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
34 <a href="{concat($prefix,substring-after(substring-before(.,')'),'('))}">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
35 <xsl:apply-templates select="node()"/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
36 </a>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
37 </xsl:copy>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
38 </xsl:template>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
39
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
40 <xsl:template match="@*|node()">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
41 <xsl:copy>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
42 <xsl:apply-templates select="@*|node()"/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
43 </xsl:copy>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
44 </xsl:template>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
45 </xsl:stylesheet>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
46 </p:inline>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
47 </p:input>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
48 </p:xslt>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
49 </p:viewport>
54
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
50 <p:xslt>
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
51 <p:input port="stylesheet">
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
52 <p:document href="merge.xsl"/>
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
53 </p:input>
66
ht
parents: 54
diff changeset
54 <p:with-param name="lfs" select="$lfs"/>
54
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
55 </p:xslt>
68
ht
parents: 66
diff changeset
56 <p:xslt>
ht
parents: 66
diff changeset
57 <p:input port="stylesheet">
ht
parents: 66
diff changeset
58 <p:document href="bi.xsl"/>
ht
parents: 66
diff changeset
59 </p:input>
72
3dd981256764 fix summa links
ht
parents: 68
diff changeset
60 <p:with-param name="rawpart" select="$rawpart"/>
68
ht
parents: 66
diff changeset
61 </p:xslt>
54
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
62 </p:viewport>
75
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
63 <p:insert match="x:body" position="first-child" name="wrap">
68
ht
parents: 66
diff changeset
64 <p:input port="source">
ht
parents: 66
diff changeset
65 <p:inline>
75
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
66 <html>
68
ht
parents: 66
diff changeset
67 <head>
ht
parents: 66
diff changeset
68 <title>Bilingual Aquinas</title>
ht
parents: 66
diff changeset
69 <style>
ht
parents: 66
diff changeset
70 h2, h3, h4 {margin-bottom: 0px; clear: both}
ht
parents: 66
diff changeset
71 .bilingual {clear: both; margin-top: .5em}
ht
parents: 66
diff changeset
72 div.eng {width: 45%; float: left}
ht
parents: 66
diff changeset
73 div.lat {width: 45%; float: right}
ht
parents: 66
diff changeset
74 @page { size: A4 portrait; margin: 1cm}
ht
parents: 66
diff changeset
75 </style>
ht
parents: 66
diff changeset
76 </head>
ht
parents: 66
diff changeset
77 <body style="font-family: Bitstream Vera Serif">
ht
parents: 66
diff changeset
78 </body>
ht
parents: 66
diff changeset
79 </html></p:inline>
ht
parents: 66
diff changeset
80 </p:input>
ht
parents: 66
diff changeset
81 <p:input port="insertion">
ht
parents: 66
diff changeset
82 <p:pipe port="result" step="vp"/>
ht
parents: 66
diff changeset
83 </p:input>
ht
parents: 66
diff changeset
84 </p:insert>
75
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
85 <p:wrap-sequence wrapper="x:div">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
86 <p:input port="source" select="/*/*/x:h3">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
87 <p:pipe port="result" step="vp"/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
88 </p:input>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
89 </p:wrap-sequence>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
90 <p:xslt name="toc">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
91 <p:input port="stylesheet">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
92 <p:inline>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
93 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:x="http://www.w3.org/1999/xhtml" exclude-result-prefixes="x xsl">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
94 <xsl:template match="/x:div">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
95 <div class="toc">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
96 <xsl:for-each select="x:h3">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
97 <a href="#{substring-before(@id,'-')}">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
98 <xsl:apply-templates/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
99 </a><br/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
100 </xsl:for-each>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
101 </div>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
102 </xsl:template>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
103 </xsl:stylesheet>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
104 </p:inline>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
105 </p:input>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
106 </p:xslt>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
107 <p:insert match="x:h2" position="after">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
108 <p:input port="source">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
109 <p:pipe step="wrap" port="result"/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
110 </p:input>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
111 <p:input port="insertion">
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
112 <p:pipe step="toc" port="result"/>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
113 </p:input>
fad07ffd0386 add indices of questions and articles
ht
parents: 72
diff changeset
114 </p:insert>
54
77921d86a058 towards new format, pipeline
ht
parents:
diff changeset
115 </p:pipeline>