3 ⁌ ⛩️📰 书社 ∷ parsers/tsv.xslt
5 © 2023 Lady [@ Lady’s Computer]
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/>.
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"
18 <template match="html:script[@type='text/tab-separated-values']">
19 <variable name="rows" select="exslstr:tokenize(., '
')[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)]"/>
25 <for-each select="exslstr:tokenize($head, '	')">
27 <value-of select="."/>
33 <for-each select="exsl:node-set($body)">
35 <for-each select="exslstr:tokenize(., '	')">
37 <value-of select="."/>