Lady’s Gitweb
/
Shushe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do asset transforms during application
[Shushe]
/
parsers
/
tsv.xslt
diff --git
a/parsers/tsv.xslt
b/parsers/tsv.xslt
index ad7052e2fad764a55d610721ddc4401be6dd0b37..21ad1e0b6bdccaaa52ddd2859c1fd4b1aa6d593c 100644
(file)
--- a/
parsers/tsv.xslt
+++ b/
parsers/tsv.xslt
@@
-1,8
+1,12
@@
<?xml version="1.0"?>
<!--
<?xml version="1.0"?>
<!--
-⁌ ⛩️📰 书社 ∷ parsers/tsv.xslt
+SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
+SPDX-License-Identifier: MPL-2.0
+-->
+<!--
+⁌ ⛩📰 书社 ∷ parsers/tsv.xslt
-© 2023–2024 Lady [@ Lady
’s Computer]
+© 2023–2024 Lady [@ Lady
s Computer].
This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
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/>.
This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
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/>.
@@
-13,18
+17,25
@@
If a copy of the M·P·L was not distributed with this file, You can obtain one
xmlns:exslstr="http://exslt.org/strings"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
xmlns:exslstr="http://exslt.org/strings"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
- ex
clude-resul
t-prefixes="exsl exslstr"
+ ex
tension-elemen
t-prefixes="exsl exslstr"
version="1.0"
>
version="1.0"
>
+ <import href="../lib/split.xslt"/>
<书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:tsv.xslt</书社:id>
<template match="html:script[@type='text/tab-separated-values']">
<书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:tsv.xslt</书社:id>
<template match="html:script[@type='text/tab-separated-values']">
- <variable name="rows" select="exslstr:tokenize(., '
')[normalize-space(.) and not(starts-with(., '#'))]"/>
+ <variable name="rows" select="exslstr:tokenize(., '
')[normalize-space(.)
!=''
and not(starts-with(., '#'))]"/>
<variable name="head" select="$rows[1]"/>
<variable name="head" select="$rows[1]"/>
+ <variable name="headcols">
+ <call-template name="书社:split">
+ <with-param name="source" select="string($head)"/>
+ <with-param name="separator" select="'	'"/>
+ </call-template>
+ </variable>
<variable name="body" select="$rows[not(position()=1)]"/>
<variable name="body" select="$rows[not(position()=1)]"/>
- <html:table
class="tsv"
>
+ <html:table>
<html:thead>
<html:tr>
<html:thead>
<html:tr>
- <for-each select="exsl
str:tokenize($head, '	')
">
+ <for-each select="exsl
:node-set($headcols)/*
">
<html:th scope="col">
<value-of select="."/>
</html:th>
<html:th scope="col">
<value-of select="."/>
</html:th>
@@
-33,12
+44,30
@@
If a copy of the M·P·L was not distributed with this file, You can obtain one
</html:thead>
<html:tbody>
<for-each select="$body">
</html:thead>
<html:tbody>
<for-each select="$body">
+ <variable name="cols">
+ <call-template name="书社:split">
+ <with-param name="source" select="string(.)"/>
+ <with-param name="separator" select="'	'"/>
+ </call-template>
+ </variable>
<html:tr>
<html:tr>
- <for-each select="exsl
str:tokenize(., '	')
">
+ <for-each select="exsl
:node-set($cols)/*[count(exsl:node-set($headcols)/*)>=position()]
">
<html:td>
<html:td>
+ <attribute name="data-tsv-header">
+ <value-of select="exsl:node-set($headcols)/*[count(current()/preceding-sibling::*)+1]"/>
+ </attribute>
<value-of select="."/>
<value-of select="."/>
+ <if test="position()=count(exsl:node-set($headcols)/*)">
+ <for-each select="following-sibling::*">
+ <text>	</text>
+ <value-of select="."/>
+ </for-each>
+ </if>
</html:td>
</for-each>
</html:td>
</for-each>
+ <for-each select="exsl:node-set($headcols)/*[position()>count(exsl:node-set($cols)/*)]">
+ <html:td/>
+ </for-each>
</html:tr>
</for-each>
</html:tbody>
</html:tr>
</for-each>
</html:tbody>
This page took
0.027221 seconds
and
4
git commands to generate.