]> Lady’s Gitweb - Shushe/blob - parsers/tsv.xslt
4de3b9853401f6b838ac84afb2bdf2fe121ac0c5
[Shushe] / parsers / tsv.xslt
1 <?xml version="1.0"?>
2 <!--
3 ⁌ ⛩️📰 书社 ∷ parsers/tsv.xslt
4
5 © 2023 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 exclude-result-prefixes="exsl exslstr"
16 version="1.0"
17 >
18 <template match="html:script[@type='text/tab-separated-values']">
19 <variable name="rows" select="exslstr:tokenize(., '&#xA;')[normalize-space(.) and not(starts-with(., '#'))]"/>
20 <variable name="head" select="exsl:node-set($rows)[1]"/>
21 <variable name="body" select="exsl:node-set($rows)[not(position()=1)]"/>
22 <html:table>
23 <html:thead>
24 <html:tr>
25 <for-each select="exslstr:tokenize($head, '&#x9;')">
26 <html:th scope="row">
27 <value-of select="."/>
28 </html:th>
29 </for-each>
30 </html:tr>
31 </html:thead>
32 <html:tbody>
33 <for-each select="exsl:node-set($body)">
34 <html:tr>
35 <for-each select="exslstr:tokenize(., '&#x9;')">
36 <html:td>
37 <value-of select="."/>
38 </html:td>
39 </for-each>
40 </html:tr>
41 </for-each>
42 </html:tbody>
43 </html:table>
44 </template>
45 </transform>
This page took 0.040214 seconds and 3 git commands to generate.