1 <?xml version='
1.0'
encoding=
"UTF-8"?>
2 <xsl:stylesheet version=
"1.0"
4 xmlns=
"http://docbook.org/ns/docbook"
5 xmlns:
db=
"http://docbook.org/ns/docbook"
6 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
7 xmlns:
xlink=
"http://www.w3.org/1999/xlink"
8 xmlns:
ex=
"http://exslt.org/dates-and-times"
9 xmlns:
em=
"http://exslt.org/math"
10 xmlns:
es=
"http://exslt.org/sets"
11 xmlns:
ec=
"http://exslt.org/common"
12 xmlns:
esets=
"http://exslt.org/sets"
13 xmlns:
p=
"tag:fenglich.fastmail.fm,2007:Pottery">
16 <!-- Do some business logic validation. -->
17 <xsl:template match=
"/">
18 <!-- glazing referencing brushons. -->
19 <xsl:variable name=
"invalidGlazeRef">
20 <xsl:for-each select=
"//p:glazing">
21 <xsl:variable name=
"name" select=
"@idref"/>
22 <xsl:value-of select=
"//p:glaze[@xml:id = $name and @type = 'BrushOn']/@xml:id"/>
26 <xsl:if test=
"string-length(normalize-space($invalidGlazeRef)) > 0">
27 <xsl:message terminate=
"yes"><xsl:value-of select=
"$invalidGlazeRef"/> is referenced as a non-brushon, while it in fact is.
</xsl:message>
30 <!-- brushons referencing non-brushons. -->
31 <xsl:variable name=
"invalidBrushOnGlazeRef">
32 <xsl:for-each select=
"//p:brushon">
33 <xsl:variable name=
"name" select=
"@idref"/>
34 <xsl:value-of select=
"//p:glaze[@xml:id = $name and @type != 'BrushOn']/@xml:id"/>
38 <xsl:if test=
"string-length(normalize-space($invalidBrushOnGlazeRef)) > 0">
39 <xsl:message terminate=
"yes"><xsl:value-of select=
"$invalidBrushOnGlazeRef"/> are referenced as a brushon, while it isn't.
</xsl:message>
42 <xsl:apply-templates/>
45 <xsl:template match=
"p:pottery">
48 <title>The Next Sample
</title>
51 <firstname>Frans
</firstname>
52 <surname>Englich
</surname>
54 <email>fenglich@fastmail.fm
</email>
56 <phone>+
46-
702-
411091</phone>
59 <pubdate><xsl:value-of select=
"ex:date()"/></pubdate>
61 <para>Copyright (c)
2007-
2008 Frans Englich
</para>
62 <para>Permission is granted to copy, distribute and/or modify this document
63 under the terms of the GNU Free Documentation License, Version
1.2
64 or any later version published by the Free Software Foundation;
65 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
66 Texts. A copy of the license can be obtained at the
<phrase xlink:
href=
"http://www.gnu.org/licenses/fdl.html">Free Software Foundation's website
</phrase> or by contacting the author.
</para>
70 <xsl:apply-templates select=
"p:pieces"/>
71 <xsl:apply-templates select=
"p:glazes"/>
74 <title>Non-glaze Samples
</title>
75 <para>This section contains samples which aren't of glazes,
76 such as melt tests. See also the samples that have at least
77 <phrase xlink:
href=
"#Transparent">transparent
78 glaze
</phrase> as glazing, which contains similar kind
81 <xsl:apply-templates select=
"p:samples/p:sample[not(p:glazing | p:brushon)]"/>
85 <title>Oven Programs
</title>
87 <para>Unless otherwise stated, all firings were done with the following settings.
</para>
92 <entry>Program Code
</entry>
106 <entry>Bisque
</entry>
117 <entry>Decal
& Luster
</entry>
128 <entry>Unused Bisque Program
</entry>
154 <xsl:apply-templates select=
"p:clays"/>
156 <xsl:call-template name=
"sourcesAppendix"/>
160 <xsl:template match=
"p:pieces">
162 <title>Pieces
</title>
164 <para>A total of
<xsl:value-of select=
"count(p:piece)"/> pieces.
</para>
166 <para>The IDs assigned to pieces are arbitrary and not sequential. They don't reflect cronologically
167 the creation. However, they are sorted numerically in this document for quick lookup.
</para>
169 <xsl:apply-templates select=
"p:piece">
170 <xsl:sort data-type=
"number" select=
"number(substring(@xml:id, 2))"/>
171 </xsl:apply-templates>
175 <xsl:template match=
"p:piece">
177 <xsl:attribute name=
"xml:id"><xsl:value-of select=
"@xml:id"/></xsl:attribute>
178 <xsl:attribute name=
"xreflabel"><xsl:value-of select=
"@xml:id"/></xsl:attribute>
180 <xsl:value-of select=
"substring(@xml:id, 2)"/>
182 <xsl:apply-templates/>
183 <xsl:call-template name=
"createReferences"/>
187 <xsl:template match=
"p:clayref">
189 <emphasis>Clay
</emphasis>:
<phrase xlink:
href=
"#{@idref}">
190 <xsl:value-of select=
"/p:pottery/p:clays/p:clay[@xml:id = current()/@idref]/@name"/></phrase>
191 <xsl:apply-templates select=
"@weightWhenWet"/>
196 <xsl:template match=
"@weightWhenWet">
197 <xsl:text>, weight
</xsl:text>
198 <emphasis>when wet
</emphasis>:
199 <constant><xsl:value-of select=
"."/></constant> g
202 <xsl:template match=
"p:note">
204 <title><xsl:value-of select=
"@date"/></title>
205 <para><xsl:value-of select=
"."/></para>
209 <xsl:template match=
"p:glazes">
211 <title>Glazes by Color
</title>
213 <para>A total of
<xsl:value-of select=
"count(//p:sample)"/> sample tiles.
</para>
215 <xsl:for-each select=
"esets:distinct(p:glaze/@category)">
216 <xsl:sort select=
"."/>
219 <title><xsl:value-of select=
"."/></title>
220 <xsl:apply-templates select=
"(/)//p:glaze[@category = current()]">
221 <xsl:sort select=
"@name"/>
222 </xsl:apply-templates>
228 <xsl:template match=
"p:glaze">
230 <xsl:attribute name=
"xml:id"><xsl:value-of select=
"@xml:id"/></xsl:attribute>
231 <xsl:attribute name=
"xreflabel"><xsl:value-of select=
"@name"/></xsl:attribute>
233 <xsl:value-of select=
"@name"/>
234 <xsl:if test=
"@productID">,
235 <xsl:value-of select=
"@productID"/>
237 <xsl:if test=
"@type = 'BrushOn'"> (brush-on)
</xsl:if>
240 <xsl:apply-templates select=
"db:para"/>
242 <xsl:apply-templates select=
"p:recipe"/>
244 <xsl:call-template name=
"createReferences"/>
246 <xsl:variable name=
"piecesUsing" select=
"//p:pieces/p:piece[p:glazing/@idref = current()/@xml:id]/@xml:id"/>
247 <xsl:if test=
"$piecesUsing">
250 <xsl:when test=
"count($piecesUsing) > 1">pieces
</xsl:when>
251 <xsl:otherwise>piece
</xsl:otherwise>
254 <xsl:text> </xsl:text>
256 <xsl:call-template name=
"listItems">
257 <xsl:with-param name=
"items" select=
"$piecesUsing"/>
263 <xsl:variable name=
"secondaryTiles" select=
"//p:samples/p:sample[(p:brushon | p:glazing)[position() > 1][@idref = current()/@xml:id]]/@xml:id"/>
265 <xsl:if test=
"$secondaryTiles">
266 <para>Appears as a secondary glaze on
268 <xsl:when test=
"count($piecesUsing) > 1">tiles
</xsl:when>
269 <xsl:otherwise>tile
</xsl:otherwise>
272 <xsl:text> </xsl:text>
274 <xsl:call-template name=
"listItems">
275 <xsl:with-param name=
"items" select=
"$secondaryTiles"/>
280 <xsl:variable name=
"tiles" select=
"//p:samples/p:sample[(p:brushon | p:glazing)[1][@idref = current()/@xml:id]]"/>
281 <xsl:apply-templates select=
"$tiles">
282 <!-- TODO This just doesn't seem to work. -->
283 <xsl:sort data-type=
"number" select=
"number(substring(@xml:id, 2))"/>
284 <!--<xsl:sort data-type="number" select="number(p:glazing/@hydrometerGravity)"/>-->
285 <xsl:with-param name=
"mainGlaze" select=
"@xml:id"/>
286 </xsl:apply-templates>
290 <xsl:template name=
"listItems">
291 <xsl:param name=
"items"/>
293 <xsl:for-each select=
"$items">
294 <db:xref xlink:
href=
"#{.}"/>
295 <xsl:if test=
"position() = last() - 1">
296 <xsl:text> and
</xsl:text>
298 <xsl:if test=
"position() < last() - 1">
299 <xsl:text>,
</xsl:text>
301 <xsl:if test=
"position() = last()">
302 <xsl:text>.
</xsl:text>
307 <xsl:template name=
"imageForSample">
308 <xsl:param name=
"sampleName"/>
309 <xsl:param name=
"imageName"/>
312 <imagedata align=
"right" format=
"JPG" fileref=
"../Images/Samples/{$sampleName}/{$imageName}.jpg"/>
317 <xsl:template match=
"p:piece/p:image">
320 <imagedata align=
"right" format=
"JPG" fileref=
"../Images/Pieces/{../@xml:id}/{.}.jpg"/>
325 <xsl:template match=
"p:sample">
326 <xsl:param name=
"mainGlaze"/>
328 <xsl:attribute name=
"xml:id"><xsl:value-of select=
"@xml:id"/></xsl:attribute>
329 <xsl:attribute name=
"xreflabel"><xsl:value-of select=
"@xml:id"/></xsl:attribute>
330 <title><xsl:value-of select=
"@xml:id"/></title>
332 <para><date><xsl:value-of select=
"@date"/></date></para>
334 <xsl:apply-templates select=
"(p:glazing | p:brushon)[@idref = $mainGlaze]" mode=
"lowKeyGlazing"/>
336 <xsl:variable name=
"additionalGlazes" select=
"(p:brushon | p:glazing)[@idref != $mainGlaze]"/>
337 <xsl:if test=
"(p:brushon | p:glazing)[@idref != $mainGlaze]">
338 <para>Additional glaze
<xsl:if test=
"count($additionalGlazes) > 1">s
</xsl:if>:
</para>
339 <xsl:apply-templates select=
"(p:brushon | p:glazing)[@idref != $mainGlaze]"/>
341 <xsl:apply-templates select=
"p:clayref"/>
343 <xsl:call-template name=
"createReferences"/>
345 <xsl:apply-templates select=
"db:para"/>
346 <xsl:apply-templates mode=
"doImage" select=
"."/>
350 <xsl:template name=
"createReferences">
351 <xsl:variable name=
"id" select=
"@xml:id"/>
352 <xsl:variable name=
"referencedFrom" select=
"(/)//@xml:id[parent::node()//@xlink:href[substring-after(., '#') = $id]]"/>
354 <xsl:if test=
"$referencedFrom">
356 <xsl:text>Referenced by:
</xsl:text>
357 <xsl:call-template name=
"listItems">
358 <xsl:with-param name=
"items" select=
"$referencedFrom"/>
364 <xsl:template mode=
"doImage" match=
"p:sample">
365 <xsl:call-template name=
"imageForSample">
366 <xsl:with-param name=
"sampleName" select=
"@xml:id"/>
367 <xsl:with-param name=
"imageName" select=
"@xml:id"/>
371 <xsl:template match=
"p:sample/p:para">
373 <title><xsl:value-of select=
"../@date"/></title>
375 <xsl:apply-templates select=
"."/>
380 <xsl:template match=
"p:glazing">
381 <para><phrase xlink:
href=
"#{@idref}"><xsl:value-of select=
"/p:pottery/p:glazes/p:glaze[@xml:id = current()/@idref]/@name"/></phrase>,
382 <xsl:apply-templates select=
"." mode=
"lowKeyGlazing"/>
386 <xsl:template match=
"p:brushon">
387 <para><phrase xlink:
href=
"#{@idref}"><xsl:value-of select=
"/p:pottery/p:glazes/p:glaze[@xml:id = current()/@idref]/@name"/></phrase></para>
390 <xsl:template match=
"p:glazing" mode=
"lowKeyGlazing">
391 <xsl:apply-templates select=
"@hydrometerGravity"/>
392 <xsl:apply-templates select=
"@sieved"/>
395 <xsl:template match=
"@hydrometerGravity">
396 <emphasis>hydrometer gravity
</emphasis>
397 <xsl:text> </xsl:text>
398 <constant><xsl:value-of select=
"."/></constant>,
401 <xsl:template match=
"@sieved">
404 <xsl:when test=
". = 'WithMixer'">
407 <xsl:when test=
". = 'no'">
411 sieved with mesh size
<constant><xsl:value-of select=
"."/></constant>
417 <xsl:template name=
"sourcesAppendix">
419 <title>Sources
</title>
420 <para>This document was generated from the following sources. The string following the file date is the git SHA1 checksum.
</para>
422 <xsl:apply-templates select=
"document('sources.xml')/p:sources/p:source"/>
427 <xsl:template match=
"p:source">
430 <filename><xsl:value-of select=
"@href"/></filename>
431 <xsl:text>,
</xsl:text>
432 <date><xsl:value-of select=
"@date"/></date>
433 <xsl:text>,
</xsl:text>
434 <systemitem><xsl:value-of select=
"@gitSHA1"/></systemitem>
439 <xsl:template match=
"p:clays">
442 <xsl:apply-templates/>
446 <xsl:template match=
"p:clay">
448 <xsl:attribute name=
"xml:id"><xsl:value-of select=
"@xml:id"/></xsl:attribute>
450 <xsl:value-of select=
"@name"/>
451 <xsl:if test=
"@productID">,
452 <xsl:value-of select=
"@productID"/>
459 <xsl:template match=
"@* | db:* | @xlink:*">
461 <xsl:apply-templates select=
"@*|node()"/>
465 <xsl:template match=
"db:date">
466 <emphasis><xsl:value-of select=
"."/></emphasis>
467 <xsl:text> </xsl:text>
470 <xsl:template match=
"p:recipe">
473 <xsl:variable name=
"hasReplacement" select=
"p:component/@replacementFor"/>
476 <entry>Component
</entry>
477 <xsl:if test=
"$hasReplacement">
478 <entry>Source/Replacement For
</entry>
481 <entry>Price/kg for
<phrase xlink:
href=
"http://www.we.no/">Waldm. Ellefsen AS
</phrase> 2003, MVA, NOK
</entry>
487 <xsl:if test=
"sum(p:component/@parts) < 100">
488 <xsl:message terminate=
"yes">The components for glaze
<xsl:value-of select=
"../@name"/> amount to less than
100 parts
</xsl:message>
490 <xsl:if test=
"$hasReplacement">
493 <entry><xsl:value-of select=
"sum(p:component/@parts)"/></entry>
495 <xsl:variable name=
"componentPrices">
496 <xsl:apply-templates mode=
"computePrice" select=
"p:component"/>
499 <xsl:value-of select=
"sum(ec:node-set($componentPrices)/*)"/>
504 <xsl:apply-templates select=
"p:component">
505 <xsl:with-param name=
"hasReplacement" select=
"$hasReplacement"/>
506 </xsl:apply-templates>
512 <xsl:template match=
"p:component">
513 <xsl:param name=
"hasReplacement"/>
516 <xsl:variable name=
"component" select=
"/p:pottery/p:components/p:component[@xml:id = current()/@idref]"/>
517 <xsl:call-template name=
"checkComponentRef">
518 <xsl:with-param name=
"component" select=
"$component"/>
519 <xsl:with-param name=
"name" select=
"@idref"/>
521 <entry><xsl:copy-of select=
"$component/node()"/></entry>
522 <xsl:if test=
"@replacementFor">
523 <xsl:variable name=
"replacement" select=
"/p:pottery/p:components/p:component[@xml:id = current()/@replacementFor]"/>
524 <xsl:call-template name=
"checkComponentRef">
525 <xsl:with-param name=
"component" select=
"$replacement"/>
526 <xsl:with-param name=
"name" select=
"@replacementFor"/>
528 <entry><xsl:copy-of select=
"$replacement/node()"/></entry>
531 <xsl:if test=
"$hasReplacement and not(@replacementFor)">
534 <entry><constant><xsl:value-of select=
"@parts"/></constant></entry>
537 <xsl:apply-templates mode=
"computePrice" select=
"."/>
542 <xsl:template mode=
"computePrice" match=
"p:component">
544 <xsl:variable name=
"price" select=
"number(/p:pottery/p:components/p:component[@xml:id = current()/@idref]/@price)"/>
545 <xsl:variable name=
"priceIsFor" select=
"number(/p:pottery/p:components/p:component[@xml:id = current()/@idref]/@priceIsFor)"/>
547 <xsl:value-of select=
"((($price div ($priceIsFor div 1000.0)) * (@parts div 100.0)) * 1.25)"/>
551 <xsl:template match=
"p:measurementsWhenDone">
552 <para>Measurements: height
<constant><xsl:value-of select=
"@height"/></constant> mm,
554 <xsl:if test=
"@width = @depth">
555 <xsl:message>If the depth is the same as the width, the
556 depth shouldn't be specified. Detected for
557 <xsl:value-of select=
"../@xml:id"/></xsl:message>
561 <xsl:when test=
"not(@depth)">
562 diameter
<constant><xsl:value-of select=
"@width"/></constant> mm
565 width
<constant><xsl:value-of select=
"@width"/></constant> mm,
566 depth
<constant><xsl:value-of select=
"@depth"/></constant> mm
572 <xsl:template name=
"checkComponentRef">
573 <xsl:param name=
"component"/>
574 <xsl:param name=
"name"/>
576 <xsl:if test=
"not($component)">
577 <xsl:message terminate=
"yes">Component for reference
<xsl:value-of select=
"$name"/> couldn't be found.
</xsl:message>
581 <!-- We don't use it directly. -->
582 <xsl:template match=
"p:samples"/>
584 <!-- Flag things we miss. -->
585 <xsl:template match=
"* | @*">
586 <xsl:message terminate=
"yes">
587 Unmatched node:
<xsl:value-of select=
"name()"/> <xsl:value-of select=
"string()"/>
594 vim: et:ts=4:sw=4:sts=4