1 <?xml version="1.0" encoding="utf-8"?>
3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/>
12 <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/common/common.xsl"/>
14 <!-- The root of the Boost directory -->
15 <xsl:param name="boost.root"/>
17 <!-- The number of columns in a source file line -->
18 <xsl:param name="boost.source.columns" select="78"/>
20 <xsl:output method="text"/>
21 <xsl:template match="/">
22 <xsl:if test="$boost.root">
23 <!-- Output testsuite Jamfiles -->
24 <xsl:apply-templates select="//testsuite" mode="Jamfile"/>
26 <!-- Output any source files that are written in XML -->
27 <xsl:apply-templates select="//source" mode="testsuite.generate"/>
30 <xsl:if test="not($boost.root)">
32 Please set the XSL stylesheet parameter "boost.root" to the top-level
33 Boost directory (i.e., BOOST_ROOT)
38 <xsl:template match="testsuite" mode="Jamfile">
39 <xsl:variable name="subproject"
40 select="concat('libs/',ancestor::library/attribute::dirname,'/test')"/>
41 <xsl:variable name="filename"
42 select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname,
44 <xsl:call-template name="write.text.chunk">
45 <xsl:with-param name="filename" select="$filename"/>
46 <xsl:with-param name="content">
47 <xsl:call-template name="source.print.header">
48 <xsl:with-param name="prefix" select="'#'"/>
51 # Testing Jamfile autogenerated from XML source
52 subproject <xsl:value-of select="$subproject"/> ;
54 # bring in rules for testing
55 SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
58 # Make tests run by default.
62 # look in BOOST_ROOT for sources first, just in this Jamfile
63 local SEARCH_SOURCE = $(BOOST_ROOT) $(SEARCH_SOURCE) ;
65 test-suite <xsl:value-of select="ancestor::library/attribute::dirname"/>
66 : <xsl:apply-templates mode="Jamfile"/> ;
72 <xsl:template match="compile-test|link-test|run-test|compile-fail-test|link-fail-test|run-fail-test"
74 <xsl:variable name="fullname"
75 select="concat(substring-before(local-name(.), '-test'), ' libs/',
76 ancestor::library/attribute::dirname, '/test/',
78 <xsl:text>[ </xsl:text>
79 <xsl:value-of select="$fullname"/>
80 <xsl:apply-templates select="lib" mode="Jamfile"/>
81 <xsl:text> : </xsl:text>
83 <xsl:text> : </xsl:text>
85 <xsl:text> : </xsl:text>
86 <xsl:apply-templates select="requirement" mode="Jamfile"/>
88 <xsl:text> : </xsl:text>
90 <xsl:value-of select="@name"/>
92 <xsl:text> ]</xsl:text>
95 <xsl:template match="lib" mode="Jamfile">
96 <xsl:text> <lib></xsl:text><xsl:value-of select="text()"/>
99 <xsl:template match="requirement" mode="Jamfile">
100 <xsl:if test="count(preceding-sibling::requirement) > 0">
101 <xsl:text> </xsl:text>
103 <xsl:value-of select="concat('<', @name, '>')"/>
104 <xsl:value-of select="."/>
107 <xsl:template match="source" mode="testsuite.generate">
108 <xsl:variable name="filename"
109 select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname,
110 '/test/',../@filename)"/>
112 <xsl:variable name="prefix" select="'//'"/>
114 <xsl:call-template name="write.text.chunk">
115 <xsl:with-param name="filename" select="$filename"/>
116 <xsl:with-param name="content">
117 <xsl:call-template name="source.print.header">
118 <xsl:with-param name="prefix" select="'//'"/>
121 <xsl:apply-templates mode="testsuite.generate"/>
126 <xsl:template match="snippet" mode="testsuite.generate">
127 <xsl:variable name="snippet-name" select="@name"/>
128 <xsl:value-of select="//programlisting[@name=$snippet-name]"/>
131 <!-- Prints a header to a source file containing the library name,
132 copyright information, license information, and a link to the Boost
133 web site. The text is output using the "prefix" parameter at the
134 beginning of each line (it should denote a single-line comment) and
135 will only print up to boost.source.columns characters per line
136 (including the prefix). -->
137 <xsl:template name="source.print.header">
138 <xsl:param name="prefix"/>
140 <!-- Library name -->
141 <xsl:value-of select="concat($prefix, ' ',
142 ancestor::library/attribute::name,
144 <xsl:text> </xsl:text>
147 <xsl:apply-templates select="ancestor::library/libraryinfo/copyright"
148 mode="testsuite.generate">
149 <xsl:with-param name="prefix" select="$prefix"/>
150 </xsl:apply-templates>
152 <!-- Legal notice -->
153 <xsl:apply-templates select="ancestor::library/libraryinfo/legalnotice"
154 mode="testsuite.generate">
155 <xsl:with-param name="prefix" select="$prefix"/>
156 </xsl:apply-templates>
158 <xsl:text> </xsl:text>
160 <!-- For more information... -->
162 select="concat($prefix,
163 ' For more information, see http://www.boost.org/')"/>
164 <xsl:text> </xsl:text>
167 <xsl:template match="copyright" mode="testsuite.generate">
168 <xsl:param name="prefix"/>
170 <xsl:text> </xsl:text>
172 <xsl:value-of select="concat($prefix, ' Copyright (C) ')"/>
173 <xsl:call-template name="copyright.years">
174 <xsl:with-param name="years" select="year"/>
175 <xsl:with-param name="print.ranges" select="1"/>
176 <xsl:with-param name="single.year.ranges" select="1"/>
179 <xsl:text> </xsl:text>
181 <xsl:apply-templates select="holder" mode="titlepage.mode"/>
184 <xsl:template match="legalnotice" mode="testsuite.generate">
185 <xsl:param name="prefix"/>
187 <xsl:variable name="text" select="normalize-space(.)"/>
189 <xsl:text> </xsl:text>
190 <xsl:value-of select="concat($prefix, ' ')"/>
192 <xsl:call-template name="source.print.legalnotice">
193 <xsl:with-param name="prefix" select="$prefix"/>
194 <xsl:with-param name="text" select="$text"/>
195 <xsl:with-param name="column" select="string-length($prefix) + 1"/>
199 <xsl:template name="source.print.legalnotice">
200 <xsl:param name="prefix"/>
201 <xsl:param name="text"/>
202 <xsl:param name="column"/>
204 <xsl:if test="contains($text, ' ') or string-length($text) > 0">
205 <xsl:variable name="word">
207 <xsl:when test="contains($text, ' ')">
208 <xsl:value-of select="substring-before($text, ' ')"/>
211 <xsl:value-of select="$text"/>
216 <xsl:variable name="rest" select="substring-after($text, ' ')"/>
220 test="$column + string-length($word) > $boost.source.columns">
221 <xsl:text> </xsl:text>
222 <xsl:value-of select="concat($prefix, ' ')"/>
223 <xsl:call-template name="source.print.legalnotice">
224 <xsl:with-param name="prefix" select="$prefix"/>
225 <xsl:with-param name="text" select="$text"/>
226 <xsl:with-param name="column" select="string-length($prefix) + 1"/>
230 <xsl:value-of select="concat($word, ' ')"/>
231 <xsl:call-template name="source.print.legalnotice">
232 <xsl:with-param name="prefix" select="$prefix"/>
233 <xsl:with-param name="text" select="$rest"/>
234 <xsl:with-param name="column"
235 select="$column + string-length($word) + 1"/>
242 <xsl:template match="*" mode="testsuite.generate"/>