├── LICENSE ├── README.md ├── align-sequences ├── example │ ├── aligned.html │ ├── aligned.xml │ └── example.xsl └── xsl │ └── align-by-common-key.xsl ├── cals2htmltable ├── xmlcatalog │ └── catalog.xml └── xsl │ └── cals2htmltables.xsl ├── calstable ├── sch │ └── sch_tables.sch.xml ├── test │ ├── broken.xml │ ├── table-normalized.xml │ ├── table.xml │ ├── xml │ │ ├── empty-col.xml │ │ ├── tables-with-spans.xml │ │ └── text-col.xml │ └── xspec │ │ ├── empty-cols.xspec │ │ └── functions.xspec ├── xmlcatalog │ └── catalog.xml ├── xpl │ ├── normalize.xpl │ └── resolve-nested-tables.xpl └── xsl │ ├── call-normalize.xsl │ ├── empty-cols.xsl │ ├── example.xsl │ ├── functions.xsl │ ├── html2calstable.xsl │ ├── normalize-colnames.xsl │ ├── normalize.xsl │ └── resolve-nested-tables.xsl ├── colors ├── xmlcatalog │ └── catalog.xml └── xsl │ ├── colors.mappings.xsl │ ├── colors.xsl │ └── contrast.xsl ├── date ├── xmlcatalog │ └── catalog.xml └── xsl │ └── date.xsl ├── extract-xpath ├── xmlcatalog │ └── catalog.xml └── xsl │ └── extract-xpath.xsl ├── flat-list-to-tree ├── xmlcatalog │ └── catalog.xml └── xsl │ ├── flat-list-to-tree.xsl │ └── test.xsl ├── format-indent ├── README.md ├── xpl │ └── undo-format-indent.xpl └── xsl │ ├── format-indent-common.xsl │ ├── format-indent.xsl │ ├── test.rng │ ├── test.xml │ ├── test.xsd │ └── undo-format-indent.xsl ├── functx ├── Sequences │ ├── Positional │ │ └── index-of-node.xsl │ └── Sorting-and-Grouping │ │ └── sort.xsl ├── Strings │ └── Replacing │ │ └── escape-for-regex.xsl ├── XML_Elements_and_Attributes │ └── XML_Document_Structure │ │ └── path-to-node-with-pos.xsl ├── xmlcatalog │ └── catalog.xml └── xsl │ └── functx.xsl ├── geo ├── xmlcatalog │ └── catalog.xml └── xsl │ └── geo.xsl ├── hex ├── xmlcatalog │ └── catalog.xml └── xsl │ └── hex.xsl ├── isbn ├── sch │ ├── check-isbn.sch.xml │ └── check-isbn_diagnostics.sch.xml ├── xmlcatalog │ └── catalog.xml └── xsl │ ├── RangeMessage.xml │ ├── isbncheck.xsl │ ├── isbnconvert.xsl │ └── isbnformat.xsl ├── iso-lang ├── xmlcatalog │ └── catalog.xml └── xsl │ └── iso-lang.xsl ├── java ├── README ├── bin │ └── transpect-utils.jar ├── build.sh └── src │ └── com │ └── transpect │ └── xslt │ └── utils.java ├── lengths ├── xmlcatalog │ └── catalog.xml └── xsl │ └── lengths.xsl ├── mime-type ├── xmlcatalog │ └── catalog.xml └── xsl │ └── mime-type.xsl ├── num ├── xmlcatalog │ └── catalog.xml └── xsl │ ├── num-3.0.xsl │ └── num.xsl ├── orcid └── xsl │ └── orcid.xsl ├── paths ├── xmlcatalog │ └── catalog.xml └── xsl │ └── paths.xsl ├── render-xml-source ├── css │ └── xmlsrc.css └── xsl │ └── render-xml-source-as-html.xsl ├── resolve-uri ├── xmlcatalog │ └── catalog.xml ├── xpl │ └── test.xpl └── xsl │ └── resolve-uri.xsl ├── roman-numerals ├── xmlcatalog │ └── catalog.xml └── xsl │ └── roman2int.xsl ├── sequence-type └── xsl │ ├── README.md │ ├── sequence-type.xsl │ └── test.xsl ├── split-sequence ├── xmlcatalog │ └── catalog.xml └── xsl │ └── split-sequence-by-string-length.xsl ├── strings ├── xmlcatalog │ └── catalog.xml └── xsl │ ├── diffs.xsl │ ├── regex-functions.xsl │ └── unicode-representation.xsl ├── styledoc └── xsl │ └── styledoc.xsl ├── uri-to-relative-path ├── xmlcatalog │ └── catalog.xml └── xsl │ └── uri-to-relative-path.xsl ├── uri └── xsl │ └── uri.xsl ├── xmlcatalog ├── catalog.xml └── transpect.io.catalog.xml └── xslt-based-catalog-resolver ├── README.md ├── xmlcatalog └── catalog.xml └── xsl ├── interactive.html ├── interactive.xsl └── resolve-uri-by-catalog.xsl /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015–2024, transpect.io 2 | 3 | All rights reserved. 4 | 5 | This license pertains to the xslt-util code in this repository with 6 | exception of the functx directory. The latter code is taken from 7 | http://www.xsltfunctions.com/ that is Copyright (c) 2006-2014 Datypic. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | * Redistributions of source code must retain the above copyright notice, this 13 | list of conditions and the following disclaimer. 14 | 15 | * Redistributions in binary form must reproduce the above copyright notice, 16 | this list of conditions and the following disclaimer in the documentation 17 | and/or other materials provided with the distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # xslt-util 2 | 3 | XSLT functions for transpect. Navigate to the directories to get additional information. -------------------------------------------------------------------------------- /align-sequences/example/aligned.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Alignment test 8 | 9 | 10 | 11 | 15 | 16 | 17 | 21 | 22 | 23 | 27 | 28 | 29 | 33 | 34 | 35 | 39 | 40 | 41 | 45 | 46 |
12 |

Wq

13 |

1

14 |
18 |

Ax

19 |

1

20 |
24 |

F5

25 |

1

26 |
30 |

Bb

31 |

1

32 |
36 |

;p

37 |

1

38 |
42 |

Yi

43 |

1

44 |
47 | 48 | 49 | 50 | 54 | 55 | 56 | 57 | 61 | 62 | 63 | 64 | 68 | 69 | 70 | 71 | 75 | 76 | 77 | 78 | 82 | 83 | 84 | 85 | 89 | 90 | 91 | 92 | 96 | 97 | 98 | 99 | 103 | 104 |
51 |

Ax

52 |

2

53 |
58 |

7f

59 |

2

60 |
65 |

F5

66 |

2

67 |
72 |

Bb

73 |

2

74 |
79 |

Tg

80 |

2

81 |
86 |

jj

87 |

2

88 |
93 |

;p

94 |

2

95 |
100 |

Dr

101 |

2

102 |
105 | 106 | 107 | 108 | 109 | 113 | 114 | 115 | 116 | 117 | 121 | 122 | 123 | 124 | 125 | 129 | 130 | 131 | 132 | 133 | 137 | 138 | 139 | 140 | 141 | 145 | 146 | 147 | 148 | 149 | 153 | 154 | 155 | 156 | 157 | 161 | 162 | 163 | 164 | 165 | 169 | 170 |
110 |

Wq

111 |

3

112 |
118 |

7f

119 |

3

120 |
126 |

Bb

127 |

3

128 |
134 |

jj

135 |

3

136 |
142 |

oP

143 |

3

144 |
150 |

Ck

151 |

3

152 |
158 |

;p

159 |

3

160 |
166 |

Dr

167 |

3

168 |
171 | 172 | 173 | 177 | 178 | 182 | 183 | 184 | 188 | 192 | 193 | 194 | 195 | 196 | 200 | 204 | 205 | 206 | 210 | 214 | 215 | 216 | 217 | 221 | 225 | 229 | 230 | 231 | 232 | 236 | 237 | 238 | 239 | 240 | 244 | 248 | 249 | 250 | 251 | 252 | 256 | 257 | 258 | 259 | 260 | 264 | 265 | 266 | 270 | 274 | 278 | 279 | 280 | 284 | 285 | 286 | 287 | 288 | 289 | 293 | 297 | 298 |
174 |

Wq

175 |

1

176 |
179 |

Wq

180 |

3

181 |
185 |

Ax

186 |

1

187 |
189 |

Ax

190 |

2

191 |
197 |

7f

198 |

2

199 |
201 |

7f

202 |

3

203 |
207 |

F5

208 |

1

209 |
211 |

F5

212 |

2

213 |
218 |

Bb

219 |

1

220 |
222 |

Bb

223 |

2

224 |
226 |

Bb

227 |

3

228 |
233 |

Tg

234 |

2

235 |
241 |

jj

242 |

2

243 |
245 |

jj

246 |

3

247 |
253 |

oP

254 |

3

255 |
261 |

Ck

262 |

3

263 |
267 |

;p

268 |

1

269 |
271 |

;p

272 |

2

273 |
275 |

;p

276 |

3

277 |
281 |

Yi

282 |

1

283 |
290 |

Dr

291 |

2

292 |
294 |

Dr

295 |

3

296 |
299 | 300 | -------------------------------------------------------------------------------- /align-sequences/example/aligned.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Wq 7 | 1 8 | 9 | 10 | 11 | 12 | Wq 13 | 3 14 | 15 | 16 | 17 | 18 | 19 | 20 | Ax 21 | 1 22 | 23 | 24 | 25 | 26 | Ax 27 | 2 28 | 29 | 30 | 31 | 32 | 33 | 34 | 7f 35 | 2 36 | 37 | 38 | 39 | 40 | 7f 41 | 3 42 | 43 | 44 | 45 | 46 | 47 | 48 | F5 49 | 1 50 | 51 | 52 | 53 | 54 | F5 55 | 2 56 | 57 | 58 | 59 | 60 | 61 | 62 | Bb 63 | 1 64 | 65 | 66 | 67 | 68 | Bb 69 | 2 70 | 71 | 72 | 73 | 74 | Bb 75 | 3 76 | 77 | 78 | 79 | 80 | 81 | Tg 82 | 2 83 | 84 | 85 | 86 | 87 | 88 | jj 89 | 2 90 | 91 | 92 | 93 | 94 | jj 95 | 3 96 | 97 | 98 | 99 | 100 | 101 | oP 102 | 3 103 | 104 | 105 | 106 | 107 | Ck 108 | 3 109 | 110 | 111 | 112 | 113 | 114 | ;p 115 | 1 116 | 117 | 118 | 119 | 120 | ;p 121 | 2 122 | 123 | 124 | 125 | 126 | ;p 127 | 3 128 | 129 | 130 | 131 | 132 | 133 | Yi 134 | 1 135 | 136 | 137 | 138 | 139 | 140 | Dr 141 | 2 142 | 143 | 144 | 145 | 146 | Dr 147 | 3 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /align-sequences/example/example.xsl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | Alignment test 25 | 30 | 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Wq 47 | 1 48 | 49 | 50 | Ax 51 | 1 52 | 53 | 54 | F5 55 | 1 56 | 57 | 58 | Bb 59 | 1 60 | 61 | 62 | ;p 63 | 1 64 | 65 | 66 | Yi 67 | 1 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Ax 76 | 2 77 | 78 | 79 | 7f 80 | 2 81 | 82 | 83 | F5 84 | 2 85 | 86 | 87 | Bb 88 | 2 89 | 90 | 91 | Tg 92 | 2 93 | 94 | 95 | jj 96 | 2 97 | 98 | 99 | ;p 100 | 2 101 | 102 | 103 | Dr 104 | 2 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Wq 113 | 3 114 | 115 | 116 | 7f 117 | 3 118 | 119 | 120 | Bb 121 | 3 122 | 123 | 124 | jj 125 | 3 126 | 127 | 128 | oP 129 | 3 130 | 131 | 132 | Ck 133 | 3 134 | 135 | 136 | ;p 137 | 3 138 | 139 | 140 | Dr 141 | 3 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 151 | 152 | 153 | 154 | 155 |
156 |
157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 |

193 | 194 |

195 |
196 | 197 | 198 |

199 | 200 |

201 |
202 | 203 |
-------------------------------------------------------------------------------- /align-sequences/xsl/align-by-common-key.xsl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Duplicates: 64 | 65 | 68 | 69 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 110 | 111 | 112 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 140 | 141 | -------------------------------------------------------------------------------- /cals2htmltable/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /cals2htmltable/xsl/cals2htmltables.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
89 | -------------------------------------------------------------------------------- /calstable/sch/sch_tables.sch.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | tables 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | In this table are rows that contain more (or less) entries than defined in Word. This table is defined with columns. But in rows number are entries used. Row starting with text: 21 | "". 22 | Please check whether column dividers are correctly placed in Word. 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /calstable/test/broken.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | true 10 | docx 11 | file:/var/autofs/data/develop/kraetke/word2tex/tmp/table.docx.tmp/ 12 | 13 | 14 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | A 31 | 32 | 33 | b 34 | 35 | 36 | 37 | 38 | c 39 | 40 | 41 | d 42 | 43 | 44 | 45 | 46 | E 47 | 48 | 49 | 50 | 51 | F 52 | 53 | 54 | G 55 | 56 | 57 | 58 | extra cell 59 | 60 | 61 | 62 | h 63 | 64 | 65 | 66 | 67 | 70 | 71 | 72 | J 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /calstable/test/table-normalized.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | true 11 | docx 12 | file:/var/autofs/data/develop/kraetke/word2tex/tmp/table.docx.tmp/ 13 | 14 | 15 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | A 41 | 42 | 43 | 44 | 45 | 46 | b 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | c 61 | 62 | 63 | 67 | 68 | d 71 | 72 | 73 | 74 | 75 | 76 | 77 | E 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | F 92 | 93 | 94 | 95 | 96 | G 99 | 100 | 101 | 102 | 103 | h 106 | 107 | 108 | 109 | 110 | 111 | 112 | I 113 | 114 | 115 | J 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /calstable/test/table.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | true 10 | docx 11 | file:/var/autofs/data/develop/kraetke/word2tex/tmp/table.docx.tmp/ 12 | 13 | 14 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | A 31 | 32 | 33 | b 34 | 35 | 36 | 37 | 38 | c 39 | 40 | 41 | d 42 | 43 | 44 | 45 | 46 | E 47 | 48 | 49 | 50 | 51 | F 52 | 53 | 54 | G 55 | 56 | 57 | h 58 | 59 | 60 | 61 | 62 | I 63 | 64 | 65 | J 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /calstable/test/xml/empty-col.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Text 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /calstable/test/xml/tables-with-spans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /calstable/test/xml/text-col.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Text 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /calstable/test/xspec/empty-cols.xspec: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /calstable/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /calstable/xpl/normalize.xpl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Rowspans and Colspans are dissolved and filled with empty cells. 17 | This facilitates the conversion of CALS tables to LaTeX tabular tables. The graphic 18 | below gives an example: 19 | 20 | ------------------- ------------------- 21 | | A | B | | A | B | b | 22 | - - - ------------------- 23 | | | | --> | a | b | b | 24 | ------------------- ------------------- 25 | | C | D | | C | D | d | 26 | ------------------- ------------------- 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /calstable/xpl/resolve-nested-tables.xpl: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /calstable/xsl/call-normalize.xsl: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /calstable/xsl/empty-cols.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /calstable/xsl/example.xsl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /calstable/xsl/functions.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /calstable/xsl/html2calstable.xsl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /calstable/xsl/normalize-colnames.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /colors/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /colors/xsl/contrast.xsl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /date/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /date/xsl/date.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 60 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 80 | 81 | 83 | 84 | err 85 | No known/valid date format in input string found! 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /extract-xpath/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /extract-xpath/xsl/extract-xpath.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 23 | 24 | 25 | 26 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /flat-list-to-tree/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /flat-list-to-tree/xsl/flat-list-to-tree.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 43 | 45 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /flat-list-to-tree/xsl/test.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | 16 | 17 |
  • 1
  • 18 |
  • 2
  • 19 |
  • 2.1
  • 20 |
  • 2.2
  • 21 |
  • 2.2.1
  • 22 |
  • 2.2.2
  • 23 |
  • 2.2.3
  • 24 |
  • 3
  • 25 |
  • 3.1
  • 26 |
  • 3.2
  • 27 |
    28 | 29 | 30 | 36 | 37 | 38 |
    -------------------------------------------------------------------------------- /format-indent/README.md: -------------------------------------------------------------------------------- 1 | # format & indent 2 | 3 | Requires Saxon 12.6+ because of an [`xsl:accumulator` issue](https://saxonica.plan.io/issues/6679). 4 | 5 | ## Invocation 6 | 7 | There are examples on [format-indent-demo](https://github.com/gimsieke/format-indent-demo/). 8 | 9 | ## Approach 10 | 11 | The XSD or RNG schemas will be analyzed for elements that may contain non-whitespace text, including mixed content, and for elements that are declared whitespace-preserving. 12 | 13 | The processing isn’t schema-aware in an XSLT sense. It is assumed that there is a single definition for an element (as is with DTDs), and this definition’s whitespace/text delcarations will be processed as follows: 14 | 15 | We don’t support DTDs because they are hard to parse (ixml anyone?). 16 | 17 | Multiple schema documents are supported mainly for XSD. 18 | 19 | ### Non-whitespace text permitted, including mixed content 20 | 21 | The function is called `tr:is-mixed` (to be renamed to `tr:permits-non-ws-text`). 22 | 23 | It checks the element definitions 24 | 25 | - of XSD schemas 26 | - `xs:complexType/@mixed = 'true'` 27 | - or `@type = 'xs:string'` 28 | - of RNG schemas 29 | - look for `mixed`, `text` or `data[@type = 'string']` in the include-expanded schema 30 | - then work your way up to the next element declaration, but stop if an attribute declaration comes first on the way up 31 | - when there is no element declaration, stop at the containing `define`, look for the `ref`s that refer to it and continue from these `ref`s to look upward for `element` declarations 32 | 33 | TODO: We need to take care of namespaces, in particular when dealing with RNG schemas. 34 | 35 | ### Space preservation 36 | 37 | - Explicit `xml:space="preserve"` in the content 38 | - The element declaration contains a default attribute `xml:space="preserve"` 39 | - XSD: tbd 40 | - RNG: `attribute[@name = 'xml:space'][@a:defaultValue = 'preserve']` (maybe a trang annotation?) 41 | -------------------------------------------------------------------------------- /format-indent/xpl/undo-format-indent.xpl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | Your XML document. 12 | 13 | 14 | 15 | Your XML document, without indentations. 16 | 17 | 18 | 19 | The schema document(s). Whitespace separated list of absolute paths. 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /format-indent/xsl/test.rng: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /format-indent/xsl/test.xml: -------------------------------------------------------------------------------- 1 | 2 | Dear Mr.Robert Smith. Your order of 1Baby Monitor shipped from our warehouse on 1999-05-21. 3 | -------------------------------------------------------------------------------- /format-indent/xsl/test.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /format-indent/xsl/undo-format-indent.xsl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /functx/Sequences/Positional/index-of-node.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /functx/Sequences/Sorting-and-Grouping/sort.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /functx/Strings/Replacing/escape-for-regex.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /functx/XML_Elements_and_Attributes/XML_Document_Structure/path-to-node-with-pos.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /functx/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /geo/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /hex/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /hex/xsl/hex.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /isbn/sch/check-isbn.sch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 13 | BC_orphans 14 | Wrong ISBN length used. ISBN: must have 10 or 13 digits. Current length: 15 | 16 | 17 | 24 | BC_orphans 25 | The ISBN check digit doesn't match. ISBN: , calculated digit: , 26 | used digit: 27 | 28 | 29 | 34 | BC_orphans 35 | Wrong ISBN country identifier. ISBN: . Country: 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /isbn/sch/check-isbn_diagnostics.sch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ISBN ist nicht korrekt, die Prüfsumme stimmt nicht überein. ISBN: , korrekte Prüfziffer: , 5 | verwendete Prüfziffer: 6 | 7 | 8 | Falsche Angabe der ISBN. Die ISBN muss 10 oder 13 Ziffern besitzen. Verwendete Länge: 9 | 10 | 11 | 12 | Falsche ISBN Ländernummer. ISBN: . Ländernummer: 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /isbn/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /isbn/xsl/isbncheck.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 43 | 44 | 45 | 46 | 47 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /isbn/xsl/isbnconvert.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /isbn/xsl/isbnformat.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /iso-lang/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /java/README: -------------------------------------------------------------------------------- 1 | 2 | A collection of (system) helper functions XSLT can´t do. 3 | 4 | Add the jar file to your CLASSPATH variable. 5 | When using saxon you need the PE edition to use this extension library. 6 | 7 | Namespace declaration: 8 | xmlns:tr-java="java:com.transpect.xslt.utils" 9 | 10 | Example usage: 11 | 14 | 15 | To rebuild the jar file, run: 16 | ./build.sh -------------------------------------------------------------------------------- /java/bin/transpect-utils.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/transpect/xslt-util/4170c0faf53cfa53abcd61a942c4f05dc74861a5/java/bin/transpect-utils.jar -------------------------------------------------------------------------------- /java/build.sh: -------------------------------------------------------------------------------- 1 | rm -rf bin/* 2 | javac -d bin src/com/letex/xslt/utils.java 3 | jar cvfe bin/letex-utils.jar com.letex.xslt.utils -C bin . -------------------------------------------------------------------------------- /java/src/com/transpect/xslt/utils.java: -------------------------------------------------------------------------------- 1 | package com.transpect.xslt; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.io.IOException; 6 | import java.math.BigInteger; 7 | import java.security.MessageDigest; 8 | 9 | public class utils { 10 | 11 | // method main: for testing without saxon 12 | /*public static void main(String[] args) { 13 | try{ 14 | String rval = getCommandlineInputFromUser("Bitte Zeichen für MD5-Berechnung eingeben:"); 15 | System.out.println(stringToMD5(rval)); 16 | } catch (Exception e) { 17 | e.printStackTrace(); 18 | } 19 | }*/ 20 | 21 | // method getCommandlineInputFromUser 22 | public static String getCommandlineInputFromUser(String prompt) throws IOException { 23 | System.out.println(prompt); 24 | BufferedReader userInput = new BufferedReader (new InputStreamReader(System.in)); 25 | return userInput.readLine().toString(); 26 | } 27 | 28 | // make method getFileInputFromUser public when implementation is finished 29 | private static String getFileInputFromUser(String request, String dirpath, Integer maxWaitSecs) throws IOException { 30 | 31 | //FileInputStream fis = new FileInputStream(dirpath + "[timestamp]_wait" + maxWaitSecs + "sec.answer"); 32 | //Thread.sleep(10000); 33 | return request; 34 | } 35 | 36 | // method stringToMD5: get 32 chars long md5hash from utf8 string 37 | public static String stringToMD5(String chars) throws Exception { 38 | MessageDigest md5 = MessageDigest.getInstance("MD5"); 39 | md5.update(chars.getBytes("UTF-8"), 0, chars.length()); 40 | BigInteger md5int = new BigInteger(1, md5.digest()); 41 | return String.format("%1$032x", md5int); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /lengths/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /lengths/xsl/lengths.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Value '' is not supported in function 34 | tr:length-to-unitless-twip. Allowed values are in, mm, pt, % and auto. 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 102 | 103 | 104 | 105 | 107 | 109 | 110 | 120 | 121 | 122 | 123 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 142 | 143 | 144 | 145 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 158 | 159 | 160 | 161 | 162 | 163 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /mime-type/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /mime-type/xsl/mime-type.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /num/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /num/xsl/num-3.0.xsl: -------------------------------------------------------------------------------- 1 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /orcid/xsl/orcid.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /paths/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /paths/xsl/paths.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /render-xml-source/css/xmlsrc.css: -------------------------------------------------------------------------------- 1 | div.xmlsrc { 2 | width: 100%; 3 | height: auto; 4 | overflow: scroll; 5 | white-space: pre; 6 | /* margin-top: 2em; */ 7 | border: 3px solid #eee; 8 | font-family: Consolas, monospace; 9 | font-weight: normal; 10 | font-size: 90%; 11 | scrollbar-width: auto; 12 | padding-bottom: 0.5em; 13 | } 14 | div.textlist { 15 | max-height:300px; 16 | overflow:scroll; 17 | } 18 | 19 | div.xmlsrc .name.elt { color: #55e; } 20 | div.xmlsrc .name.att { color: #e95; } 21 | div.xmlsrc .namespace.att { color: #9af; } 22 | div.xmlsrc .val.att { color: #a66; } 23 | div.xmlsrc .comment { color: #474; } 24 | div.xmlsrc .pi { color: #a6a; } 25 | div.xmlsrc .unselectable { color: #aaa !important; } 26 | 27 | .xmlsrc-container { 28 | width: 95%; 29 | position: absolute; bottom:0; 30 | position: sticky; 31 | bottom: 3vh; 32 | flex-shrink:0; 33 | margin-left: 1rem; 34 | height: 10em; 35 | } 36 | .xmlsrc-container iframe { 37 | width:100%; 38 | height:100%; 39 | } 40 | 41 | body.xmlsrc { 42 | margin:0; 43 | } -------------------------------------------------------------------------------- /render-xml-source/xsl/render-xml-source-as-html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | XML Source rendering 41 | 42 | 43 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
    54 | 55 |
    56 | 57 | 58 |
    59 | 60 |
    61 | 62 |
    63 |
    64 |
    65 |
    66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | < 93 | 94 | 95 | 96 | 97 | 98 | 99 | 101 | 102 | 103 | 104 | 105 | 106 | = 107 | 108 | 109 | " 110 | 111 | " 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 123 | 124 | 125 |
    126 |
    127 | 128 | 129 | 131 | 132 |
    133 | 134 | 135 | /> 136 | 137 | 138 | > 139 | 140 | 141 | </ 142 | 143 | > 144 | 145 | 146 | 147 |
    148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | =" 157 | 161 | " 162 | 163 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | xmlns= 172 | 173 | 174 | " 175 | 176 | " 177 | 178 | 179 | 180 | 181 | 182 | 183 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 |   195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 |   205 | 206 | 207 | 208 | 209 |
    -------------------------------------------------------------------------------- /resolve-uri/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resolve-uri/xpl/test.xpl: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 |

    Expected result when running without parameters: 11 | file:/C:/cygwin/home/gerrit/Dev/epubtools-xproc/tmp/guide/epub/OEBPS/testi/foo.bar

    12 |

    That is: two levels (up from a file or from a directory count as one level here) get eaten, one is added, 13 | and then the filename is changed to what is in the 'add' parameter.

    14 |

    Try other values of add – without path, without reference to '..', without file name, …

    15 |

    Try other values of base – with or without trailing slash.

    16 |
    17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
    -------------------------------------------------------------------------------- /roman-numerals/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /roman-numerals/xsl/roman2int.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sequence-type/xsl/README.md: -------------------------------------------------------------------------------- 1 | Provides a function `tr:sequence-type` that takes one `item()` as an argument and returns the sequence type of the item as a string. 2 | 3 | Invoke it like this (assuming you have an XSLT 2 processor front-end script called `saxon` in the path): 4 | ``` 5 | saxon -xsl:xslt-util/sequence-type/xsl/test.xsl -it:test 6 | ``` 7 | 8 | The result should look like: 9 | ``` 10 | 1 integer 11 | 1 integer 12 | 1 integer 13 | 1 double 14 | true boolean 15 | 1 string 16 | file:/…/xslt-util/sequence-type/xsl/test.xsl anyURI 17 | document-node(element(foo)) 18 | document-node(element(foo)) 19 | element(foo) 20 | attribute(foo) 21 | processing-instruction(foo) 22 | comment() 23 | ``` 24 | -------------------------------------------------------------------------------- /sequence-type/xsl/sequence-type.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /sequence-type/xsl/test.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /split-sequence/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /split-sequence/xsl/split-sequence-by-string-length.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 57 | 58 | 59 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /strings/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /strings/xsl/diffs.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /strings/xsl/regex-functions.xsl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 29 | 39 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /uri-to-relative-path/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /uri-to-relative-path/xsl/uri-to-relative-path.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 28 | 30 | 31 | 34 | 35 | 39 | 43 | 46 | 47 | 48 | 55 | 56 | 57 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 70 | 71 | 72 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /uri/xsl/uri.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /xmlcatalog/transpect.io.catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /xslt-based-catalog-resolver/README.md: -------------------------------------------------------------------------------- 1 | # XSLT-based catalog resolver 2 | 3 | 4 | The XSLT-based catalog resolver was originally developed to overcome a 5 | limitation of Saxon’s default behavior: We tried to exploit the 6 | recursive wildcard search of 7 | [`collection()`](http://www.saxonica.com/documentation/index.html#!sourcedocs/collections) 8 | URLs, but discovered that this would only work for `file:` URLs, while 9 | the URLs in our code were abstract `http:` URLs. This would be ok if 10 | Saxon sent the URLs to the catalog resolver *before* deciding whether 11 | recursive wildcard search was feasible. (It should be, post-resolution, 12 | because they are `file:` URLs then.) 13 | 14 | We might have written our own URI resolver in Java, but this would make 15 | deployment more difficult, and it would probably require that we run 16 | commercial versions of Saxon everywhere which would be to high a hurdle 17 | for the adoption of transpect as an open-source, (almost) ready-to-run 18 | framework. 19 | 20 | So we wrote this XSLT-based resolver. It doesn’t implement the [whole 21 | catalog 22 | standard](https://www.oasis-open.org/committees/download.php/14810/xml-catalogs.pdf), 23 | but the elements that are most important to our pipelines, namely `uri`, 24 | `rewriteURI`, and `nextCatalog`. 25 | 26 | We usually rely on the standard catalog resolvers (Apache Common or 27 | Norman Walsh’s). We use the XSLT-based resolver only for collections 28 | with wildcard `http:` URLs, for reverse resolution, and when we just 29 | need the local name for a resource without actually retrieving the 30 | resource, for example when we prepare the packing list for an EPUB. 31 | Fonts in our font library are referenced by canonical URL but must be 32 | included from a working copy of their [repository 33 | location](https://github.com/transpect/fontlib/). 34 | 35 | 36 | -------------------------------------------------------------------------------- /xslt-based-catalog-resolver/xmlcatalog/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /xslt-based-catalog-resolver/xsl/interactive.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Bidirectional XML catalog resolution with Saxon CE 5 | 6 | 12 | 13 | 24 | 25 | 26 |

    Bidirectional XML catalog resolution with Saxon CE

    27 |

    This will translate the URL of a file that is in our svn repository to the abstract, immutable URL that you may use for accessing 28 | the file from a transpect pipeline (for example, when importing an XProc or an XSLT file). This abstract URL is called the file’s canonical URL

    29 |

    In the other direction, it will serve as a catalog resolver that uses the transpect module catalog 30 | to give you the location of a file that is imported by its canonical URL.

    31 |

    A use case for this is: if a transpect module A depends on another 32 | module B, 33 | this dependency is declared within a <p:pipeinfo> instruction within A’s pipelines, by referring to B’s canonical base URL. 34 | The catalog resolver will then translate the canonical URL to the svn repository URL that may be used for specifying 35 | the svn:external location. (In addition, 36 | it will create a <nextCatalog> entry in the project’s central catalog file. This entry will point to the locally checked out 37 | catalog of module B.)

    38 |

    The motivations for these indirections are:

    39 |
      40 |
    • The module’s canonical URL is an identifier, just like a namespace URI. It should never change.
    • 41 |
    • The module’s current repository location is accidental, fragile, and transient.
    • 42 |
    • There will always be some URL from where to retrieve the modules (not necessarily an svn repo). 43 | It can be either a central, Web-accessible repository, a local repository, or a local working copy.
    • 44 |
    • We don’t want to change application code when the module repositories change. We also don’t want to import 45 | module code by relative URLs, because the relative locations that worked so well in one project will inevitably break in another project. 46 | We only want to update the pointers to the 47 | module locations if the modules move. In the current setting, this is being done by changing the svn:externals for a project).
    • 48 |
    49 |

    The Form

    50 |

    Repository URL: 51 |

    52 |

    Loading the catalog file(s)… 53 | 54 |

    55 |

    Canonical URL:

    56 |

    (try for example https://github.com/transpect/xslt-util/xslt-based-catalog-resolver/xsl/resolve-uri-by-catalog.xsl)

    57 |

    Please note that if a URL does not resolve (or does not reversely resolve, respectively), the original URL will be used.

    58 |

    You may specify a different catalog location URL in 59 | the query string.

    60 |

    Please note that this page, the invoked XSLT, and the catalogs must be served from the same host. 61 | You can probably do something about it with CORS.

    62 |

    The Code

    63 |

    Apart from a thin Saxon CE adaption layer, it is the same XSLT stylesheet that is used for 64 | catalog resolution in transpect pipelines.

    65 |
    66 |

    The XSLT-based catalog resolver was originally developed to overcome a limitation of Saxon’s default behavior: We tried to exploit 67 | the recursive wildcard search of collection() URLs, 68 | but discovered that this would only work for file: URLs, while the URLs in our code were abstract http: URLs. 69 | This would be ok if Saxon sent the URLs to the catalog resolver before deciding whether recursive wildcard search was feasible. (It should be, post-resolution, 70 | because they are file: URLs then.)

    71 |

    We might have written our own URI resolver in Java, but this would make deployment more difficult, and it would probably require that we run commercial 72 | versions of Saxon everywhere which would be to high a hurdle for the adoption of transpect as an open-source, (almost) ready-to-run framework.

    73 |

    So we wrote this XSLT-based resolver. It doesn’t implement the whole catalog standard, 74 | but the elements that are most important to our pipelines, 75 | namely uri, rewriteURI, and nextCatalog.

    76 |

    We usually rely on the standard catalog resolvers (Apache Common or Norman Walsh’s). We use the XSLT-based resolver only for collections with 77 | wildcard http: URLs, for reverse resolution, and when we just need the local name for a resource without actually retrieving 78 | the resource, for example when we prepare the packing list for an EPUB. Fonts in our font library are referenced by canonical URL but must be included 79 | from a working copy of their repository location.

    80 |
    81 | 82 | 83 | -------------------------------------------------------------------------------- /xslt-based-catalog-resolver/xsl/interactive.xsl: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /xslt-based-catalog-resolver/xsl/resolve-uri-by-catalog.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 81 | 82 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 114 | 116 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | --------------------------------------------------------------------------------