2 - Copyright 2006 David Hilvert
4 - ALE documentation stylesheet definition.
6 - This file is part of the Anti-Lamenessing Engine documentation.
8 - The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
9 - it under the terms of the GNU General Public License as published by
10 - the Free Software Foundation; either version 2 of the License, or
11 - (at your option) any later version.
13 - The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
14 - but WITHOUT ANY WARRANTY; without even the implied warranty of
15 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 - GNU General Public License for more details.
18 - You should have received a copy of the GNU General Public License
19 - along with Anti-Lamenessing Engine; if not, write to the Free Software
20 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 <!DOCTYPE xsl:stylesheet [
29 - NOTE: all of the below entities operate on edit records, which
30 - are expected to conform to exactly one of the following patterns:
32 - <edit by="GIVEN-NAME SURNAME" on="2006-Sep-24">
33 - <edit by="GIVEN-NAME SURNAME" in-month="2006-Sep">
34 - <edit by="GIVEN-NAME SURNAME" in-year="2006">
36 - The first form is preferred for occasional edits; the latter two
37 - are provided as shorthand for edits occurring over a number of
38 - days in succesion, or for cases where the exact date of the edit
39 - is not known (e.g., when basing edit history on copyright notices
45 - Obtain an editor name from an edit record.
48 <!ENTITY editor 'normalize-space(@by)'
>
51 - Obtain an edit year from an edit record.
54 <!ENTITY year 'concat(@in-year, substring-before(@in-month,
"-"), substring-before(@on,
"-"))'
>
57 - Generate a string unique for each (editor, year) combination.
60 <!ENTITY editor-year 'concat(
&editor;,
&year;)'
>
63 - Boolean test to determine whether the current node is within the scope of
67 <!ENTITY scope 'count(ancestor::node()|$objectroot) = count(ancestor::node())'
>
73 <!ENTITY editor-firstname 'substring-before(
&editor;,
" ")'
>
79 <!ENTITY editor-surname 'substring-after(
&editor;,
" ")'
>
82 - Sort order for outputs including editor names.
85 <!ENTITY editor-sort-order '&editor-surname;'
>
89 <xsl:stylesheet id=
"style1"
91 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
92 xmlns:
fo=
"http://www.w3.org/1999/XSL/Format"
93 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
99 <xsl:param name=
"product-name" select=
"'ALE'"/>
101 <xsl:param name=
"product-number" select=
"'0.8.5-prerelease'"/>
103 <xsl:param name=
"copyright-info">
104 <copyright id=
"copyright-info">
105 <year> 2002,
2003,
2004,
2005,
2006 </year>
106 <holder> David Hilvert
</holder>
111 - Editing information
114 <xsl:key name=
"editors" match=
"edit" use=
"&editor;"/>
115 <xsl:key name=
"editor-years" match=
"edit" use=
"&editor-year;"/>
118 - If no other template matches, we copy the tree structure unchanged.
121 <xsl:template match=
"@*|node()">
123 <xsl:apply-templates select=
"@*|node()"/>
128 - Do not pass edit tags to DocBook, as it doesn't understand them.
131 <xsl:template match=
"edit"/>
134 - Add package information to titles of articles, books and sets.
137 <xsl:template match=
"setinfo/title|bookinfo/title|articleinfo/title">
139 <xsl:copy-of select=
"$product-name"/>
140 <xsl:text> </xsl:text>
141 <xsl:copy-of select=
"$product-number"/>
142 <xsl:text> </xsl:text>
143 <xsl:apply-templates/>
148 - Generate title, author, and copyright information for articles,
152 <xsl:template match=
"setinfo|bookinfo|articleinfo">
154 <xsl:param name=
"objectroot" select=
".."/>
155 <xsl:param name=
"editors-unique" select=
"$objectroot//edit[count(.|key('editors', &editor;)[&scope;][1]) = 1]"/>
156 <xsl:param name=
"editor-years-unique" select=
"$objectroot//edit[count(.|key('editor-years', &editor-year;)[&scope;][1]) = 1]"/>
159 - Generate the title, if available.
162 <xsl:apply-templates select=
"title"/>
165 - Preserve abstracts.
168 <xsl:apply-templates select=
"abstract"/>
171 - Add author information.
174 <xsl:for-each select=
"$editors-unique">
175 <xsl:sort select=
"&editor-sort-order;"/>
178 <xsl:value-of select=
"&editor-firstname;"/>
181 <xsl:value-of select=
"&editor-surname;"/>
187 - Add copyright information
190 <xsl:for-each select=
"$editors-unique">
191 <xsl:sort select=
"&editor-sort-order;"/>
192 <xsl:param name=
"this-editor" select=
"&editor;"/>
195 <xsl:value-of select=
"&editor;"/>
197 <xsl:for-each select=
"$editor-years-unique">
198 <xsl:if test=
"&editor; = $this-editor">
200 <xsl:value-of select=
"&year;"/>