Mercurial > hg > Aquinas
diff 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 |
line wrap: on
line diff
--- a/summa/bilingual/merge.xpl Sun Jan 03 23:50:09 2010 +0000 +++ b/summa/bilingual/merge.xpl Tue Jan 05 16:18:40 2010 +0000 @@ -1,9 +1,14 @@ <?xml version='1.0'?> <!DOCTYPE p:pipeline SYSTEM "../../../../WWW/XML/XProc/docs/schemas/xproc.dtd" > -<p:pipeline xmlns:p="http://www.w3.org/ns/xproc" xmlns:x="http://www.w3.org/1999/xhtml"> +<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"> + + <p:documentation> + <div>Run this e.g. as follows: + xprocs --input source=../english/FP_ii.html merge.xpl lfs=../latin/sth1002.html\;../latin/sth1003.html\;../latin/sth1015.html rawpart=FP.ii</div> + </p:documentation> <p:option name="lfs" required="true"> <p:documentation> - <div xmlns="http://www.w3.org/1999/xhtml">list of latin files, use ; as separator</div> + <div>list of latin files, use ; as separator</div> </p:documentation> </p:option> <p:variable name="rawpart" select="/x:div/@id"/> @@ -13,7 +18,35 @@ <p:input port="stylesheet"> <p:document href="fixup_e.xsl"/> </p:input> - </p:xslt> + </p:xslt> + <p:viewport match="x:div[@class='div4' and not(@id)]"> + <p:documentation> + <div>Treat tail of prooemium as index</div> + </p:documentation> + <p:xslt> + <p:input port="stylesheet"> + <p:inline> + <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"> + <xsl:variable name="prefix" select="concat('#',substring-before(/x:div/x:p[1]/@id,'-'),'_A')"/> + <xsl:template match="x:p[starts-with(.,' (')]"> + <xsl:copy> + <xsl:apply-templates select="@*"/> + <a href="{concat($prefix,substring-after(substring-before(.,')'),'('))}"> + <xsl:apply-templates select="node()"/> + </a> + </xsl:copy> + </xsl:template> + + <xsl:template match="@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> + </p:inline> + </p:input> + </p:xslt> + </p:viewport> <p:xslt> <p:input port="stylesheet"> <p:document href="merge.xsl"/> @@ -27,10 +60,10 @@ <p:with-param name="rawpart" select="$rawpart"/> </p:xslt> </p:viewport> - <p:insert match="x:body" position="first-child"> + <p:insert match="x:body" position="first-child" name="wrap"> <p:input port="source"> <p:inline> - <html xmlns="http://www.w3.org/1999/xhtml"> + <html> <head> <title>Bilingual Aquinas</title> <style> @@ -49,4 +82,34 @@ <p:pipe port="result" step="vp"/> </p:input> </p:insert> + <p:wrap-sequence wrapper="x:div"> + <p:input port="source" select="/*/*/x:h3"> + <p:pipe port="result" step="vp"/> + </p:input> + </p:wrap-sequence> + <p:xslt name="toc"> + <p:input port="stylesheet"> + <p:inline> + <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"> + <xsl:template match="/x:div"> + <div class="toc"> + <xsl:for-each select="x:h3"> + <a href="#{substring-before(@id,'-')}"> + <xsl:apply-templates/> + </a><br/> + </xsl:for-each> + </div> + </xsl:template> + </xsl:stylesheet> + </p:inline> + </p:input> + </p:xslt> + <p:insert match="x:h2" position="after"> + <p:input port="source"> + <p:pipe step="wrap" port="result"/> + </p:input> + <p:input port="insertion"> + <p:pipe step="toc" port="result"/> + </p:input> + </p:insert> </p:pipeline>
