]> Lady’s Gitweb - Caudex/blob - transforms/entry.xslt
Initial commit; minimal working implementation
[Caudex] / transforms / entry.xslt
1 <?xml version="1.0"?>
2 <!--
3 ⁌ 🪾📰 Caudex ∷ transforms/entry.xslt
4
5 © 2024 Lady [@ Lady’s Computer]
6
7 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
8 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
9 -->
10 <!DOCTYPE transform [
11 <!ENTITY Caudex "urn:fdc:ladys.computer:20240204:Caudex:">
12 <!ENTITY 书社 "urn:fdc:ladys.computer:20231231:Shu1She4:">
13 ]>
14 <transform
15 xmlns="http://www.w3.org/1999/XSL/Transform"
16 xmlns:Caudex="urn:fdc:ladys.computer:20240204:Caudex"
17 xmlns:exsl="http://exslt.org/common"
18 xmlns:html="http://www.w3.org/1999/xhtml"
19 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
20 exclude-result-prefixes="exsl Caudex"
21 version="1.0"
22 >
23 <import href="../lib/split.xslt"/>
24 <书社:id>&Caudex;entry.xslt</书社:id>
25 <template match="/html:div[@书社:parsed-by='&Caudex;catalog.xslt'][@class='entry']">
26 <html:body>
27 <for-each select="@*[namespace-uri()!='urn:fdc:ladys.computer:20231231:Shu1She4']">
28 <copy/>
29 </for-each>
30 <for-each select="html:div[@id='@']/html:div[@书社:parsed-by='&Caudex;codex-entry.xslt']">
31 <variable name="metadata" select="html:div[@书社:parsed-by='&书社;record-jar.xslt']/html:dl[1]"/>
32 <html:meta itemprop="&书社;title">
33 <attribute name="content">
34 <value-of select="$metadata//html:dt[string()='TITLE']/following-sibling::html:dd"/>
35 <if test="$metadata//html:dt[string()='TITLE'] and $metadata//html:dt[string()='ENTRY']">
36 <text> </text>
37 </if>
38 <if test="$metadata//html:dt[string()='ENTRY']">
39 <text>(</text>
40 <value-of select="$metadata//html:dt[string()='ENTRY']/following-sibling::html:dd"/>
41 <text>)</text>
42 </if>
43 </attribute>
44 </html:meta>
45 <html:article>
46 <if test="$metadata//html:dt[string()='TITLE']">
47 <html:h1>
48 <value-of select="$metadata//html:dt[string()='TITLE']/following-sibling::html:dd"/>
49 </html:h1>
50 </if>
51 <variable name="paragraphs">
52 <call-template name="Caudex:split">
53 <with-param name="source" select="string(html:pre[@书社:parsed-by='&书社;plain.xslt'])"/>
54 <with-param name="separator" select="'&#xA;&#xA;'"/>
55 </call-template>
56 </variable>
57 <for-each select="exsl:node-set($paragraphs)/*">
58 <variable name="lines">
59 <call-template name="Caudex:split">
60 <with-param name="source" select="string()"/>
61 </call-template>
62 </variable>
63 <variable name="linespans" select="exsl:node-set($lines)/*"/>
64 <variable name="partype">
65 <choose>
66 <when test="not($linespans[not(starts-with(., ' ') or starts-with(., '&#x9;'))])">
67 <text>blockquote</text>
68 </when>
69 <otherwise>
70 <text>p</text>
71 </otherwise>
72 </choose>
73 </variable>
74 <if test="$linespans[normalize-space()!='']">
75 <element name="html:{$partype}">
76 <for-each select="$linespans">
77 <if test="normalize-space()!=''">
78 <value-of select="normalize-space()"/>
79 <if test="following-sibling::*[normalize-space()!='']">
80 <text> </text>
81 </if>
82 </if>
83 </for-each>
84 </element>
85 </if>
86 </for-each>
87 </html:article>
88 </for-each>
89 </html:body>
90 </template>
91 </transform>
This page took 0.04994 seconds and 5 git commands to generate.