@pretextbook/pretext-html 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -1
- package/assets/preview-revealjs.xsl +85 -0
- package/assets/upstream.json +1 -1
- package/assets/xsl/LICENSE-pretext +16 -0
- package/assets/xsl/entities.ent +7 -0
- package/assets/xsl/extract-biblio-csl.xsl +5 -3
- package/assets/xsl/extract-dynamic.xsl +14 -12
- package/assets/xsl/extract-interactive.xsl +2 -2
- package/assets/xsl/extract-pg.xsl +12 -9
- package/assets/xsl/extract-qrcode.xsl +1 -1
- package/assets/xsl/extract-trace.xsl +3 -3
- package/assets/xsl/extract-youtube.xsl +1 -1
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +3 -3
- package/assets/xsl/pretext-assembly.xsl +362 -357
- package/assets/xsl/pretext-braille-preprint.xsl +1 -1
- package/assets/xsl/pretext-common.xsl +101 -90
- package/assets/xsl/pretext-epub.xsl +17 -6
- package/assets/xsl/pretext-fo.xsl +10 -10
- package/assets/xsl/pretext-html.xsl +83 -60
- package/assets/xsl/pretext-latex-common.xsl +8 -8
- package/assets/xsl/pretext-numbers.xsl +35 -35
- package/assets/xsl/pretext-revealjs.xsl +1 -1
- package/assets/xsl/pretext-runestone-fitb.xsl +14 -13
- package/assets/xsl/pretext-runestone-static.xsl +17 -17
- package/assets/xsl/pretext-runestone.xsl +33 -31
- package/assets/xsl/pretext-view-source.xsl +5 -3
- package/assets/xsl/pretext-ww-problem-sets.xsl +6 -1
- package/assets/xsl/publisher-variables.xsl +23 -47
- package/assets/xsl-bundle.json +1 -1
- package/dist/cli-DZsyZERX.js +694 -0
- package/dist/cli.js +1 -1
- package/dist/index.browser.d.ts +5 -0
- package/dist/index.browser.js +402 -256
- package/dist/index.d.ts +5 -0
- package/dist/index.js +23 -18
- package/dist/publication.d.ts +25 -19
- package/dist/renderer.d.ts +48 -0
- package/dist/reveal.d.ts +77 -0
- package/dist/reveal.js +110 -0
- package/dist/target.d.ts +34 -0
- package/package.json +12 -1
- package/dist/cli-Cp6C0sif.js +0 -654
|
@@ -112,89 +112,89 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
112
112
|
<!-- content, which may generally just produce a lot of text. -->
|
|
113
113
|
<!-- Which is no good, say as an attribute value. -->
|
|
114
114
|
|
|
115
|
-
<!-- This stylesheet runs as a chain of full-tree passes. Each
|
|
116
|
-
<!-- pass is a modal traversal that copies the previous tree and
|
|
117
|
-
<!-- alters only the elements it cares about, yielding a new
|
|
118
|
-
<!-- tree. The new tree is built as a result tree fragment and
|
|
119
|
-
<!-- immediately turned into a real node-set with
|
|
120
|
-
<!-- exsl:node-set(), so the next pass can walk it. The chain is
|
|
121
|
-
<!-- wired in "The Assembly Pipeline" section as a sequence of
|
|
122
|
-
<!-- variables ($version, $assembly, ...); that sequence, not the
|
|
123
|
-
<!-- order of templates in this file, is the authoritative pass
|
|
124
|
-
<!-- order.
|
|
125
|
-
<!--
|
|
126
|
-
<!-- Most passes are the identity for almost every node. The
|
|
127
|
-
<!-- low-priority identity templates that make each pass a
|
|
128
|
-
<!-- faithful copy by default are collected in "Source Assembly
|
|
129
|
-
<!-- Infrastructure"; the section for a pass then overrides them
|
|
130
|
-
<!-- (one section per pass, below, in execution order) for just
|
|
131
|
-
<!-- the handful of elements that pass transforms.
|
|
132
|
-
<!--
|
|
133
|
-
<!-- The passes, in the order they run (the identifier in
|
|
134
|
-
<!-- parentheses is the node-set each one produces):
|
|
135
|
-
<!--
|
|
136
|
-
<!-- 1. private-solutions ($private-solutions)
|
|
137
|
-
<!-- Splice in an external file of instructor solutions.
|
|
138
|
-
<!-- Identity, and skipped, when no such file is named.
|
|
139
|
-
<!-- 2. version ($version)
|
|
140
|
-
<!-- Resolve "version" and "custom" elements, *removing*
|
|
141
|
-
<!-- excluded content. Result should be valid PreTeXt.
|
|
142
|
-
<!-- 3. id-attribute ($original-labeled) @original-id
|
|
143
|
-
<!-- First of three identification stamps (see below).
|
|
144
|
-
<!-- 4. assembly ($assembly)
|
|
145
|
-
<!-- *Add* computed content: the assembled bibliography,
|
|
146
|
-
<!-- copied WeBWorK problems, matching/card-sort pieces.
|
|
147
|
-
<!-- 5. exercise ($exercise)
|
|
148
|
-
<!-- Tag each exercise with its kind (inline, divisional,
|
|
149
|
-
<!-- worksheet, ...) for later decisions.
|
|
150
|
-
<!-- 6. id-attribute ($assembly-label) @assembly-id
|
|
151
|
-
<!-- Second stamp: the early id passes coordinate on.
|
|
152
|
-
<!-- 7. dynamic-substitution ($dynamic)
|
|
153
|
-
<!-- Splice computed answers into fill-in-the-blank and
|
|
154
|
-
<!-- kindred dynamic exercises. Skipped when none exist.
|
|
155
|
-
<!-- 8. representations ($representations)
|
|
156
|
-
<!-- Render interactive exercises as static or dynamic
|
|
157
|
-
<!-- equivalents, per $exercise-style.
|
|
158
|
-
<!-- 9. repair ($repair)
|
|
159
|
-
<!-- *Change* source: fix deprecated constructions and
|
|
160
|
-
<!-- apply conveniences, for a canonical tree.
|
|
161
|
-
<!-- 10. enrichment ($enrichment)
|
|
162
|
-
<!-- *Add* generated material, e.g. a GeoGebra preview
|
|
163
|
-
<!-- or visual text for a bare url.
|
|
164
|
-
<!-- 11. labels ($labels)
|
|
165
|
-
<!-- Promote an authored @xml:id to @label and record
|
|
166
|
-
<!-- localization support. See "Labels".
|
|
167
|
-
<!-- 12. id-attribute ($identification) @unique-id
|
|
168
|
-
<!-- Third stamp: the final id conversions consume.
|
|
169
|
-
<!-- 13. augment ($augment)
|
|
170
|
-
<!-- Annotate divisions with @level (and ordered lists
|
|
171
|
-
<!-- with @ordered-list-level), as numbering needs.
|
|
172
|
-
<!-- 14. serial-stamp ($serial-stamp)
|
|
173
|
-
<!-- Stamp @serial on every numbered item. See
|
|
174
|
-
<!-- "Numbering".
|
|
175
|
-
<!--
|
|
176
|
-
<!-- After the chain, $root, $docinfo, $document-root and
|
|
177
|
-
<!-- $bibinfo are derived from the final tree for the conversion
|
|
178
|
-
<!-- stylesheets that import this one.
|
|
179
|
-
<!--
|
|
180
|
-
<!-- Three identifiers, one mechanism. The id-attribute pass
|
|
181
|
-
<!-- runs three times (passes 3, 6, 12), each stamping one
|
|
182
|
-
<!-- attribute by a deterministic depth-first walk: @original-id
|
|
183
|
-
<!-- (authored structure), @assembly-id (early, so passes can
|
|
184
|
-
<!-- coordinate before filenames exist) and @unique-id (the final
|
|
185
|
-
<!-- identifier). The three agree element-for-element only
|
|
186
|
-
<!-- because no intervening pass reorders siblings; that
|
|
187
|
-
<!-- invariant is stated in full at "Structural Contract for
|
|
188
|
-
<!-- Identification Passes" and checked, when assembly.debug is
|
|
189
|
-
<!-- set, by the id-coherence-check.
|
|
190
|
-
<!--
|
|
191
|
-
<!-- Two-pass extraction and substitution. A few constructs
|
|
192
|
-
<!-- (fill-in-the-blank answers, WeBWorK, MOM, ...) need an
|
|
193
|
-
<!-- external round trip: this stylesheet first emits a tree that
|
|
194
|
-
<!-- drives the trip, then on a later run reads the results back.
|
|
195
|
-
<!-- The $b-extracting-* switches that select that mode are
|
|
196
|
-
<!-- described at "Controlling Two-Pass Extraction and
|
|
197
|
-
<!-- Substitution".
|
|
115
|
+
<!-- This stylesheet runs as a chain of full-tree passes. Each -->
|
|
116
|
+
<!-- pass is a modal traversal that copies the previous tree and -->
|
|
117
|
+
<!-- alters only the elements it cares about, yielding a new -->
|
|
118
|
+
<!-- tree. The new tree is built as a result tree fragment and -->
|
|
119
|
+
<!-- immediately turned into a real node-set with -->
|
|
120
|
+
<!-- exsl:node-set(), so the next pass can walk it. The chain is -->
|
|
121
|
+
<!-- wired in "The Assembly Pipeline" section as a sequence of -->
|
|
122
|
+
<!-- variables ($version, $assembly, ...); that sequence, not the -->
|
|
123
|
+
<!-- order of templates in this file, is the authoritative pass -->
|
|
124
|
+
<!-- order. -->
|
|
125
|
+
<!-- -->
|
|
126
|
+
<!-- Most passes are the identity for almost every node. The -->
|
|
127
|
+
<!-- low-priority identity templates that make each pass a -->
|
|
128
|
+
<!-- faithful copy by default are collected in "Source Assembly -->
|
|
129
|
+
<!-- Infrastructure"; the section for a pass then overrides them -->
|
|
130
|
+
<!-- (one section per pass, below, in execution order) for just -->
|
|
131
|
+
<!-- the handful of elements that pass transforms. -->
|
|
132
|
+
<!-- -->
|
|
133
|
+
<!-- The passes, in the order they run (the identifier in -->
|
|
134
|
+
<!-- parentheses is the node-set each one produces): -->
|
|
135
|
+
<!-- -->
|
|
136
|
+
<!-- 1. private-solutions ($private-solutions) -->
|
|
137
|
+
<!-- Splice in an external file of instructor solutions. -->
|
|
138
|
+
<!-- Identity, and skipped, when no such file is named. -->
|
|
139
|
+
<!-- 2. version ($version) -->
|
|
140
|
+
<!-- Resolve "version" and "custom" elements, *removing* -->
|
|
141
|
+
<!-- excluded content. Result should be valid PreTeXt. -->
|
|
142
|
+
<!-- 3. id-attribute ($original-labeled) @pi:original-id -->
|
|
143
|
+
<!-- First of three identification stamps (see below). -->
|
|
144
|
+
<!-- 4. assembly ($assembly) -->
|
|
145
|
+
<!-- *Add* computed content: the assembled bibliography, -->
|
|
146
|
+
<!-- copied WeBWorK problems, matching/card-sort pieces. -->
|
|
147
|
+
<!-- 5. exercise ($exercise) -->
|
|
148
|
+
<!-- Tag each exercise with its kind (inline, divisional, -->
|
|
149
|
+
<!-- worksheet, ...) for later decisions. -->
|
|
150
|
+
<!-- 6. id-attribute ($assembly-label) @pi:assembly-id -->
|
|
151
|
+
<!-- Second stamp: the early id passes coordinate on. -->
|
|
152
|
+
<!-- 7. dynamic-substitution ($dynamic) -->
|
|
153
|
+
<!-- Splice computed answers into fill-in-the-blank and -->
|
|
154
|
+
<!-- kindred dynamic exercises. Skipped when none exist. -->
|
|
155
|
+
<!-- 8. representations ($representations) -->
|
|
156
|
+
<!-- Render interactive exercises as static or dynamic -->
|
|
157
|
+
<!-- equivalents, per $exercise-style. -->
|
|
158
|
+
<!-- 9. repair ($repair) -->
|
|
159
|
+
<!-- *Change* source: fix deprecated constructions and -->
|
|
160
|
+
<!-- apply conveniences, for a canonical tree. -->
|
|
161
|
+
<!-- 10. enrichment ($enrichment) -->
|
|
162
|
+
<!-- *Add* generated material, e.g. a GeoGebra preview -->
|
|
163
|
+
<!-- or visual text for a bare url. -->
|
|
164
|
+
<!-- 11. labels ($labels) -->
|
|
165
|
+
<!-- Promote an authored @xml:id to @label and record -->
|
|
166
|
+
<!-- localization support. See "Labels". -->
|
|
167
|
+
<!-- 12. id-attribute ($identification) @pi:unique-id -->
|
|
168
|
+
<!-- Third stamp: the final id conversions consume. -->
|
|
169
|
+
<!-- 13. augment ($augment) -->
|
|
170
|
+
<!-- Annotate divisions with @pi:level (and ordered lists -->
|
|
171
|
+
<!-- with @pi:ordered-list-level), as numbering needs. -->
|
|
172
|
+
<!-- 14. serial-stamp ($serial-stamp) -->
|
|
173
|
+
<!-- Stamp @pi:serial on every numbered item. See -->
|
|
174
|
+
<!-- "Numbering". -->
|
|
175
|
+
<!-- -->
|
|
176
|
+
<!-- After the chain, $root, $docinfo, $document-root and -->
|
|
177
|
+
<!-- $bibinfo are derived from the final tree for the conversion -->
|
|
178
|
+
<!-- stylesheets that import this one. -->
|
|
179
|
+
<!-- -->
|
|
180
|
+
<!-- Three identifiers, one mechanism. The id-attribute pass -->
|
|
181
|
+
<!-- runs three times (passes 3, 6, 12), each stamping one -->
|
|
182
|
+
<!-- attribute by a deterministic depth-first walk: @pi:original-id -->
|
|
183
|
+
<!-- (authored structure), @pi:assembly-id (early, so passes can -->
|
|
184
|
+
<!-- coordinate before filenames exist) and @pi:unique-id (the final -->
|
|
185
|
+
<!-- identifier). The three agree element-for-element only -->
|
|
186
|
+
<!-- because no intervening pass reorders siblings; that -->
|
|
187
|
+
<!-- invariant is stated in full at "Structural Contract for -->
|
|
188
|
+
<!-- Identification Passes" and checked, when assembly.debug is -->
|
|
189
|
+
<!-- set, by the id-coherence-check. -->
|
|
190
|
+
<!-- -->
|
|
191
|
+
<!-- Two-pass extraction and substitution. A few constructs -->
|
|
192
|
+
<!-- (fill-in-the-blank answers, WeBWorK, MOM, ...) need an -->
|
|
193
|
+
<!-- external round trip: this stylesheet first emits a tree that -->
|
|
194
|
+
<!-- drives the trip, then on a later run reads the results back. -->
|
|
195
|
+
<!-- The $b-extracting-* switches that select that mode are -->
|
|
196
|
+
<!-- described at "Controlling Two-Pass Extraction and -->
|
|
197
|
+
<!-- Substitution". -->
|
|
198
198
|
|
|
199
199
|
<!-- Isolate conversion of Runestone/interactive to PreTeXt/static -->
|
|
200
200
|
<xsl:import href="./pretext-runestone-static.xsl"/>
|
|
@@ -204,7 +204,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
204
204
|
<!-- dependencies. In almost every rational use, the "-common" -->
|
|
205
205
|
<!-- stylesheet is imported by a conversion, so it is easy to -->
|
|
206
206
|
<!-- miss these dependencies. An example in 2022-06 was the use -->
|
|
207
|
-
<!-- of the "
|
|
207
|
+
<!-- of the "unique-id" template to coordinate construction and -->
|
|
208
208
|
<!-- insertion of WeBWorK problems with an intervening trip to a -->
|
|
209
209
|
<!-- WW server. The "pretext-enhanced-source.xsl" stylesheet is -->
|
|
210
210
|
<!-- one place where "-common" does not creep in. Use of a modal -->
|
|
@@ -232,7 +232,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
232
232
|
<!-- Sometimes we only want to stop at an intermediate tree. For example, -->
|
|
233
233
|
<!-- we may convert only to a "version" (valid PreTeXt) via resolution of -->
|
|
234
234
|
<!-- version support and customizations, or stop at the tree that has -->
|
|
235
|
-
<!-- @assembly-id attributes but has not yet loaded exercise components
|
|
235
|
+
<!-- @pi:assembly-id attributes but has not yet loaded exercise components.-->
|
|
236
236
|
<!-- We control this with internal variables, not documented as author or -->
|
|
237
237
|
<!-- publisher features. When we stop this early, "exercise-style" is -->
|
|
238
238
|
<!-- irrelevant. -->
|
|
@@ -241,9 +241,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
241
241
|
<xsl:param name="assembly.version-only" select="''"/>
|
|
242
242
|
<xsl:param name="assembly.assembly-id-only" select="''"/>
|
|
243
243
|
|
|
244
|
-
<!-- Set to 'yes' to enable diagnostic checks, such as
|
|
245
|
-
<!-- verifying coherence of @assembly-id and @unique-id. -->
|
|
246
|
-
<!-- Not documented as an author or publisher feature.
|
|
244
|
+
<!-- Set to 'yes' to enable diagnostic checks, such as -->
|
|
245
|
+
<!-- verifying coherence of @pi:assembly-id and @pi:unique-id. -->
|
|
246
|
+
<!-- Not documented as an author or publisher feature. -->
|
|
247
247
|
<xsl:param name="assembly.debug" select="''"/>
|
|
248
248
|
<xsl:variable name="b-assembly-debug" select="$assembly.debug = 'yes'"/>
|
|
249
249
|
|
|
@@ -349,16 +349,23 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
349
349
|
<!-- Source Assembly Infrastructure -->
|
|
350
350
|
<!-- ############################## -->
|
|
351
351
|
|
|
352
|
-
<!-- When building duplicates, we have occasion
|
|
353
|
-
<!-- to inspect the original in various places
|
|
354
|
-
<!-- We do not know if we have "fixed" the
|
|
355
|
-
<!-- deprecated overall element, so need to
|
|
356
|
-
<!-- try both. For example, this variable is
|
|
357
|
-
<!-- employed by the warnings and deprecation
|
|
358
|
-
<!-- messages that result from analyzing an
|
|
359
|
-
<!-- author's source, since we may "repair"
|
|
360
|
-
<!-- some of them later, so we have to catch
|
|
361
|
-
<!-- them early.
|
|
352
|
+
<!-- When building duplicates, we have occasion -->
|
|
353
|
+
<!-- to inspect the original in various places -->
|
|
354
|
+
<!-- We do not know if we have "fixed" the -->
|
|
355
|
+
<!-- deprecated overall element, so need to -->
|
|
356
|
+
<!-- try both. For example, this variable is -->
|
|
357
|
+
<!-- employed by the warnings and deprecation -->
|
|
358
|
+
<!-- messages that result from analyzing an -->
|
|
359
|
+
<!-- author's source, since we may "repair" -->
|
|
360
|
+
<!-- some of them later, so we have to catch -->
|
|
361
|
+
<!-- them early. -->
|
|
362
|
+
<!-- The author's source, as parsed. Kept for duties genuinely -->
|
|
363
|
+
<!-- about the source document: resolving relative filenames via -->
|
|
364
|
+
<!-- the second argument of the document() function, and -->
|
|
365
|
+
<!-- warnings/views that inspect exactly what the author wrote -->
|
|
366
|
+
<!-- ("generic-warnings", view-source). Checks and lookups against -->
|
|
367
|
+
<!-- the document's *content* belong on the assembled tree, $root, -->
|
|
368
|
+
<!-- where private solutions are merged and versions are resolved. -->
|
|
362
369
|
<xsl:variable name="original" select="/mathbook|/pretext"/>
|
|
363
370
|
|
|
364
371
|
<!-- These modal templates duplicate the source exactly for each -->
|
|
@@ -551,6 +558,23 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
551
558
|
<xsl:when test="$b-version-only"/>
|
|
552
559
|
<!-- build on "version" to add original id's -->
|
|
553
560
|
<xsl:otherwise>
|
|
561
|
+
<!-- Duplicate identifiers are an authoring error, so the checks -->
|
|
562
|
+
<!-- run on the version tree: private solutions are merged by -->
|
|
563
|
+
<!-- now (authored content in companion files), while version -->
|
|
564
|
+
<!-- resolution has already discarded the deliberate duplicates -->
|
|
565
|
+
<!-- that multi-version source may carry. Later phases -->
|
|
566
|
+
<!-- manufacture copies of authored content (e.g. static -->
|
|
567
|
+
<!-- representations of interactive exercises), and those must -->
|
|
568
|
+
<!-- not be blamed on the author. -->
|
|
569
|
+
<xsl:call-template name="duplication-check-xmlid">
|
|
570
|
+
<xsl:with-param name="nodes" select="$version//*[@xml:id]"/>
|
|
571
|
+
<xsl:with-param name="purpose" select="'authored'"/>
|
|
572
|
+
</xsl:call-template>
|
|
573
|
+
<xsl:call-template name="duplication-check-label">
|
|
574
|
+
<xsl:with-param name="nodes" select="$version//*[@label]"/>
|
|
575
|
+
<xsl:with-param name="purpose" select="'authored'"/>
|
|
576
|
+
</xsl:call-template>
|
|
577
|
+
<!-- checks are done, now add the "original-id" identification -->
|
|
554
578
|
<xsl:apply-templates select="$version" mode="id-attribute">
|
|
555
579
|
<!-- $parent-id defaults to 'root' in template -->
|
|
556
580
|
<xsl:with-param name="attr-name" select="'original-id'"/>
|
|
@@ -586,16 +610,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
586
610
|
</xsl:variable>
|
|
587
611
|
<xsl:variable name="assembly-label" select="exsl:node-set($assembly-label-rtf)"/>
|
|
588
612
|
|
|
589
|
-
<!-- Make static substitutions for dynamic exercises. This runs AFTER
|
|
590
|
-
<!-- the @assembly-id stamp because the substitution round trip keys on -->
|
|
591
|
-
<!-- @assembly-id: extract-dynamic.xsl writes it as the exercise_id, and -->
|
|
592
|
-
<!-- the lookup below reads it. @assembly-id is the early identifier -->
|
|
593
|
-
<!-- both ends can compute consistently (the authored @label would only
|
|
594
|
-
<!-- match for labeled exercises, missing unlabeled ones and tasks).
|
|
595
|
-
<!-- The pass only acts on the elements enumerated in this presence
|
|
596
|
-
<!-- test (see the "dynamic-substitution" templates); without any of
|
|
597
|
-
<!-- them it is the identity, so we skip the full-tree copy. NB: a
|
|
598
|
-
<!-- new template in the mode must be reflected in this test.
|
|
613
|
+
<!-- Make static substitutions for dynamic exercises. This runs AFTER -->
|
|
614
|
+
<!-- the @pi:assembly-id stamp because the substitution round trip keys on -->
|
|
615
|
+
<!-- @pi:assembly-id: extract-dynamic.xsl writes it as the exercise_id, and -->
|
|
616
|
+
<!-- the lookup below reads it. @pi:assembly-id is the early identifier -->
|
|
617
|
+
<!-- both ends can compute consistently (the authored @label would only -->
|
|
618
|
+
<!-- match for labeled exercises, missing unlabeled ones and tasks). -->
|
|
619
|
+
<!-- The pass only acts on the elements enumerated in this presence -->
|
|
620
|
+
<!-- test (see the "dynamic-substitution" templates); without any of -->
|
|
621
|
+
<!-- them it is the identity, so we skip the full-tree copy. NB: a -->
|
|
622
|
+
<!-- new template in the mode must be reflected in this test. -->
|
|
599
623
|
<xsl:variable name="b-has-dynamic-markup" select="boolean($assembly-label//setup | $assembly-label//numcmp | $assembly-label//strcmp | $assembly-label//jscmp | $assembly-label//mathcmp | $assembly-label//logic | $assembly-label//fillin[@ansobj] | $assembly-label//eval[@obj])"/>
|
|
600
624
|
<xsl:variable name="dynamic-rtf">
|
|
601
625
|
<xsl:if test="$b-has-dynamic-markup">
|
|
@@ -606,7 +630,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
606
630
|
|
|
607
631
|
<xsl:variable name="representations-rtf">
|
|
608
632
|
<xsl:choose>
|
|
609
|
-
<!-- short-circuit to stop after adding @assembly-id -->
|
|
633
|
+
<!-- short-circuit to stop after adding @pi:assembly-id -->
|
|
610
634
|
<xsl:when test="$b-assembly-id-only"/>
|
|
611
635
|
<xsl:otherwise>
|
|
612
636
|
<xsl:apply-templates select="$dynamic" mode="representations"/>
|
|
@@ -635,18 +659,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
635
659
|
<!-- out of the "identification" pass, so is located here. Perhaps -->
|
|
636
660
|
<!-- it can/should move earlier, maybe not. -->
|
|
637
661
|
<xsl:variable name="labels-rtf">
|
|
638
|
-
<!-- pass in all elements with authored @xml:id -->
|
|
639
|
-
<!-- to look for authored duplicates -->
|
|
640
|
-
<xsl:call-template name="duplication-check-xmlid">
|
|
641
|
-
<xsl:with-param name="nodes" select="$enrichment//*[@xml:id]"/>
|
|
642
|
-
<xsl:with-param name="purpose" select="'authored'"/>
|
|
643
|
-
</xsl:call-template>
|
|
644
|
-
<!-- pass in all elements with authored @label -->
|
|
645
|
-
<!-- to look for authored duplicates -->
|
|
646
|
-
<xsl:call-template name="duplication-check-label">
|
|
647
|
-
<xsl:with-param name="nodes" select="$enrichment//*[@label]"/>
|
|
648
|
-
<xsl:with-param name="purpose" select="'authored'"/>
|
|
649
|
-
</xsl:call-template>
|
|
650
662
|
<xsl:apply-templates select="$enrichment" mode="labels"/>
|
|
651
663
|
</xsl:variable>
|
|
652
664
|
<xsl:variable name="labels" select="exsl:node-set($labels-rtf)"/>
|
|
@@ -899,10 +911,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
899
911
|
|
|
900
912
|
<!-- This section is the id-attribute pass. One mechanism (the -->
|
|
901
913
|
<!-- "id-attribute" templates below) is applied three times by -->
|
|
902
|
-
<!-- the chain (passes 3, 6 and 12), stamping @original-id,
|
|
903
|
-
<!-- @assembly-id and @unique-id in turn. The "labels" pass
|
|
914
|
+
<!-- the chain (passes 3, 6 and 12), stamping @pi:original-id, -->
|
|
915
|
+
<!-- @pi:assembly-id and @pi:unique-id in turn. The "labels" pass -->
|
|
904
916
|
<!-- runs between the second and third of these (see "Labels"), -->
|
|
905
|
-
<!-- and the @label values it creates are what the @unique-id
|
|
917
|
+
<!-- and the @label values it creates are what the @pi:unique-id -->
|
|
906
918
|
<!-- stamp reads here. The contract that follows is what lets -->
|
|
907
919
|
<!-- the three stampings agree element-for-element. -->
|
|
908
920
|
|
|
@@ -920,11 +932,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
920
932
|
<!-- This template is applied three times, producing three -->
|
|
921
933
|
<!-- attributes on every element: -->
|
|
922
934
|
<!-- -->
|
|
923
|
-
<!-- @original-id
|
|
935
|
+
<!-- @pi:original-id -->
|
|
924
936
|
<!-- after "version", before any additions -->
|
|
925
|
-
<!-- @assembly-id
|
|
937
|
+
<!-- @pi:assembly-id -->
|
|
926
938
|
<!-- after "exercise", before "representations" -->
|
|
927
|
-
<!-- @unique-id
|
|
939
|
+
<!-- @pi:unique-id -->
|
|
928
940
|
<!-- after "labels", the final structural form -->
|
|
929
941
|
<!-- -->
|
|
930
942
|
<!-- The architecture relies on one critical invariant: -->
|
|
@@ -977,7 +989,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
977
989
|
<xsl:copy>
|
|
978
990
|
<!-- duplicate all attributes -->
|
|
979
991
|
<xsl:apply-templates select="@*" mode="id-attribute"/>
|
|
980
|
-
<!-- * Strategy is much like @original-id but maybe needs as much care
|
|
992
|
+
<!-- * Strategy is much like @pi:original-id but maybe needs as much care -->
|
|
981
993
|
<!-- * Element counts are used to reflect document tree structure -->
|
|
982
994
|
<!-- * Non-numeric separator needed to preserve uniqueness (e.g.1-12 != 11-2). -->
|
|
983
995
|
<!-- * Separators are therefore hyphens -->
|
|
@@ -1009,7 +1021,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1009
1021
|
</xsl:otherwise>
|
|
1010
1022
|
</xsl:choose>
|
|
1011
1023
|
</xsl:variable>
|
|
1012
|
-
<xsl:attribute name="{$attr-name}">
|
|
1024
|
+
<xsl:attribute name="pi:{$attr-name}">
|
|
1013
1025
|
<xsl:value-of select="$new-id"/>
|
|
1014
1026
|
</xsl:attribute>
|
|
1015
1027
|
<!-- recurse -->
|
|
@@ -1028,23 +1040,23 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1028
1040
|
</xsl:copy>
|
|
1029
1041
|
</xsl:template>
|
|
1030
1042
|
|
|
1031
|
-
<!-- Diagnostic: verify @assembly-id equals @unique-id for
|
|
1032
|
-
<!-- every element that carries both. A mismatch indicates
|
|
1033
|
-
<!-- a structural change between the two ID-stamping passes
|
|
1034
|
-
<!-- that violates the identification contract documented
|
|
1035
|
-
<!-- near the top of this stylesheet. Gated by the
|
|
1036
|
-
<!-- assembly.debug parameter; does nothing when off.
|
|
1043
|
+
<!-- Diagnostic: verify @pi:assembly-id equals @pi:unique-id for -->
|
|
1044
|
+
<!-- every element that carries both. A mismatch indicates -->
|
|
1045
|
+
<!-- a structural change between the two ID-stamping passes -->
|
|
1046
|
+
<!-- that violates the identification contract documented -->
|
|
1047
|
+
<!-- near the top of this stylesheet. Gated by the -->
|
|
1048
|
+
<!-- assembly.debug parameter; does nothing when off. -->
|
|
1037
1049
|
|
|
1038
1050
|
<xsl:template match="node()|@*" mode="id-coherence-check">
|
|
1039
1051
|
<xsl:if test="$b-assembly-debug">
|
|
1040
|
-
<xsl:for-each select=".//*[@assembly-id and @unique-id and not(@assembly-id = @unique-id)]">
|
|
1052
|
+
<xsl:for-each select=".//*[@pi:assembly-id and @pi:unique-id and not(@pi:assembly-id = @pi:unique-id)]">
|
|
1041
1053
|
<xsl:message>
|
|
1042
|
-
<xsl:text>PTX:DEBUG: @assembly-id / @unique-id mismatch on <</xsl:text>
|
|
1054
|
+
<xsl:text>PTX:DEBUG: @pi:assembly-id / @pi:unique-id mismatch on <</xsl:text>
|
|
1043
1055
|
<xsl:value-of select="local-name()"/>
|
|
1044
1056
|
<xsl:text>>: assembly-id="</xsl:text>
|
|
1045
|
-
<xsl:value-of select="@assembly-id"/>
|
|
1057
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
1046
1058
|
<xsl:text>" unique-id="</xsl:text>
|
|
1047
|
-
<xsl:value-of select="@unique-id"/>
|
|
1059
|
+
<xsl:value-of select="@pi:unique-id"/>
|
|
1048
1060
|
<xsl:text>"</xsl:text>
|
|
1049
1061
|
</xsl:message>
|
|
1050
1062
|
</xsl:for-each>
|
|
@@ -1064,9 +1076,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1064
1076
|
<!-- $biblios in -common, and then mined for matches not -->
|
|
1065
1077
|
<!-- explicitly present? -->
|
|
1066
1078
|
<xsl:template match="backmatter/references[@source]" mode="assembly">
|
|
1067
|
-
<!-- Grab the list
|
|
1068
|
-
<!--
|
|
1069
|
-
|
|
1079
|
+
<!-- Grab the list. The filename is relative to the authored -->
|
|
1080
|
+
<!-- document, so the lookup anchors on $original: the context -->
|
|
1081
|
+
<!-- node lives in a constructed tree, which has no base URI -->
|
|
1082
|
+
<xsl:variable name="biblios" select="document(@source, $original)"/>
|
|
1070
1083
|
<!-- Copy the "references" element (could be literal, but maybe not in "text" output mode) -->
|
|
1071
1084
|
<xsl:copy>
|
|
1072
1085
|
<!-- @source attribute not needed in enhanced source -->
|
|
@@ -1077,9 +1090,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1077
1090
|
<xsl:for-each select="$biblios/pretext-biblios/biblio">
|
|
1078
1091
|
<xsl:variable name="the-id" select="@xml:id"/>
|
|
1079
1092
|
<xsl:message>PTX:DEBUG: @xml:id of <biblio> in bibliography file: <xsl:value-of select="$the-id"/></xsl:message>
|
|
1080
|
-
<!-- Building duplicate, so look
|
|
1081
|
-
<!--
|
|
1082
|
-
|
|
1093
|
+
<!-- Building duplicate, so look in this pass's input -->
|
|
1094
|
+
<!-- tree (the version in play) for an "xref" pointing -->
|
|
1095
|
+
<!-- to the current context "biblio" -->
|
|
1096
|
+
<xsl:if test="$original-labeled//xref[@ref = $the-id]">
|
|
1083
1097
|
<xsl:message>PTX:DEBUG: Located this <biblio> cited in original source</xsl:message>
|
|
1084
1098
|
<xsl:apply-templates select="." mode="assembly"/>
|
|
1085
1099
|
</xsl:if>
|
|
@@ -1260,17 +1274,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1260
1274
|
<xsl:variable name="first-ref">
|
|
1261
1275
|
<xsl:value-of select="$tokenized-refs[1]"/>
|
|
1262
1276
|
</xsl:variable>
|
|
1263
|
-
<!-- context
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
</xsl:for-each>
|
|
1277
|
+
<!-- The context "xref" sits in this pass's input tree, so -->
|
|
1278
|
+
<!-- id() searches exactly the version in play -->
|
|
1279
|
+
<xsl:choose>
|
|
1280
|
+
<xsl:when test="id($first-ref)/self::biblio/parent::references/parent::backmatter">
|
|
1281
|
+
<xsl:text>yes</xsl:text>
|
|
1282
|
+
</xsl:when>
|
|
1283
|
+
<xsl:otherwise>
|
|
1284
|
+
<xsl:text>no</xsl:text>
|
|
1285
|
+
</xsl:otherwise>
|
|
1286
|
+
</xsl:choose>
|
|
1274
1287
|
</xsl:otherwise>
|
|
1275
1288
|
</xsl:choose>
|
|
1276
1289
|
</xsl:variable>
|
|
@@ -1290,7 +1303,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1290
1303
|
<!-- a candidate for replacement -->
|
|
1291
1304
|
<xsl:otherwise>
|
|
1292
1305
|
<xsl:variable name="the-xref-id">
|
|
1293
|
-
<xsl:value-of select="@original-id"/>
|
|
1306
|
+
<xsl:value-of select="@pi:original-id"/>
|
|
1294
1307
|
</xsl:variable>
|
|
1295
1308
|
<xsl:variable name="matched-citation" select="document('gen/references/csl-bibliography.xml', $original)/pi:csl-references/pi:csl-citation[@xml:id = $the-xref-id]"/>
|
|
1296
1309
|
<xsl:copy-of select="$matched-citation"/>
|
|
@@ -1370,7 +1383,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1370
1383
|
<!-- no error means to proceed with copy -->
|
|
1371
1384
|
<xsl:when test="$error-message-for-copy = ''">
|
|
1372
1385
|
<xsl:copy>
|
|
1373
|
-
<xsl:attribute name="copied-from">
|
|
1386
|
+
<xsl:attribute name="pi:copied-from">
|
|
1374
1387
|
<xsl:value-of select="@copy"/>
|
|
1375
1388
|
</xsl:attribute>
|
|
1376
1389
|
<!-- Duplicate attributes, but remove the @copy attribute -->
|
|
@@ -1493,7 +1506,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1493
1506
|
<!-- problems are interactive or static, inline or not, based -->
|
|
1494
1507
|
<!-- on publisher options. -->
|
|
1495
1508
|
<xsl:if test="not(self::task)">
|
|
1496
|
-
<xsl:attribute name="exercise-customization">
|
|
1509
|
+
<xsl:attribute name="pi:exercise-customization">
|
|
1497
1510
|
<xsl:choose>
|
|
1498
1511
|
<xsl:when test="&PROJECT-FILTER;">
|
|
1499
1512
|
<xsl:text>project</xsl:text>
|
|
@@ -1523,7 +1536,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1523
1536
|
<!-- These "interactivity types" are meant for Runestone-enabled -->
|
|
1524
1537
|
<!-- interactive exercises and projects -->
|
|
1525
1538
|
<xsl:template match="*" mode="exercise-interactive-attribute">
|
|
1526
|
-
<xsl:attribute name="exercise-interactive">
|
|
1539
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1527
1540
|
<xsl:choose>
|
|
1528
1541
|
<!-- This is defensive, so statement//var below does not -->
|
|
1529
1542
|
<!-- match for WeBWorK. -->
|
|
@@ -1543,14 +1556,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1543
1556
|
<xsl:when test="stack">
|
|
1544
1557
|
<xsl:text>stack</xsl:text>
|
|
1545
1558
|
</xsl:when>
|
|
1546
|
-
<!-- @runestone was once used to signify a Runestone exercise given
|
|
1547
|
-
<!-- just by raw HTML. The @exercise-interactive value uses was,
|
|
1548
|
-
<!-- appropriately, "htmlhack". We now replace it with an old-time,
|
|
1549
|
-
<!-- static PreTeXt style (dumb) exercise. Changing the value here
|
|
1550
|
-
<!-- is a quick way to nullify activity in later passes. See below
|
|
1551
|
-
<!-- where the "repair" phase removes the @runestone attribute and
|
|
1552
|
-
<!-- creates the (dumb) exercise, in order to understand more fully.
|
|
1553
|
-
<!-- The commit with these changes might also help. (2025-11-04)
|
|
1559
|
+
<!-- @runestone was once used to signify a Runestone exercise given -->
|
|
1560
|
+
<!-- just by raw HTML. The @pi:exercise-interactive value uses was, -->
|
|
1561
|
+
<!-- appropriately, "htmlhack". We now replace it with an old-time, -->
|
|
1562
|
+
<!-- static PreTeXt style (dumb) exercise. Changing the value here -->
|
|
1563
|
+
<!-- is a quick way to nullify activity in later passes. See below -->
|
|
1564
|
+
<!-- where the "repair" phase removes the @runestone attribute and -->
|
|
1565
|
+
<!-- creates the (dumb) exercise, in order to understand more fully. -->
|
|
1566
|
+
<!-- The commit with these changes might also help. (2025-11-04) -->
|
|
1554
1567
|
<xsl:when test="@runestone">
|
|
1555
1568
|
<xsl:text>static</xsl:text>
|
|
1556
1569
|
</xsl:when>
|
|
@@ -1716,9 +1729,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1716
1729
|
<xsl:template match="fillin[@ansobj]" mode="dynamic-substitution">
|
|
1717
1730
|
<xsl:choose>
|
|
1718
1731
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
1719
|
-
<!-- The substitutions file is keyed by @assembly-id, which
|
|
1720
|
-
<!-- extract-dynamic.xsl writes as the exercise_id. This pass
|
|
1721
|
-
<!-- runs after the @assembly-id stamp, so the owner carries it. -->
|
|
1732
|
+
<!-- The substitutions file is keyed by @pi:assembly-id, which -->
|
|
1733
|
+
<!-- extract-dynamic.xsl writes as the exercise_id. This pass -->
|
|
1734
|
+
<!-- runs after the @pi:assembly-id stamp, so the owner carries it. -->
|
|
1722
1735
|
<xsl:variable name="owner" select="ancestor::statement/.."/>
|
|
1723
1736
|
<xsl:variable name="parent-id">
|
|
1724
1737
|
<xsl:apply-templates select="$owner" mode="assembly-id"/>
|
|
@@ -1747,9 +1760,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1747
1760
|
<xsl:choose>
|
|
1748
1761
|
<!-- static, for multiple conversions, but primarily LaTeX -->
|
|
1749
1762
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
1750
|
-
<!-- The substitutions file is keyed by @assembly-id, which
|
|
1751
|
-
<!-- extract-dynamic.xsl writes as the exercise_id. This pass
|
|
1752
|
-
<!-- runs after the @assembly-id stamp, so the owner carries it. -->
|
|
1763
|
+
<!-- The substitutions file is keyed by @pi:assembly-id, which -->
|
|
1764
|
+
<!-- extract-dynamic.xsl writes as the exercise_id. This pass -->
|
|
1765
|
+
<!-- runs after the @pi:assembly-id stamp, so the owner carries it. -->
|
|
1753
1766
|
<xsl:variable name="owner" select="(ancestor::statement|ancestor::solution|ancestor::evaluation)/.."/>
|
|
1754
1767
|
<xsl:variable name="parent-id">
|
|
1755
1768
|
<xsl:apply-templates select="$owner" mode="assembly-id"/>
|
|
@@ -1817,15 +1830,15 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1817
1830
|
<!-- The pattern grammar does not permit variable references, so the -->
|
|
1818
1831
|
<!-- list of Runestone interactivity types is a literal, fenced string -->
|
|
1819
1832
|
<!-- repeated for each element that can carry one. Match exactly -->
|
|
1820
|
-
<!-- whenever @exercise-interactive is one of the fenced values.
|
|
1833
|
+
<!-- whenever @pi:exercise-interactive is one of the fenced values. -->
|
|
1821
1834
|
<!-- NB: also consulted in Runestone manifest creation. -->
|
|
1822
1835
|
|
|
1823
|
-
<xsl:template match="exercise[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1824
|
-
| project[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1825
|
-
| activity[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1826
|
-
| exploration[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1827
|
-
| investigation[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]
|
|
1828
|
-
| task[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @exercise-interactive, '|'))]" mode="representations">
|
|
1836
|
+
<xsl:template match="exercise[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1837
|
+
| project[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1838
|
+
| activity[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1839
|
+
| exploration[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1840
|
+
| investigation[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]
|
|
1841
|
+
| task[contains('|truefalse|multiplechoice|parson|parson-horizontal|cardsort|matching|clickablearea|fillin-basic|fillin|coding|shortanswer|', concat('|', @pi:exercise-interactive, '|'))]" mode="representations">
|
|
1829
1842
|
<!-- always preserve "exercise/project" container here, with attributes -->
|
|
1830
1843
|
<xsl:copy>
|
|
1831
1844
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
@@ -1835,7 +1848,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1835
1848
|
<!-- for use naturally by most conversions -->
|
|
1836
1849
|
<xsl:when test="$exercise-style = 'static'">
|
|
1837
1850
|
<!-- overwrite classification as purely static now -->
|
|
1838
|
-
<xsl:attribute name="exercise-interactive">
|
|
1851
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1839
1852
|
<xsl:text>static</xsl:text>
|
|
1840
1853
|
</xsl:attribute>
|
|
1841
1854
|
<xsl:apply-templates select="." mode="runestone-to-static"/>
|
|
@@ -1852,18 +1865,18 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1852
1865
|
<!-- assembling for dynamic exercises, and not hosting on Runestone, go instead -->
|
|
1853
1866
|
<!-- with the static version. We have three scenarios, handled with variations. -->
|
|
1854
1867
|
<!-- Note that these matches have been carved out from the above massive match. -->
|
|
1855
|
-
<xsl:template match="exercise[(@exercise-interactive = 'select')]
|
|
1856
|
-
| project[(@exercise-interactive = 'select')]
|
|
1857
|
-
| activity[(@exercise-interactive = 'select')]
|
|
1858
|
-
| exploration[(@exercise-interactive = 'select')]
|
|
1859
|
-
| investigation[(@exercise-interactive = 'select')]
|
|
1860
|
-
| task[(@exercise-interactive = 'select')]" mode="representations">
|
|
1868
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'select')]
|
|
1869
|
+
| project[(@pi:exercise-interactive = 'select')]
|
|
1870
|
+
| activity[(@pi:exercise-interactive = 'select')]
|
|
1871
|
+
| exploration[(@pi:exercise-interactive = 'select')]
|
|
1872
|
+
| investigation[(@pi:exercise-interactive = 'select')]
|
|
1873
|
+
| task[(@pi:exercise-interactive = 'select')]" mode="representations">
|
|
1861
1874
|
<xsl:copy>
|
|
1862
1875
|
<xsl:choose>
|
|
1863
1876
|
<xsl:when test="($exercise-style = 'static')">
|
|
1864
1877
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
1865
1878
|
<!-- overwrite classification as purely static now -->
|
|
1866
|
-
<xsl:attribute name="exercise-interactive">
|
|
1879
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1867
1880
|
<xsl:text>static</xsl:text>
|
|
1868
1881
|
</xsl:attribute>
|
|
1869
1882
|
<xsl:apply-templates select="." mode="runestone-to-static"/>
|
|
@@ -1873,7 +1886,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1873
1886
|
<xsl:when test="($exercise-style = 'dynamic') and not($b-host-runestone)">
|
|
1874
1887
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
1875
1888
|
<!-- overwrite classification as purely static now -->
|
|
1876
|
-
<xsl:attribute name="exercise-interactive">
|
|
1889
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1877
1890
|
<xsl:text>static</xsl:text>
|
|
1878
1891
|
</xsl:attribute>
|
|
1879
1892
|
<xsl:apply-templates select="." mode="runestone-to-static"/>
|
|
@@ -1889,18 +1902,18 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1889
1902
|
|
|
1890
1903
|
<!-- dual copy (not copy-of) -->
|
|
1891
1904
|
|
|
1892
|
-
<xsl:template match="exercise[(@exercise-interactive = 'dual')]
|
|
1893
|
-
| project[(@exercise-interactive = 'dual')]
|
|
1894
|
-
| activity[(@exercise-interactive = 'dual')]
|
|
1895
|
-
| exploration[(@exercise-interactive = 'dual')]
|
|
1896
|
-
| investigation[(@exercise-interactive = 'dual')]
|
|
1897
|
-
| task[(@exercise-interactive = 'dual')]" mode="representations">
|
|
1905
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'dual')]
|
|
1906
|
+
| project[(@pi:exercise-interactive = 'dual')]
|
|
1907
|
+
| activity[(@pi:exercise-interactive = 'dual')]
|
|
1908
|
+
| exploration[(@pi:exercise-interactive = 'dual')]
|
|
1909
|
+
| investigation[(@pi:exercise-interactive = 'dual')]
|
|
1910
|
+
| task[(@pi:exercise-interactive = 'dual')]" mode="representations">
|
|
1898
1911
|
<xsl:copy>
|
|
1899
1912
|
<xsl:apply-templates select="@*" mode="representations"/>
|
|
1900
1913
|
<xsl:choose>
|
|
1901
1914
|
<xsl:when test="($exercise-style = 'static')">
|
|
1902
1915
|
<!-- make a "static" classification, over-writing a "dual" -->
|
|
1903
|
-
<xsl:attribute name="exercise-interactive">
|
|
1916
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
1904
1917
|
<xsl:text>static</xsl:text>
|
|
1905
1918
|
</xsl:attribute>
|
|
1906
1919
|
<!-- copy overall title and idx, METADATA-FILTER feels too broad -->
|
|
@@ -1917,24 +1930,24 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1917
1930
|
</xsl:template>
|
|
1918
1931
|
|
|
1919
1932
|
|
|
1920
|
-
<!-- Static (non-interactive)
|
|
1921
|
-
<!-- @exercise-interactive = 'static' needs no adjustments -->
|
|
1933
|
+
<!-- Static (non-interactive) -->
|
|
1934
|
+
<!-- @pi:exercise-interactive = 'static' needs no adjustments -->
|
|
1922
1935
|
|
|
1923
1936
|
<!-- Mine webwork-reps for relevant application -->
|
|
1924
1937
|
|
|
1925
1938
|
<!-- WeBWorK exercises retain a "webwork" child element through the -->
|
|
1926
1939
|
<!-- pipeline. Here in the representations pass, we look up the -->
|
|
1927
1940
|
<!-- corresponding "webwork-reps" from the representations file using -->
|
|
1928
|
-
<!-- the parent exercise's @assembly-id, and substitute it in place
|
|
1941
|
+
<!-- the parent exercise's @pi:assembly-id, and substitute it in place -->
|
|
1929
1942
|
<!-- of the "webwork" element. We then split three ways, for PGML, -->
|
|
1930
1943
|
<!-- static, and dynamic (HTML) employment, via modal templates. -->
|
|
1931
1944
|
<!-- During extraction, the "webwork" child is left intact. -->
|
|
1932
1945
|
<!-- NB: including "task" though this may not be supported. -->
|
|
1933
|
-
<xsl:template match="exercise[(@exercise-interactive = 'webwork')]
|
|
1934
|
-
| project[(@exercise-interactive = 'webwork')]
|
|
1935
|
-
| activity[(@exercise-interactive = 'webwork')]
|
|
1936
|
-
| exploration[(@exercise-interactive = 'webwork')]
|
|
1937
|
-
| investigation[(@exercise-interactive = 'webwork')]" mode="representations">
|
|
1946
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'webwork')]
|
|
1947
|
+
| project[(@pi:exercise-interactive = 'webwork')]
|
|
1948
|
+
| activity[(@pi:exercise-interactive = 'webwork')]
|
|
1949
|
+
| exploration[(@pi:exercise-interactive = 'webwork')]
|
|
1950
|
+
| investigation[(@pi:exercise-interactive = 'webwork')]" mode="representations">
|
|
1938
1951
|
<xsl:choose>
|
|
1939
1952
|
<!-- During extraction, pass through the exercise with its -->
|
|
1940
1953
|
<!-- "webwork" child intact for the extraction stylesheet -->
|
|
@@ -1946,9 +1959,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1946
1959
|
</xsl:when>
|
|
1947
1960
|
<xsl:otherwise>
|
|
1948
1961
|
<!-- Load the per-exercise representation file for this -->
|
|
1949
|
-
<!-- exercise, identified by its @assembly-id.
|
|
1962
|
+
<!-- exercise, identified by its @pi:assembly-id. -->
|
|
1950
1963
|
<xsl:variable name="webwork-rep-uri"
|
|
1951
|
-
select="concat($webwork-representations-dir, @assembly-id, '.xml')"/>
|
|
1964
|
+
select="concat($webwork-representations-dir, @pi:assembly-id, '.xml')"/>
|
|
1952
1965
|
<xsl:variable name="the-webwork-rep"
|
|
1953
1966
|
select="document($webwork-rep-uri, $original)/webwork-reps"/>
|
|
1954
1967
|
<xsl:choose>
|
|
@@ -1960,14 +1973,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1960
1973
|
<xsl:copy>
|
|
1961
1974
|
<xsl:apply-templates select="node()|@*" mode="representations"/>
|
|
1962
1975
|
</xsl:copy>
|
|
1963
|
-
<xsl:message>PTX:ERROR: no WeBWorK representations directory configured in the publication file; WeBWorK exercise with @assembly-id "<xsl:value-of select="@assembly-id"/>" will be empty.</xsl:message>
|
|
1976
|
+
<xsl:message>PTX:ERROR: no WeBWorK representations directory configured in the publication file; WeBWorK exercise with @pi:assembly-id "<xsl:value-of select="@pi:assembly-id"/>" will be empty.</xsl:message>
|
|
1964
1977
|
</xsl:when>
|
|
1965
1978
|
<!-- This should only fail if the file is missing or stale. Repeatedly. -->
|
|
1966
1979
|
<xsl:when test="not($the-webwork-rep)">
|
|
1967
1980
|
<xsl:copy>
|
|
1968
1981
|
<xsl:apply-templates select="node()|@*" mode="representations"/>
|
|
1969
1982
|
</xsl:copy>
|
|
1970
|
-
<xsl:message>PTX:ERROR: could not load WeBWorK representation file "<xsl:value-of select="$webwork-rep-uri"/>" for @assembly-id "<xsl:value-of select="@assembly-id"/>"; re-generate the WeBWorK representations. A "webwork-representations.xml" in that directory indicates old-format files that need replacing.</xsl:message>
|
|
1983
|
+
<xsl:message>PTX:ERROR: could not load WeBWorK representation file "<xsl:value-of select="$webwork-rep-uri"/>" for @pi:assembly-id "<xsl:value-of select="@pi:assembly-id"/>"; re-generate the WeBWorK representations. A "webwork-representations.xml" in that directory indicates old-format files that need replacing.</xsl:message>
|
|
1971
1984
|
</xsl:when>
|
|
1972
1985
|
<xsl:otherwise>
|
|
1973
1986
|
<!-- The representation file may record a server failure -->
|
|
@@ -1977,7 +1990,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1977
1990
|
<!-- but warn the author so the failure does not go -->
|
|
1978
1991
|
<!-- unnoticed in later builds. -->
|
|
1979
1992
|
<xsl:if test="$the-webwork-rep/static/@failure">
|
|
1980
|
-
<xsl:message>PTX:WARNING: the WeBWorK problem with @assembly-id "<xsl:value-of select="@assembly-id"/>" has a stored "<xsl:value-of select="$the-webwork-rep/static/@failure"/>" failure recorded when the WeBWorK representations were last generated. A placeholder is being rendered in its place. Re-generate the WeBWorK representations (and watch for errors) to retry.</xsl:message>
|
|
1993
|
+
<xsl:message>PTX:WARNING: the WeBWorK problem with @pi:assembly-id "<xsl:value-of select="@pi:assembly-id"/>" has a stored "<xsl:value-of select="$the-webwork-rep/static/@failure"/>" failure recorded when the WeBWorK representations were last generated. A placeholder is being rendered in its place. Re-generate the WeBWorK representations (and watch for errors) to retry.</xsl:message>
|
|
1981
1994
|
</xsl:if>
|
|
1982
1995
|
<!-- Build a temporary exercise with "webwork-reps" from the -->
|
|
1983
1996
|
<!-- representations file substituted in place of "webwork". -->
|
|
@@ -2015,7 +2028,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2015
2028
|
<xsl:when test="$exercise-style = 'static'">
|
|
2016
2029
|
<xsl:copy>
|
|
2017
2030
|
<xsl:apply-templates select="@*" mode="webwork-rep-to-static"/>
|
|
2018
|
-
<xsl:attribute name="exercise-interactive">
|
|
2031
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
2019
2032
|
<xsl:text>static</xsl:text>
|
|
2020
2033
|
</xsl:attribute>
|
|
2021
2034
|
<xsl:apply-templates select="$exercise-with-reps/node()" mode="webwork-rep-to-static"/>
|
|
@@ -2262,11 +2275,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2262
2275
|
<!-- PreTeXt introduction and conclusion, into a "regular" PreTeXt -->
|
|
2263
2276
|
<!-- format, for any conversion to a static format to use. -->
|
|
2264
2277
|
<!-- NB: very similar to STACK template below -->
|
|
2265
|
-
<xsl:template match="exercise[(@exercise-interactive = 'myopenmath')]
|
|
2266
|
-
| project[(@exercise-interactive = 'myopenmath')]
|
|
2267
|
-
| activity[(@exercise-interactive = 'myopenmath')]
|
|
2268
|
-
| exploration[(@exercise-interactive = 'myopenmath')]
|
|
2269
|
-
| investigation[(@exercise-interactive = 'myopenmath')]" mode="representations">
|
|
2278
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'myopenmath')]
|
|
2279
|
+
| project[(@pi:exercise-interactive = 'myopenmath')]
|
|
2280
|
+
| activity[(@pi:exercise-interactive = 'myopenmath')]
|
|
2281
|
+
| exploration[(@pi:exercise-interactive = 'myopenmath')]
|
|
2282
|
+
| investigation[(@pi:exercise-interactive = 'myopenmath')]" mode="representations">
|
|
2270
2283
|
<!-- duplicate the exercise/project -->
|
|
2271
2284
|
<xsl:copy>
|
|
2272
2285
|
<!-- and preserve attributes on the exercise/project -->
|
|
@@ -2275,7 +2288,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2275
2288
|
<xsl:choose>
|
|
2276
2289
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
2277
2290
|
<!-- overwrite classification as purely static now -->
|
|
2278
|
-
<xsl:attribute name="exercise-interactive">
|
|
2291
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
2279
2292
|
<xsl:text>static</xsl:text>
|
|
2280
2293
|
</xsl:attribute>
|
|
2281
2294
|
<!-- locate the static representation in a file, generated independently -->
|
|
@@ -2288,7 +2301,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2288
2301
|
<xsl:value-of select="myopenmath/@problem"/>
|
|
2289
2302
|
<xsl:text>.xml</xsl:text>
|
|
2290
2303
|
</xsl:variable>
|
|
2291
|
-
<!-- "myopenmath" child guaranteed by @exercise-interactive value -->
|
|
2304
|
+
<!-- "myopenmath" child guaranteed by @pi:exercise-interactive value -->
|
|
2292
2305
|
<xsl:variable name="mom-static-rep" select="document($filename, $original)/myopenmath"/>
|
|
2293
2306
|
<!-- duplicate metadata first -->
|
|
2294
2307
|
<xsl:apply-templates select="title|idx" mode="representations"/>
|
|
@@ -2322,11 +2335,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2322
2335
|
<!-- PreTeXt introduction and conclusion, into a "regular" PreTeXt -->
|
|
2323
2336
|
<!-- format, for any conversion to a static format to use. -->
|
|
2324
2337
|
<!-- NB: very similar to MyOpenMath template above -->
|
|
2325
|
-
<xsl:template match="exercise[(@exercise-interactive = 'stack')]
|
|
2326
|
-
| project[(@exercise-interactive = 'stack')]
|
|
2327
|
-
| activity[(@exercise-interactive = 'stack')]
|
|
2328
|
-
| exploration[(@exercise-interactive = 'stack')]
|
|
2329
|
-
| investigation[(@exercise-interactive = 'stack')]" mode="representations">
|
|
2338
|
+
<xsl:template match="exercise[(@pi:exercise-interactive = 'stack')]
|
|
2339
|
+
| project[(@pi:exercise-interactive = 'stack')]
|
|
2340
|
+
| activity[(@pi:exercise-interactive = 'stack')]
|
|
2341
|
+
| exploration[(@pi:exercise-interactive = 'stack')]
|
|
2342
|
+
| investigation[(@pi:exercise-interactive = 'stack')]" mode="representations">
|
|
2330
2343
|
<!-- duplicate the exercise/project -->
|
|
2331
2344
|
<xsl:copy>
|
|
2332
2345
|
<!-- and preserve attributes on the exercise/project -->
|
|
@@ -2335,7 +2348,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2335
2348
|
<xsl:choose>
|
|
2336
2349
|
<xsl:when test="($exercise-style = 'static') and not($b-extracting)">
|
|
2337
2350
|
<!-- overwrite classification as purely static now -->
|
|
2338
|
-
<xsl:attribute name="exercise-interactive">
|
|
2351
|
+
<xsl:attribute name="pi:exercise-interactive">
|
|
2339
2352
|
<xsl:text>static</xsl:text>
|
|
2340
2353
|
</xsl:attribute>
|
|
2341
2354
|
<!-- locate the static representation in a file, generated independently -->
|
|
@@ -2416,7 +2429,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2416
2429
|
<!-- Read pre-computed URLs from sidecar file -->
|
|
2417
2430
|
<!-- But not if doing an extraction -->
|
|
2418
2431
|
<xsl:variable name="url-file"
|
|
2419
|
-
select="document(concat($generated-directory-source, 'qrcode/', @assembly-id, '-url.xml'), $original)"/>
|
|
2432
|
+
select="document(concat($generated-directory-source, 'qrcode/', @pi:assembly-id, '-url.xml'), $original)"/>
|
|
2420
2433
|
<!-- panel widths are experimental -->
|
|
2421
2434
|
<sidebyside margins="7.5% 7.5%" widths="47% 21%" valign="top" halign="center">
|
|
2422
2435
|
<!-- copy over @xml:id, which may be in use by -->
|
|
@@ -3065,11 +3078,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3065
3078
|
</xsl:if>
|
|
3066
3079
|
</xsl:template>
|
|
3067
3080
|
|
|
3068
|
-
<!-- 2025-08-15: Ensure that interactives all have a @interactive-platform -->
|
|
3069
|
-
<!-- that identifies their basic type
|
|
3081
|
+
<!-- 2025-08-15: Ensure that interactives all have a @pi:interactive-platform -->
|
|
3082
|
+
<!-- that identifies their basic type -->
|
|
3070
3083
|
<xsl:template match="interactive" mode="repair">
|
|
3071
3084
|
<xsl:copy>
|
|
3072
|
-
<xsl:attribute name="interactive-platform">
|
|
3085
|
+
<xsl:attribute name="pi:interactive-platform">
|
|
3073
3086
|
<xsl:choose>
|
|
3074
3087
|
<xsl:when test="@platform">
|
|
3075
3088
|
<xsl:value-of select="@platform"/>
|
|
@@ -3575,8 +3588,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3575
3588
|
<!-- done with attributes, copy the content -->
|
|
3576
3589
|
<xsl:apply-templates select="node()" mode="enrichment"/>
|
|
3577
3590
|
<slate>
|
|
3591
|
+
<!-- A manufactured "slate" carries a genuine @xml:id (not a -->
|
|
3592
|
+
<!-- pi: stamp): the interactive machinery locates slates by -->
|
|
3593
|
+
<!-- id, and the derived name keeps it stable and -->
|
|
3594
|
+
<!-- collision-free. -->
|
|
3578
3595
|
<xsl:attribute name="xml:id">
|
|
3579
|
-
<xsl:value-of select="@assembly-id"/>
|
|
3596
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
3580
3597
|
<xsl:text>-ggb-slate</xsl:text>
|
|
3581
3598
|
</xsl:attribute>
|
|
3582
3599
|
<xsl:attribute name="surface">
|
|
@@ -3605,11 +3622,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3605
3622
|
<!-- The "labels" pass (pass 11). It promotes an authored -->
|
|
3606
3623
|
<!-- @xml:id to @label and records localization support. It is -->
|
|
3607
3624
|
<!-- deliberately separate from the id-attribute mechanism in -->
|
|
3608
|
-
<!-- "Identification": it runs after @assembly-id is stamped and
|
|
3609
|
-
<!-- before @unique-id, and the @label values created here are
|
|
3610
|
-
<!-- read by that final @unique-id stamp.
|
|
3625
|
+
<!-- "Identification": it runs after @pi:assembly-id is stamped and-->
|
|
3626
|
+
<!-- before @pi:unique-id, and the @label values created here are -->
|
|
3627
|
+
<!-- read by that final @pi:unique-id stamp. -->
|
|
3611
3628
|
|
|
3612
|
-
<!--
|
|
3629
|
+
<!-- Reader-facing identification switched to prefer @label, -->
|
|
3613
3630
|
<!-- rather than @xml:id (at 1779e6dbc84c6ecc). So to preserve -->
|
|
3614
3631
|
<!-- authored (crafted) identifier strings, we copy the old over -->
|
|
3615
3632
|
<!-- into the new. This preserves identifiers in output -->
|
|
@@ -3665,7 +3682,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3665
3682
|
<!-- So we drop an (empty) attribute as a boolean indicator. -->
|
|
3666
3683
|
<!-- This form will simplify checks later at "run-time". -->
|
|
3667
3684
|
<xsl:if test="@label">
|
|
3668
|
-
<xsl:attribute name="authored-label"/>
|
|
3685
|
+
<xsl:attribute name="pi:authored-label"/>
|
|
3669
3686
|
</xsl:if>
|
|
3670
3687
|
<!-- A supported @xml:lang is recorded in an internal attribute -->
|
|
3671
3688
|
<!-- for use by localizations. The root element is the -->
|
|
@@ -3675,7 +3692,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3675
3692
|
<!-- alone, as it might be relevant for future features. -->
|
|
3676
3693
|
<xsl:choose>
|
|
3677
3694
|
<xsl:when test="@xml:lang = $locales">
|
|
3678
|
-
<xsl:attribute name="locale-lang">
|
|
3695
|
+
<xsl:attribute name="pi:locale-lang">
|
|
3679
3696
|
<xsl:value-of select="@xml:lang"/>
|
|
3680
3697
|
</xsl:attribute>
|
|
3681
3698
|
</xsl:when>
|
|
@@ -3683,7 +3700,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3683
3700
|
<xsl:attribute name="xml:lang">
|
|
3684
3701
|
<xsl:text>en-US</xsl:text>
|
|
3685
3702
|
</xsl:attribute>
|
|
3686
|
-
<xsl:attribute name="locale-lang">
|
|
3703
|
+
<xsl:attribute name="pi:locale-lang">
|
|
3687
3704
|
<xsl:text>en-US</xsl:text>
|
|
3688
3705
|
</xsl:attribute>
|
|
3689
3706
|
</xsl:when>
|
|
@@ -3773,43 +3790,43 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3773
3790
|
<!-- Languages -->
|
|
3774
3791
|
<!-- ######### -->
|
|
3775
3792
|
|
|
3776
|
-
<!-- The variable $locales is a node-set of all the locales which have
|
|
3777
|
-
<!-- supported localization files. A comparison of an @xml:lang (string)
|
|
3778
|
-
<!-- with $locales (node-set) will be true if the attribute value is a
|
|
3779
|
-
<!-- string value of one of the nodes in the node-set. So it is easy to
|
|
3780
|
-
<!-- create a boolean value for localization support.
|
|
3781
|
-
<!-- The recording of language support in @locale-lang attributes is part -->
|
|
3782
|
-
<!-- of the "labels" pass, since both jobs are simple attribute additions
|
|
3783
|
-
<!-- and do not deserve separate passes through the entire source.
|
|
3793
|
+
<!-- The variable $locales is a node-set of all the locales which have -->
|
|
3794
|
+
<!-- supported localization files. A comparison of an @xml:lang (string) -->
|
|
3795
|
+
<!-- with $locales (node-set) will be true if the attribute value is a -->
|
|
3796
|
+
<!-- string value of one of the nodes in the node-set. So it is easy to -->
|
|
3797
|
+
<!-- create a boolean value for localization support. -->
|
|
3798
|
+
<!-- The recording of language support in @pi:locale-lang attributes is part -->
|
|
3799
|
+
<!-- of the "labels" pass, since both jobs are simple attribute additions -->
|
|
3800
|
+
<!-- and do not deserve separate passes through the entire source. -->
|
|
3784
3801
|
<xsl:variable name="locales" select="document('localizations/localizations.xml')/localizations/locale" />
|
|
3785
3802
|
|
|
3786
3803
|
<!-- ######### -->
|
|
3787
3804
|
<!-- Numbering -->
|
|
3788
3805
|
<!-- ######### -->
|
|
3789
3806
|
|
|
3790
|
-
<!-- We use the "augment" pass to compute, and add, partially naïve
|
|
3791
|
-
<!-- information about numbers of objects, to be interpreted later by
|
|
3792
|
-
<!-- templates in the "-common" stylesheet. By "naïve" we mean that
|
|
3793
|
-
<!-- these routines may depend on publisher variables (e.g. specification
|
|
3794
|
-
<!-- of roots of subtrees for serial numbers of blocks) but do not depend
|
|
3795
|
-
<!-- on subtlties of numbering (such as the structured/unstructured
|
|
3796
|
-
<!-- division dichotomy), which are addressed in the "-common" stylesheet.
|
|
3797
|
-
<!-- In this way, this information could be interpreted in new ways by
|
|
3798
|
-
<!-- additional conversions.
|
|
3799
|
-
<!--
|
|
3800
|
-
<!-- The manufactured @struct attribute is the (naïve) hierarchical number -->
|
|
3801
|
-
<!-- of the *container* of an element, known as the "structure number"
|
|
3802
|
-
<!-- of an element. The @serial attribute is the computed serial number -->
|
|
3803
|
-
<!-- of the element, known as the "serial number". Typically combining
|
|
3804
|
-
<!-- these two attributes forms teh number of an element. As many
|
|
3805
|
-
<!-- practical subtleties about these numbers is delayed until their
|
|
3806
|
-
<!-- interpretation by templates in the "-common" stylesheet.
|
|
3807
|
+
<!-- We use the "augment" pass to compute, and add, partially naïve -->
|
|
3808
|
+
<!-- information about numbers of objects, to be interpreted later by -->
|
|
3809
|
+
<!-- templates in the "-common" stylesheet. By "naïve" we mean that -->
|
|
3810
|
+
<!-- these routines may depend on publisher variables (e.g. specification -->
|
|
3811
|
+
<!-- of roots of subtrees for serial numbers of blocks) but do not depend -->
|
|
3812
|
+
<!-- on subtlties of numbering (such as the structured/unstructured -->
|
|
3813
|
+
<!-- division dichotomy), which are addressed in the "-common" stylesheet. -->
|
|
3814
|
+
<!-- In this way, this information could be interpreted in new ways by -->
|
|
3815
|
+
<!-- additional conversions. -->
|
|
3816
|
+
<!-- -->
|
|
3817
|
+
<!-- The manufactured @pi:struct attribute is the (naïve) hierarchical number -->
|
|
3818
|
+
<!-- of the *container* of an element, known as the "structure number" -->
|
|
3819
|
+
<!-- of an element. The @pi:serial attribute is the computed serial number -->
|
|
3820
|
+
<!-- of the element, known as the "serial number". Typically combining -->
|
|
3821
|
+
<!-- these two attributes forms teh number of an element. As many -->
|
|
3822
|
+
<!-- practical subtleties about these numbers is delayed until their -->
|
|
3823
|
+
<!-- interpretation by templates in the "-common" stylesheet. -->
|
|
3807
3824
|
|
|
3808
3825
|
<!-- For every type of division, everywhere, the "division-serial-number" -->
|
|
3809
3826
|
<!-- modal template will return a count of preceding peers at that level. -->
|
|
3810
|
-
<!-- The @struct attribute is the structure number of the *parent*
|
|
3827
|
+
<!-- The @pi:struct attribute is the structure number of the *parent* -->
|
|
3811
3828
|
<!-- (container), which seems odd here, but fits the general scheme better. -->
|
|
3812
|
-
<!-- The @level attribute is helpful, and trvislly to compute here.
|
|
3829
|
+
<!-- The @pi:level attribute is helpful, and trvislly to compute here. -->
|
|
3813
3830
|
<xsl:template match="part|chapter|appendix|section|subsection|subsubsection|exercises|solutions|reading-questions|references|glossary|worksheet|handout" mode="augment">
|
|
3814
3831
|
<xsl:param name="parent-struct"/>
|
|
3815
3832
|
<xsl:param name="level"/>
|
|
@@ -3835,7 +3852,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3835
3852
|
<!-- blocks inside them use the parent division's chain. -->
|
|
3836
3853
|
<!-- Specialized divisions are leaves of the division -->
|
|
3837
3854
|
<!-- tree, so this does not affect any descendant -->
|
|
3838
|
-
<!-- division's @struct.
|
|
3855
|
+
<!-- division's @pi:struct. -->
|
|
3839
3856
|
<xsl:when test="&SPECIALIZED-DIVISION-FILTER;">
|
|
3840
3857
|
<xsl:variable name="is-numbered">
|
|
3841
3858
|
<xsl:apply-templates select="." mode="is-specialized-own-number"/>
|
|
@@ -3874,20 +3891,20 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3874
3891
|
</xsl:choose>
|
|
3875
3892
|
</xsl:variable>
|
|
3876
3893
|
<xsl:copy>
|
|
3877
|
-
<xsl:attribute name="struct">
|
|
3894
|
+
<xsl:attribute name="pi:struct">
|
|
3878
3895
|
<xsl:value-of select="$parent-struct"/>
|
|
3879
3896
|
</xsl:attribute>
|
|
3880
|
-
<xsl:attribute name="serial">
|
|
3897
|
+
<xsl:attribute name="pi:serial">
|
|
3881
3898
|
<xsl:value-of select="$the-serial"/>
|
|
3882
3899
|
</xsl:attribute>
|
|
3883
|
-
<xsl:attribute name="level">
|
|
3900
|
+
<xsl:attribute name="pi:level">
|
|
3884
3901
|
<xsl:value-of select="$next-level"/>
|
|
3885
3902
|
</xsl:attribute>
|
|
3886
3903
|
<!-- Full structure chain including this division's -->
|
|
3887
3904
|
<!-- contribution. Decorative specialized divisions are -->
|
|
3888
3905
|
<!-- transparent (pass through parent's chain). Used by -->
|
|
3889
3906
|
<!-- block elements to compute their structure numbers. -->
|
|
3890
|
-
<xsl:attribute name="block-struct">
|
|
3907
|
+
<xsl:attribute name="pi:block-struct">
|
|
3891
3908
|
<xsl:value-of select="$new-struct"/>
|
|
3892
3909
|
</xsl:attribute>
|
|
3893
3910
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -3903,7 +3920,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3903
3920
|
<!-- A level-0 numbering scheme counts continuously from the root. -->
|
|
3904
3921
|
<xsl:template match="book|article|slideshow|letter|memo" mode="augment">
|
|
3905
3922
|
<xsl:copy>
|
|
3906
|
-
<xsl:attribute name="level">
|
|
3923
|
+
<xsl:attribute name="pi:level">
|
|
3907
3924
|
<xsl:text>0</xsl:text>
|
|
3908
3925
|
</xsl:attribute>
|
|
3909
3926
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -3936,7 +3953,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3936
3953
|
<!-- we only add a level (not necessary?) -->
|
|
3937
3954
|
<!-- and just pass along structure number -->
|
|
3938
3955
|
<xsl:copy>
|
|
3939
|
-
<xsl:attribute name="level">
|
|
3956
|
+
<xsl:attribute name="pi:level">
|
|
3940
3957
|
<xsl:value-of select="$next-level"/>
|
|
3941
3958
|
</xsl:attribute>
|
|
3942
3959
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -4023,16 +4040,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4023
4040
|
</xsl:choose>
|
|
4024
4041
|
</xsl:variable>
|
|
4025
4042
|
<xsl:copy>
|
|
4026
|
-
<xsl:attribute name="ordered-list-level">
|
|
4043
|
+
<xsl:attribute name="pi:ordered-list-level">
|
|
4027
4044
|
<xsl:value-of select="$ordered-list-level"/>
|
|
4028
4045
|
</xsl:attribute>
|
|
4029
|
-
<xsl:attribute name="format-code">
|
|
4046
|
+
<xsl:attribute name="pi:format-code">
|
|
4030
4047
|
<xsl:value-of select="$format-code"/>
|
|
4031
4048
|
</xsl:attribute>
|
|
4032
|
-
<xsl:attribute name="marker-prefix">
|
|
4049
|
+
<xsl:attribute name="pi:marker-prefix">
|
|
4033
4050
|
<xsl:value-of select="$marker-prefix"/>
|
|
4034
4051
|
</xsl:attribute>
|
|
4035
|
-
<xsl:attribute name="marker-suffix">
|
|
4052
|
+
<xsl:attribute name="pi:marker-suffix">
|
|
4036
4053
|
<xsl:value-of select="$marker-suffix"/>
|
|
4037
4054
|
</xsl:attribute>
|
|
4038
4055
|
<xsl:apply-templates select="node()|@*" mode="augment">
|
|
@@ -4045,7 +4062,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4045
4062
|
<!-- Serial Stamp Pass -->
|
|
4046
4063
|
<!-- ##################### -->
|
|
4047
4064
|
|
|
4048
|
-
<!-- Stamps @serial during assembly, in one depth-first walk. Each
|
|
4065
|
+
<!-- Stamps @pi:serial during assembly, in one depth-first walk. Each-->
|
|
4049
4066
|
<!-- numbered family (equations and footnotes) is threaded as a -->
|
|
4050
4067
|
<!-- node-set: its items in the current counting scope, and each item -->
|
|
4051
4068
|
<!-- is stamped with its position in that node-set. How a scope is -->
|
|
@@ -4066,7 +4083,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4066
4083
|
<!-- in the current scope) and hands its children the "next" one, built -->
|
|
4067
4084
|
<!-- from the inherited node-set: -->
|
|
4068
4085
|
|
|
4069
|
-
<!-- $b-open = not($nodes) and ($b-terminal or @level >= LEVEL)
|
|
4086
|
+
<!-- $b-open = not($nodes) and ($b-terminal or @pi:level >= LEVEL) -->
|
|
4070
4087
|
<!-- $next = $nodes | self::*[$b-open]//ITEMS -->
|
|
4071
4088
|
|
|
4072
4089
|
<!-- This is three cases. Already in a scope ($nodes non-empty): $b-open -->
|
|
@@ -4104,13 +4121,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4104
4121
|
<!-- children are specialized divisions is wrongly deemed terminal and -->
|
|
4105
4122
|
<!-- pools their blocks into one scope instead of one scope apiece. -->
|
|
4106
4123
|
<xsl:variable name="b-terminal" select="not(part|chapter|appendix|section|subsection|subsubsection|preface|exercises|worksheet|handout|reading-questions|references|glossary|solutions)"/>
|
|
4107
|
-
<xsl:variable name="b-open-eq" select="not($eq-nodes) and ($b-terminal or (@level >= $numbering-equations))"/>
|
|
4108
|
-
<xsl:variable name="b-open-fn" select="not($fn-nodes) and ($b-terminal or (@level >= $numbering-footnotes))"/>
|
|
4109
|
-
<xsl:variable name="b-open-blocks" select="not($blocks-nodes) and ($b-terminal or (@level >= $numbering-blocks))"/>
|
|
4110
|
-
<xsl:variable name="b-open-figure" select="$b-number-figure-distinct and not($figure-nodes) and ($b-terminal or (@level >= $numbering-figures))"/>
|
|
4111
|
-
<xsl:variable name="b-open-project" select="$b-number-project-distinct and not($project-nodes) and ($b-terminal or (@level >= $numbering-projects))"/>
|
|
4112
|
-
<xsl:variable name="b-open-exercise" select="$b-number-exercise-distinct and not($exercise-nodes) and ($b-terminal or (@level >= $numbering-exercises))"/>
|
|
4113
|
-
<xsl:variable name="b-open-openproblem" select="$b-number-openproblem-distinct and not($openproblem-nodes) and ($b-terminal or (@level >= $numbering-openproblems))"/>
|
|
4124
|
+
<xsl:variable name="b-open-eq" select="not($eq-nodes) and ($b-terminal or (@pi:level >= $numbering-equations))"/>
|
|
4125
|
+
<xsl:variable name="b-open-fn" select="not($fn-nodes) and ($b-terminal or (@pi:level >= $numbering-footnotes))"/>
|
|
4126
|
+
<xsl:variable name="b-open-blocks" select="not($blocks-nodes) and ($b-terminal or (@pi:level >= $numbering-blocks))"/>
|
|
4127
|
+
<xsl:variable name="b-open-figure" select="$b-number-figure-distinct and not($figure-nodes) and ($b-terminal or (@pi:level >= $numbering-figures))"/>
|
|
4128
|
+
<xsl:variable name="b-open-project" select="$b-number-project-distinct and not($project-nodes) and ($b-terminal or (@pi:level >= $numbering-projects))"/>
|
|
4129
|
+
<xsl:variable name="b-open-exercise" select="$b-number-exercise-distinct and not($exercise-nodes) and ($b-terminal or (@pi:level >= $numbering-exercises))"/>
|
|
4130
|
+
<xsl:variable name="b-open-openproblem" select="$b-number-openproblem-distinct and not($openproblem-nodes) and ($b-terminal or (@pi:level >= $numbering-openproblems))"/>
|
|
4114
4131
|
<xsl:variable name="next-eq" select="$eq-nodes | self::*[$b-open-eq]//mrow[@pi:numbered = 'yes']"/>
|
|
4115
4132
|
<xsl:variable name="next-fn" select="$fn-nodes | self::*[$b-open-fn]//fn"/>
|
|
4116
4133
|
<!-- The shared "blocks" pool also gathers figure-likes, projects, -->
|
|
@@ -4178,8 +4195,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4178
4195
|
</xsl:copy>
|
|
4179
4196
|
</xsl:template>
|
|
4180
4197
|
|
|
4181
|
-
<!-- Numbered mrow. Stamp @serial with the position within the -->
|
|
4182
|
-
<!-- inherited node-set.
|
|
4198
|
+
<!-- Numbered mrow. Stamp @pi:serial with the position within the -->
|
|
4199
|
+
<!-- inherited node-set. -->
|
|
4183
4200
|
<xsl:template match="mrow[@pi:numbered = 'yes']" mode="serial-stamp">
|
|
4184
4201
|
<xsl:param name="eq-nodes"/>
|
|
4185
4202
|
<xsl:param name="fn-nodes"/>
|
|
@@ -4189,7 +4206,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4189
4206
|
<xsl:param name="exercise-nodes"/>
|
|
4190
4207
|
<xsl:param name="openproblem-nodes"/>
|
|
4191
4208
|
<xsl:copy>
|
|
4192
|
-
<xsl:attribute name="serial">
|
|
4209
|
+
<xsl:attribute name="pi:serial">
|
|
4193
4210
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4194
4211
|
<xsl:with-param name="nodes" select="$eq-nodes"/>
|
|
4195
4212
|
</xsl:apply-templates>
|
|
@@ -4206,8 +4223,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4206
4223
|
</xsl:copy>
|
|
4207
4224
|
</xsl:template>
|
|
4208
4225
|
|
|
4209
|
-
<!-- Every fn is numbered. Stamp @serial with the position -->
|
|
4210
|
-
<!-- within the inherited footnote node-set.
|
|
4226
|
+
<!-- Every fn is numbered. Stamp @pi:serial with the position -->
|
|
4227
|
+
<!-- within the inherited footnote node-set. -->
|
|
4211
4228
|
<xsl:template match="fn" mode="serial-stamp">
|
|
4212
4229
|
<xsl:param name="eq-nodes"/>
|
|
4213
4230
|
<xsl:param name="fn-nodes"/>
|
|
@@ -4217,7 +4234,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4217
4234
|
<xsl:param name="exercise-nodes"/>
|
|
4218
4235
|
<xsl:param name="openproblem-nodes"/>
|
|
4219
4236
|
<xsl:copy>
|
|
4220
|
-
<xsl:attribute name="serial">
|
|
4237
|
+
<xsl:attribute name="pi:serial">
|
|
4221
4238
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4222
4239
|
<xsl:with-param name="nodes" select="$fn-nodes"/>
|
|
4223
4240
|
</xsl:apply-templates>
|
|
@@ -4236,7 +4253,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4236
4253
|
|
|
4237
4254
|
<!-- Block stamps: serial from the group's distinct counter, else the shared "blocks". -->
|
|
4238
4255
|
<!-- A subnumbered side-by-side panel is not a "top" figure, so it falls to the -->
|
|
4239
|
-
<!-- catch-all (no @serial) and earns a letter downstream instead.
|
|
4256
|
+
<!-- catch-all (no @pi:serial) and earns a letter downstream instead. -->
|
|
4240
4257
|
|
|
4241
4258
|
<!-- Fundamental blocks always share the "blocks" counter. -->
|
|
4242
4259
|
<xsl:template match="&DEFINITION-LIKE;|&THEOREM-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&EXAMPLE-LIKE;" mode="serial-stamp">
|
|
@@ -4248,7 +4265,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4248
4265
|
<xsl:param name="exercise-nodes"/>
|
|
4249
4266
|
<xsl:param name="openproblem-nodes"/>
|
|
4250
4267
|
<xsl:copy>
|
|
4251
|
-
<xsl:attribute name="serial">
|
|
4268
|
+
<xsl:attribute name="pi:serial">
|
|
4252
4269
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4253
4270
|
<xsl:with-param name="nodes" select="$blocks-nodes"/>
|
|
4254
4271
|
</xsl:apply-templates>
|
|
@@ -4275,7 +4292,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4275
4292
|
<xsl:param name="exercise-nodes"/>
|
|
4276
4293
|
<xsl:param name="openproblem-nodes"/>
|
|
4277
4294
|
<xsl:copy>
|
|
4278
|
-
<xsl:attribute name="serial">
|
|
4295
|
+
<xsl:attribute name="pi:serial">
|
|
4279
4296
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4280
4297
|
<xsl:with-param name="nodes" select="$project-nodes[$b-number-project-distinct] | $blocks-nodes[not($b-number-project-distinct)]"/>
|
|
4281
4298
|
</xsl:apply-templates>
|
|
@@ -4302,7 +4319,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4302
4319
|
<xsl:param name="exercise-nodes"/>
|
|
4303
4320
|
<xsl:param name="openproblem-nodes"/>
|
|
4304
4321
|
<xsl:copy>
|
|
4305
|
-
<xsl:attribute name="serial">
|
|
4322
|
+
<xsl:attribute name="pi:serial">
|
|
4306
4323
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4307
4324
|
<xsl:with-param name="nodes" select="$figure-nodes[$b-number-figure-distinct] | $blocks-nodes[not($b-number-figure-distinct)]"/>
|
|
4308
4325
|
</xsl:apply-templates>
|
|
@@ -4329,7 +4346,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4329
4346
|
<xsl:param name="exercise-nodes"/>
|
|
4330
4347
|
<xsl:param name="openproblem-nodes"/>
|
|
4331
4348
|
<xsl:copy>
|
|
4332
|
-
<xsl:attribute name="serial">
|
|
4349
|
+
<xsl:attribute name="pi:serial">
|
|
4333
4350
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4334
4351
|
<xsl:with-param name="nodes" select="$exercise-nodes[$b-number-exercise-distinct] | $blocks-nodes[not($b-number-exercise-distinct)]"/>
|
|
4335
4352
|
</xsl:apply-templates>
|
|
@@ -4356,7 +4373,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4356
4373
|
<xsl:param name="exercise-nodes"/>
|
|
4357
4374
|
<xsl:param name="openproblem-nodes"/>
|
|
4358
4375
|
<xsl:copy>
|
|
4359
|
-
<xsl:attribute name="serial">
|
|
4376
|
+
<xsl:attribute name="pi:serial">
|
|
4360
4377
|
<xsl:apply-templates select="." mode="position-in-node-set">
|
|
4361
4378
|
<xsl:with-param name="nodes" select="$openproblem-nodes[$b-number-openproblem-distinct] | $blocks-nodes[not($b-number-openproblem-distinct)]"/>
|
|
4362
4379
|
</xsl:apply-templates>
|
|
@@ -4564,8 +4581,8 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4564
4581
|
<!-- ########### -->
|
|
4565
4582
|
|
|
4566
4583
|
<!-- Some maniulations of source require stable identification *before* -->
|
|
4567
|
-
<!-- we assign @unique-id values for general use in the very late
|
|
4568
|
-
<!-- "identification" phase. This is a role for the "@assembly-id" which
|
|
4584
|
+
<!-- we assign @pi:unique-id values for general use in the very late -->
|
|
4585
|
+
<!-- "identification" phase. This is a role for the "@pi:assembly-id" which-->
|
|
4569
4586
|
<!-- is formed after the author's source has been versioned, customized, -->
|
|
4570
4587
|
<!-- repaired, but before replacements. It should suffice for "big" objects -->
|
|
4571
4588
|
<!-- which are unlikely to change much (other than going away in a version) -->
|
|
@@ -4590,16 +4607,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4590
4607
|
<!-- order to make a sample of its content. This happens before we -->
|
|
4591
4608
|
<!-- construct unique-id. -->
|
|
4592
4609
|
|
|
4593
|
-
<!-- NB: we believe the @assembly-id will equal the @unique-id
|
|
4594
|
-
<!-- ("
|
|
4595
|
-
<!-- and certainly for any object replaced by a different static
|
|
4596
|
-
<!-- representation. But for generated objects, e.g. QR codes,
|
|
4597
|
-
<!-- it would be best if the generation process used the
|
|
4598
|
-
<!-- "assembly-id" template for guranteed consistency. This *is*
|
|
4599
|
-
<!-- being done for "datafile" but is technical debt otherwise.
|
|
4610
|
+
<!-- NB: we believe the @pi:assembly-id will equal the @pi:unique-id -->
|
|
4611
|
+
<!-- ("unique-id" template) for objects at the level of blocks, -->
|
|
4612
|
+
<!-- and certainly for any object replaced by a different static -->
|
|
4613
|
+
<!-- representation. But for generated objects, e.g. QR codes, -->
|
|
4614
|
+
<!-- it would be best if the generation process used the -->
|
|
4615
|
+
<!-- "assembly-id" template for guranteed consistency. This *is* -->
|
|
4616
|
+
<!-- being done for "datafile" but is technical debt otherwise. -->
|
|
4600
4617
|
|
|
4601
|
-
<!-- [Ed. this once prefaced
|
|
4602
|
-
<!--
|
|
4618
|
+
<!-- [Ed. this once prefaced an early, weak forerunner of the -->
|
|
4619
|
+
<!-- "assembly-id" template. But the commentary -->
|
|
4603
4620
|
<!-- is still good, so we have preserved it here.] -->
|
|
4604
4621
|
<!-- This template produces identification that happens early in the -->
|
|
4605
4622
|
<!-- passes this stylesheet executes. The idea is that some elements -->
|
|
@@ -4612,44 +4629,32 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4612
4629
|
<!-- we want the stylesheet to be independent, and the template is -->
|
|
4613
4630
|
<!-- also applied here. -->
|
|
4614
4631
|
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
|
4629
|
-
|
|
|
4630
|
-
|
|
|
4631
|
-
|
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
|
4640
|
-
|
|
4641
|
-
| exploration//task[@exercise-interactive='fillin' and setup]
|
|
4642
|
-
| investigation//task[@exercise-interactive='fillin' and setup]"
|
|
4643
|
-
mode="assembly-id">
|
|
4644
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4645
|
-
</xsl:template>
|
|
4646
|
-
|
|
4647
|
-
<xsl:template match="datafile" mode="assembly-id">
|
|
4648
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4649
|
-
</xsl:template>
|
|
4650
|
-
|
|
4651
|
-
<xsl:template match="exercise/stack" mode="assembly-id">
|
|
4652
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4632
|
+
<!-- Every element carrying an "@pi:assembly-id" stamp reports it -->
|
|
4633
|
+
<!-- through this single template. The match list is deliberately -->
|
|
4634
|
+
<!-- explicit — media and images, data files, STACK problems, and -->
|
|
4635
|
+
<!-- the fill-in dynamic-substitution owners (the exercise-like -->
|
|
4636
|
+
<!-- elements, or a "task" they contain, whichever holds "setup") -->
|
|
4637
|
+
<!-- — so the BUG fallback below can catch an unexpected -->
|
|
4638
|
+
<!-- application. -->
|
|
4639
|
+
<xsl:template match="audio|video|interactive|image
|
|
4640
|
+
| datafile
|
|
4641
|
+
| exercise/stack
|
|
4642
|
+
| exercise[@pi:exercise-interactive='fillin' and setup]
|
|
4643
|
+
| project[@pi:exercise-interactive='fillin' and setup]
|
|
4644
|
+
| activity[@pi:exercise-interactive='fillin' and setup]
|
|
4645
|
+
| exploration[@pi:exercise-interactive='fillin' and setup]
|
|
4646
|
+
| investigation[@pi:exercise-interactive='fillin' and setup]
|
|
4647
|
+
| exercise[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4648
|
+
| project[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4649
|
+
| activity[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4650
|
+
| exploration[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4651
|
+
| investigation[.//task and .//task/@pi:exercise-interactive='fillin' and .//setup]
|
|
4652
|
+
| exercise//task[@pi:exercise-interactive='fillin' and setup]
|
|
4653
|
+
| project//task[@pi:exercise-interactive='fillin' and setup]
|
|
4654
|
+
| activity//task[@pi:exercise-interactive='fillin' and setup]
|
|
4655
|
+
| exploration//task[@pi:exercise-interactive='fillin' and setup]
|
|
4656
|
+
| investigation//task[@pi:exercise-interactive='fillin' and setup]" mode="assembly-id">
|
|
4657
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
4653
4658
|
</xsl:template>
|
|
4654
4659
|
|
|
4655
4660
|
<xsl:template match="*" mode="assembly-id">
|
|
@@ -4657,9 +4662,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4657
4662
|
<xsl:text>PTX:BUG: the "assembly-id" template was applied to an element it did not expect--</xsl:text>
|
|
4658
4663
|
<xsl:value-of select="name()"/>
|
|
4659
4664
|
<xsl:text>.</xsl:text>
|
|
4660
|
-
<xsl:value-of select="@exercise-interactive"/>
|
|
4665
|
+
<xsl:value-of select="@pi:exercise-interactive"/>
|
|
4661
4666
|
<xsl:text>.</xsl:text>
|
|
4662
|
-
<xsl:value-of select="@assembly-id"/>
|
|
4667
|
+
<xsl:value-of select="@pi:assembly-id"/>
|
|
4663
4668
|
</xsl:message>
|
|
4664
4669
|
<xsl:text>unexpected-assembly-id-template-use-here</xsl:text>
|
|
4665
4670
|
</xsl:template>
|
|
@@ -4703,28 +4708,28 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4703
4708
|
<xsl:text>.html</xsl:text>
|
|
4704
4709
|
</xsl:template>
|
|
4705
4710
|
|
|
4706
|
-
<xsl:template match="exercise[@exercise-interactive='fillin' and setup]
|
|
4707
|
-
| project[@exercise-interactive='fillin' and setup]
|
|
4708
|
-
| activity[@exercise-interactive='fillin' and setup]
|
|
4709
|
-
| exploration[@exercise-interactive='fillin' and setup]
|
|
4710
|
-
| investigation[@exercise-interactive='fillin' and setup]"
|
|
4711
|
+
<xsl:template match="exercise[@pi:exercise-interactive='fillin' and setup]
|
|
4712
|
+
| project[@pi:exercise-interactive='fillin' and setup]
|
|
4713
|
+
| activity[@pi:exercise-interactive='fillin' and setup]
|
|
4714
|
+
| exploration[@pi:exercise-interactive='fillin' and setup]
|
|
4715
|
+
| investigation[@pi:exercise-interactive='fillin' and setup]"
|
|
4711
4716
|
mode="standalone-filename">
|
|
4712
4717
|
<xsl:apply-templates select="." mode="assembly-id" />
|
|
4713
4718
|
<xsl:text>.html</xsl:text>
|
|
4714
4719
|
</xsl:template>
|
|
4715
4720
|
|
|
4716
|
-
<xsl:template match="exercise[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4717
|
-
| project[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4718
|
-
| activity[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4719
|
-
| exploration[.//task/@exercise-interactive='fillin' and .//task/setup]
|
|
4720
|
-
| investigation[.//task/@exercise-interactive='fillin' and .//task/setup]"
|
|
4721
|
+
<xsl:template match="exercise[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4722
|
+
| project[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4723
|
+
| activity[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4724
|
+
| exploration[.//task/@pi:exercise-interactive='fillin' and .//task/setup]
|
|
4725
|
+
| investigation[.//task/@pi:exercise-interactive='fillin' and .//task/setup]"
|
|
4721
4726
|
mode="standalone-filename">
|
|
4722
4727
|
<xsl:apply-templates select="." mode="assembly-id" />
|
|
4723
4728
|
<xsl:text>.html</xsl:text>
|
|
4724
4729
|
</xsl:template>
|
|
4725
4730
|
|
|
4726
4731
|
<xsl:template match="*" mode="standalone-filename">
|
|
4727
|
-
<xsl:apply-templates select="." mode="
|
|
4732
|
+
<xsl:apply-templates select="." mode="unique-id" />
|
|
4728
4733
|
<xsl:text>-ERROR-no-standalone-filename.html</xsl:text>
|
|
4729
4734
|
</xsl:template>
|
|
4730
4735
|
|