]> Lady’s Gitweb - Shushe/blob - parsers/tsv.xslt
Automatically encapsulate metadata and preserve it
[Shushe] / parsers / tsv.xslt
1 <?xml version="1.0"?>
2 <!--
3 ⁌ ⛩️📰 书社 ∷ parsers/tsv.xslt
4
5 © 2023–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 <transform
11 xmlns="http://www.w3.org/1999/XSL/Transform"
12 xmlns:exsl="http://exslt.org/common"
13 xmlns:exslstr="http://exslt.org/strings"
14 xmlns:html="http://www.w3.org/1999/xhtml"
15 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
16 exclude-result-prefixes="exsl exslstr"
17 version="1.0"
18 >
19 <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:tsv.xslt</书社:id>
20 <template match="html:script[@type='text/tab-separated-values']">
21 <variable name="rows" select="exslstr:tokenize(., '&#xA;')[normalize-space(.) and not(starts-with(., '#'))]"/>
22 <variable name="head" select="$rows[1]"/>
23 <variable name="body" select="$rows[not(position()=1)]"/>
24 <html:table class="tsv">
25 <html:thead>
26 <html:tr>
27 <for-each select="exslstr:tokenize($head, '&#x9;')">
28 <html:th scope="col">
29 <value-of select="."/>
30 </html:th>
31 </for-each>
32 </html:tr>
33 </html:thead>
34 <html:tbody>
35 <for-each select="$body">
36 <html:tr>
37 <for-each select="exslstr:tokenize(., '&#x9;')">
38 <html:td>
39 <value-of select="."/>
40 </html:td>
41 </for-each>
42 </html:tr>
43 </for-each>
44 </html:tbody>
45 </html:table>
46 </template>
47 </transform>
This page took 0.053314 seconds and 5 git commands to generate.