1 | <?xml version="1.0" encoding="UTF-8" ?>
|
---|
2 | <!--
|
---|
3 | /****************************************************************************
|
---|
4 | **
|
---|
5 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
6 | ** Contact: Qt Software Information ([email protected])
|
---|
7 | **
|
---|
8 | ** This file is part of the Patternist project on Trolltech Labs.
|
---|
9 | **
|
---|
10 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
11 | ** Commercial Usage
|
---|
12 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
13 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
14 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
15 | ** a written agreement between you and Nokia.
|
---|
16 | **
|
---|
17 | ** GNU Lesser General Public License Usage
|
---|
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
19 | ** General Public License version 2.1 as published by the Free Software
|
---|
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
21 | ** packaging of this file. Please review the following information to
|
---|
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
24 | **
|
---|
25 | ** In addition, as a special exception, Nokia gives you certain
|
---|
26 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
27 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
28 | ** package.
|
---|
29 | **
|
---|
30 | ** GNU General Public License Usage
|
---|
31 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
32 | ** General Public License version 3.0 as published by the Free Software
|
---|
33 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
34 | ** packaging of this file. Please review the following information to
|
---|
35 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
36 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
37 | **
|
---|
38 | ** If you are unsure which license is appropriate for your use, please
|
---|
39 | ** contact the sales department at [email protected].
|
---|
40 | ** $QT_END_LICENSE$
|
---|
41 | **
|
---|
42 | ***************************************************************************
|
---|
43 | */
|
---|
44 | -->
|
---|
45 |
|
---|
46 | <xsl:stylesheet
|
---|
47 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
48 | xmlns:h="http://www.w3.org/1999/xhtml"
|
---|
49 | version="1.0">
|
---|
50 |
|
---|
51 | <xsl:output omit-xml-declaration="yes"/>
|
---|
52 |
|
---|
53 | <!--
|
---|
54 | This code open the following specifications:
|
---|
55 |
|
---|
56 | - XQuery 1.0 and XPath 2.0 Functions and Operators
|
---|
57 | - XML Path Language (XPath) 2.0
|
---|
58 | - XSL Transformations (XSLT) Version 2.0
|
---|
59 | - XQuery 1.0: An XML Query Language
|
---|
60 |
|
---|
61 | and extracts the error codes as well as their documentation and exports
|
---|
62 | them as enum values into a C++ enumerator called ErrorCode.
|
---|
63 |
|
---|
64 | NOTE: Be aware of binary compatibility when using this stylesheet.
|
---|
65 | -->
|
---|
66 |
|
---|
67 | <!--
|
---|
68 | <xsl:variable name="xslt20" select="document('xslt20.html')"/>
|
---|
69 | -->
|
---|
70 | <xsl:variable name="xslt20" select="document('http://www.w3.org/TR/xslt20')"/>
|
---|
71 |
|
---|
72 | <!--
|
---|
73 | <xsl:variable name="xqfo" select="document('xqfo.html')"/>
|
---|
74 | -->
|
---|
75 | <xsl:variable name="xqfo" select="document('http://www.w3.org/TR/xpath-functions/')"/>
|
---|
76 |
|
---|
77 | <!--
|
---|
78 | <xsl:variable name="xq" select="document('xq.html')"/>
|
---|
79 | -->
|
---|
80 | <xsl:variable name="xq" select="document('http://www.w3.org/TR/xquery/')"/>
|
---|
81 |
|
---|
82 | <!--
|
---|
83 | <xsl:variable name="ser" select="document('ser.html')"/>
|
---|
84 | -->
|
---|
85 | <xsl:variable name="ser" select="document('http://www.w3.org/TR/xslt-xquery-serialization/')"/>
|
---|
86 |
|
---|
87 | <!--
|
---|
88 | *********************************************
|
---|
89 | *********************************************
|
---|
90 | -->
|
---|
91 | <xsl:template match="/"><xsl:text disable-output-escaping="yes"
|
---|
92 | ><![CDATA[/****************************************************************************
|
---|
93 | **
|
---|
94 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
95 | ** Contact: Qt Software Information ([email protected])
|
---|
96 | **
|
---|
97 | ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
|
---|
98 | **
|
---|
99 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
100 | ** Commercial Usage
|
---|
101 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
102 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
103 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
104 | ** a written agreement between you and Nokia.
|
---|
105 | **
|
---|
106 | ** GNU Lesser General Public License Usage
|
---|
107 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
108 | ** General Public License version 2.1 as published by the Free Software
|
---|
109 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
110 | ** packaging of this file. Please review the following information to
|
---|
111 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
112 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
113 | **
|
---|
114 | ** In addition, as a special exception, Nokia gives you certain
|
---|
115 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
116 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
117 | ** package.
|
---|
118 | **
|
---|
119 | ** GNU General Public License Usage
|
---|
120 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
121 | ** General Public License version 3.0 as published by the Free Software
|
---|
122 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
123 | ** packaging of this file. Please review the following information to
|
---|
124 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
125 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
126 | **
|
---|
127 | ** If you are unsure which license is appropriate for your use, please
|
---|
128 | ** contact the sales department at [email protected].
|
---|
129 | ** $QT_END_LICENSE$
|
---|
130 | **
|
---|
131 | ****************************************************************************/
|
---|
132 |
|
---|
133 | //
|
---|
134 | // W A R N I N G
|
---|
135 | // -------------
|
---|
136 | //
|
---|
137 | // This file is not part of the Qt API. It exists purely as an
|
---|
138 | // implementation detail. This header file may change from version to
|
---|
139 | // version without notice, or even be removed.
|
---|
140 | //
|
---|
141 | // We mean it.
|
---|
142 |
|
---|
143 | #ifndef Patternist_ReportContext_H
|
---|
144 | #define Patternist_ReportContext_H
|
---|
145 |
|
---|
146 | #include <QSharedData>
|
---|
147 | #include <QAbstractUriResolver>
|
---|
148 | #include <QSourceLocation>
|
---|
149 |
|
---|
150 | #include "qnamepool_p.h"
|
---|
151 | #include "qxmlname.h"
|
---|
152 |
|
---|
153 | QT_BEGIN_HEADER
|
---|
154 |
|
---|
155 | QT_BEGIN_NAMESPACE
|
---|
156 |
|
---|
157 | class QAbstractMessageHandler;
|
---|
158 | class QSourceLocation;
|
---|
159 | class QString;
|
---|
160 |
|
---|
161 | namespace QPatternist
|
---|
162 | {
|
---|
163 | class SourceLocationReflection;
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * @short A callback for reporting errors.
|
---|
167 | *
|
---|
168 | * ReportContext receives messages of various severity and type via its
|
---|
169 | * functions warning() and error(). In turn, ReportContext create Message instances
|
---|
170 | * and submit them to the QAbstractMessageHandler instance returned by messageHandler().
|
---|
171 | *
|
---|
172 | * The Message attributes are set as follows:
|
---|
173 | *
|
---|
174 | * - Message::description() - A translated, human-readable description
|
---|
175 | * - Message::type() - Message::Error if a static, dynamic or type error was encountered
|
---|
176 | * that halted compilation or evaluation, or Message::Warning in case of a warning
|
---|
177 | * - Message::identifier() - This is a URI consisting of the error namespace with the
|
---|
178 | * error code as fragment. For example, a Message representing a syntax error
|
---|
179 | * would return the type "http://www.w3.org/2005/xqt-errors#XPST0003". The convenience
|
---|
180 | * function codeFromURI() can be used to extract the error code. The error namespace
|
---|
181 | * is typically the namespace for XPath and XQuery errors(as in the previous example), but
|
---|
182 | * can also be user defined.
|
---|
183 | *
|
---|
184 | * @see <a href="http://www.w3.org/TR/xpath20/#id-identifying-errors">XML Path Language
|
---|
185 | * (XPath) 2.0, 2.3.2 Identifying and Reporting Errors</a>
|
---|
186 | * @see <a href="http://www.w3.org/TR/xpath-functions/#func-error">XQuery 1.0 and
|
---|
187 | * XPath 2.0 Functions and Operators, 3 The Error Function</a>
|
---|
188 | * @author Frans Englich <[email protected]>
|
---|
189 | * @warning This file is auto-generated from extractErrorCodes.xsl. Any
|
---|
190 | * modifications done to this file are lost.
|
---|
191 | */
|
---|
192 | class Q_AUTOTEST_EXPORT ReportContext : public QSharedData
|
---|
193 | {
|
---|
194 | public:
|
---|
195 | typedef QHash<const SourceLocationReflection *, QSourceLocation> LocationHash;
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * A smart pointer wrapping ReportContext instances.
|
---|
199 | */
|
---|
200 | typedef QExplicitlySharedDataPointer<ReportContext> Ptr;
|
---|
201 |
|
---|
202 | /**
|
---|
203 | * @short Default constructors.
|
---|
204 | *
|
---|
205 | * For some reason GCC fails to synthesize it, so we provide an empty
|
---|
206 | * one here.
|
---|
207 | */
|
---|
208 | inline ReportContext() {}
|
---|
209 |
|
---|
210 | virtual ~ReportContext();
|
---|
211 |
|
---|
212 | /**
|
---|
213 | * Error codes that corresponds to the error codes defined in the
|
---|
214 | * relevant specifications. They are used throughout the API for
|
---|
215 | * identifying error conditions.
|
---|
216 | *
|
---|
217 | * While strings could have been used for identifying errors, enums
|
---|
218 | * reduces bugs by providing type safety.
|
---|
219 | *
|
---|
220 | * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML
|
---|
221 | * Path Language (XPath) 2.0, 2.3 Error Handling</a>
|
---|
222 | * @see <a href="http://www.w3.org/TR/xpath-functions/#d1e10985">XQuery 1.0
|
---|
223 | * and XPath 2.0 Functions and Operators, C Error Summary</a>
|
---|
224 | * @see <a href="http://www.w3.org/TR/xslt20/#error-summary">XSL Transformations
|
---|
225 | * (XSLT) Version 2.0, E Summary of Error Conditions (Non-Normative)</a>
|
---|
226 | * @note The enumerator values' Doxygen documentation is copied from the
|
---|
227 | * W3C documents
|
---|
228 | * <a href="http://www.w3.org/TR/xpath-functions">XQuery 1.0 and XPath
|
---|
229 | * 2.0 Functions and Operators</a>,
|
---|
230 | * <a href="http://www.w3.org/TR/xpath20">XML Path Language (XPath) 2.0</a>, and
|
---|
231 | * <a href="http://www.w3.org/TR/xslt20/">XSL Transformations (XSLT)
|
---|
232 | * Version 2.0</a>, respectively. The doxygen documentation is therefore covered
|
---|
233 | * by the following legal notice:
|
---|
234 | * "Copyright @ 2005 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
---|
235 | * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
---|
236 | * <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
|
---|
237 | * <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
|
---|
238 | * use</a> rules apply."
|
---|
239 | * @warning This enumerator is auto-generated from the relevant specifications
|
---|
240 | * by the XSL-T stylesheet extractErrorCodes.xsl. Hence, any modifications
|
---|
241 | * done to this file, in contrary to the stylesheet, are therefore lost.
|
---|
242 | */]]></xsl:text>
|
---|
243 | enum ErrorCode
|
---|
244 | {
|
---|
245 | <!-- The order of the calls is significant. The templates takes into account
|
---|
246 | to avoid the last comma(extractXSLT20 does this). -->
|
---|
247 | <xsl:call-template name="extractXQuery10"/>
|
---|
248 | <xsl:call-template name="extractXQueryFO"/>
|
---|
249 | <xsl:call-template name="extractSerialization"/>
|
---|
250 | <xsl:call-template name="extractXSLT20"/>
|
---|
251 | };
|
---|
252 | <xsl:text disable-output-escaping="yes"><![CDATA[
|
---|
253 | /**
|
---|
254 | * Issues a warning, should not be used excessively. This can
|
---|
255 | * be used to communicate that a certain implementation defined
|
---|
256 | * feature is unsupported or that a certain expression most likely
|
---|
257 | * doesn't do what the users wants, to name a few examples.
|
---|
258 | *
|
---|
259 | * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
|
---|
260 | * 2.3 Error Handling</a>
|
---|
261 | * @param message the message to be read by the user.
|
---|
262 | * @param sourceLocation the location of where the warning originates from.
|
---|
263 | */
|
---|
264 | void warning(const QString &message, const QSourceLocation &sourceLocation = QSourceLocation());
|
---|
265 |
|
---|
266 | /**
|
---|
267 | * Issues an error. May be used at the static analysis phase or
|
---|
268 | * the dynamic evaluation phase.
|
---|
269 | *
|
---|
270 | * For SourceLocationReflection instances, the overload taking an SouourceLocationReflection should be used.
|
---|
271 | *
|
---|
272 | * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
|
---|
273 | * 2.3 Error Handling</a>
|
---|
274 | * @param message the message to be read by the user.
|
---|
275 | * @param errorCode identifies the error condition, as described
|
---|
276 | * @param sourceLocation the location of where the error originates from
|
---|
277 | * in "XML Path Language (XPath) 2.0" section "G Error Conditions"
|
---|
278 | */
|
---|
279 | void error(const QString &message,
|
---|
280 | const ReportContext::ErrorCode errorCode,
|
---|
281 | const QSourceLocation &sourceLocation);
|
---|
282 |
|
---|
283 | /**
|
---|
284 | * Overload.
|
---|
285 | *
|
---|
286 | * Same as the above, but passes the SourceLocationReflection as reference for error reporting.
|
---|
287 | */
|
---|
288 | void error(const QString &message,
|
---|
289 | const ReportContext::ErrorCode errorCode,
|
---|
290 | const SourceLocationReflection *reflection);
|
---|
291 |
|
---|
292 | /**
|
---|
293 | * Issues an error which is not identified in the XPath specifications. This function
|
---|
294 | * is among other things used for implementing the <tt>fn:error()</tt> function.
|
---|
295 | */
|
---|
296 | void error(const QString &message,
|
---|
297 | const QXmlName qName,
|
---|
298 | const SourceLocationReflection *const r);
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * @return the QAbstractMessageHandler which functions such as warning() and
|
---|
302 | * error() should submit messages to. This function
|
---|
303 | * may never return @c null; a valid QAbstractMessageHandler pointer must always be returned.
|
---|
304 | */
|
---|
305 | virtual QAbstractMessageHandler *messageHandler() const = 0;
|
---|
306 |
|
---|
307 | virtual NamePool::Ptr namePool() const = 0;
|
---|
308 |
|
---|
309 | /**
|
---|
310 | * Returns a string representation of the error code @p code.
|
---|
311 | *
|
---|
312 | * @see ReportContext::ErrorCode
|
---|
313 | * @param errorCode identifies the error condition, as described
|
---|
314 | * in <a href="http://www.w3.org/TR/xpath20/#id-errors">XML Path
|
---|
315 | * Language (XPath) 2.0, G Error Conditions</a>
|
---|
316 | */
|
---|
317 | static QString codeToString(const ReportContext::ErrorCode errorCode);
|
---|
318 |
|
---|
319 | /**
|
---|
320 | * @returns the error code part of @p typeURI and sets @p uri to the error namespace. Note
|
---|
321 | * that the error namespace not necessarily is the namespace for XPath and
|
---|
322 | * XQuery errors, http://www.w3.org/2005/xqt-errors, but can be user defined.
|
---|
323 | */
|
---|
324 | static QString codeFromURI(const QString &typeURI,
|
---|
325 | QString &uri);
|
---|
326 |
|
---|
327 | /**
|
---|
328 | * @short Returns the source location applying for @p reflection.
|
---|
329 | */
|
---|
330 | virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const = 0;
|
---|
331 |
|
---|
332 | /**
|
---|
333 | * Resolves @p relative against @p baseURI, possibly using a URI resolver.
|
---|
334 | */
|
---|
335 | QUrl resolveURI(const QUrl &relative,
|
---|
336 | const QUrl &baseURI) const;
|
---|
337 |
|
---|
338 | /**
|
---|
339 | * @short The URI resolver in use.
|
---|
340 | *
|
---|
341 | * If no URI resolver is in use, a @c null pointer is returned.
|
---|
342 | *
|
---|
343 | * @note You should probably use resolveURI(), which handles the case of
|
---|
344 | * when uriResolver() is @c null.
|
---|
345 | */
|
---|
346 | virtual QAbstractUriResolver *uriResolver() const = 0;
|
---|
347 |
|
---|
348 | private:
|
---|
349 | void createError(const QString &description,
|
---|
350 | const QtMsgType type,
|
---|
351 | const QUrl &id,
|
---|
352 | const QSourceLocation &sourceLocation) const;
|
---|
353 | static inline QString finalizeDescription(const QString &desc);
|
---|
354 | QSourceLocation lookupSourceLocation(const SourceLocationReflection *const ref) const;
|
---|
355 |
|
---|
356 | Q_DISABLE_COPY(ReportContext)
|
---|
357 | };
|
---|
358 |
|
---|
359 | /**
|
---|
360 | * @short This is the class type that is being thrown when a query error occur.
|
---|
361 | *
|
---|
362 | * @relates ReportContext
|
---|
363 | */
|
---|
364 | typedef bool Exception;
|
---|
365 | }
|
---|
366 |
|
---|
367 | QT_END_NAMESPACE
|
---|
368 |
|
---|
369 | QT_END_HEADER
|
---|
370 |
|
---|
371 | #endif]]></xsl:text>
|
---|
372 | </xsl:template>
|
---|
373 | <!--
|
---|
374 | *********************************************
|
---|
375 | *********************************************
|
---|
376 | -->
|
---|
377 |
|
---|
378 |
|
---|
379 |
|
---|
380 |
|
---|
381 | <!--
|
---|
382 | *********************************************
|
---|
383 | XQuery 1.0 and XPath 2.0 Functions and Operators
|
---|
384 | *********************************************
|
---|
385 | -->
|
---|
386 | <xsl:template name="extractXQueryFO">
|
---|
387 | <xsl:apply-templates mode="xqfo" select="$xqfo/h:html/h:body/h:div[@class = 'back']//
|
---|
388 | h:div[h:h2/h:a/@id = 'error-summary']/h:dl/h:dt"/>
|
---|
389 | </xsl:template>
|
---|
390 |
|
---|
391 | <xsl:template mode="xqfo" match="h:dt">
|
---|
392 | /**<xsl:call-template name="formatDocs">
|
---|
393 | <xsl:with-param name="content" select="substring(., 15)"/>
|
---|
394 | </xsl:call-template>
|
---|
395 | */
|
---|
396 | <xsl:value-of select="substring(h:a/@name, 4)"/>,
|
---|
397 | </xsl:template>
|
---|
398 | <!--
|
---|
399 | *********************************************
|
---|
400 | *********************************************
|
---|
401 | -->
|
---|
402 |
|
---|
403 |
|
---|
404 |
|
---|
405 |
|
---|
406 | <!--
|
---|
407 | *********************************************
|
---|
408 | XQuery 1.0: An XML Query Language
|
---|
409 | *********************************************
|
---|
410 | -->
|
---|
411 | <xsl:template name="extractXQuery10">
|
---|
412 | <xsl:apply-templates mode="xquery10" select="$xq/h:html/h:body/h:div[@class = 'back']//
|
---|
413 | h:div[h:h2/h:a/@id = 'id-errors']/h:dl/h:dt"/>
|
---|
414 | </xsl:template>
|
---|
415 |
|
---|
416 | <xsl:template mode="xquery10" match="h:dt">
|
---|
417 | /**<xsl:call-template name="formatDocs">
|
---|
418 | <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
|
---|
419 | </xsl:call-template>
|
---|
420 | */
|
---|
421 | <xsl:value-of select="substring(., 5)"/>,
|
---|
422 | </xsl:template>
|
---|
423 | <!--
|
---|
424 | *********************************************
|
---|
425 | *********************************************
|
---|
426 | -->
|
---|
427 |
|
---|
428 |
|
---|
429 |
|
---|
430 | <!--
|
---|
431 | *********************************************
|
---|
432 | XSL Transformations (XSLT) Version 2.0
|
---|
433 | *********************************************
|
---|
434 | -->
|
---|
435 | <xsl:template name="extractXSLT20">
|
---|
436 | <xsl:apply-templates mode="xslt20" select="$xslt20/h:html/h:body/h:div[@class = 'back']//
|
---|
437 | h:div[@class = 'div1' and h:h2/h:a/@id = 'error-summary']/h:dl/h:dt"/>
|
---|
438 | </xsl:template>
|
---|
439 |
|
---|
440 | <xsl:template mode="xslt20" match="h:dt">
|
---|
441 | /**<xsl:call-template name="formatDocs">
|
---|
442 | <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
|
---|
443 | </xsl:call-template>
|
---|
444 | */
|
---|
445 | <xsl:value-of select="normalize-space(substring(h:a/h:span, 4))"/>
|
---|
446 |
|
---|
447 | <xsl:if test="position() != last()">,</xsl:if>
|
---|
448 | <xsl:text>
</xsl:text>
|
---|
449 | </xsl:template>
|
---|
450 | <!--
|
---|
451 | *********************************************
|
---|
452 | *********************************************
|
---|
453 | -->
|
---|
454 |
|
---|
455 |
|
---|
456 |
|
---|
457 | <!--
|
---|
458 | *********************************************
|
---|
459 | XSLT 2.0 and XQuery 1.0 Serialization
|
---|
460 | *********************************************
|
---|
461 | -->
|
---|
462 | <xsl:template name="extractSerialization">
|
---|
463 | <xsl:apply-templates mode="ser" select="$ser/h:html/h:body/h:div[@class = 'back']//
|
---|
464 | h:div[@class = 'div1' and h:h2/h:a/@id = 'id-errors']/h:dl/h:dt"/>
|
---|
465 | </xsl:template>
|
---|
466 |
|
---|
467 | <xsl:template mode="ser" match="h:dt">
|
---|
468 | /**<xsl:call-template name="formatDocs">
|
---|
469 | <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
|
---|
470 | </xsl:call-template>
|
---|
471 | */
|
---|
472 | <xsl:value-of select="substring(., 5)"/>,
|
---|
473 | </xsl:template>
|
---|
474 | <!--
|
---|
475 | *********************************************
|
---|
476 | *********************************************
|
---|
477 | -->
|
---|
478 |
|
---|
479 |
|
---|
480 |
|
---|
481 |
|
---|
482 | <!-- Random stuff -->
|
---|
483 | <xsl:template name="formatDocs">
|
---|
484 | <xsl:param name="content"/>
|
---|
485 |
|
---|
486 | <xsl:call-template name="internalFormatDocs">
|
---|
487 | <xsl:with-param name="content">
|
---|
488 | <!-- Escape # in order to keep Doxygen happy. -->
|
---|
489 | <xsl:call-template name="replace-string">
|
---|
490 | <xsl:with-param name="text" select="translate(normalize-space($content), ' ', '')"/>
|
---|
491 | <xsl:with-param name="from" select="' #'"/>
|
---|
492 | <xsl:with-param name="to" select="' \#'"/>
|
---|
493 | </xsl:call-template>
|
---|
494 | </xsl:with-param>
|
---|
495 | </xsl:call-template>
|
---|
496 |
|
---|
497 | </xsl:template>
|
---|
498 |
|
---|
499 | <xsl:template name="internalFormatDocs">
|
---|
500 | <xsl:param name="content"/>
|
---|
501 |
|
---|
502 | <xsl:variable name="nextText" select="substring($content, 61)"/>
|
---|
503 | <xsl:variable name="afterSpace" select="substring-after($nextText, ' ')"/>
|
---|
504 | * <xsl:value-of select="substring($content, 1, 60)"/>
|
---|
505 | <xsl:value-of select="substring-before($nextText, ' ')"/>
|
---|
506 | <xsl:choose>
|
---|
507 | <xsl:when test="string-length($afterSpace) = 0"><xsl:value-of select="$nextText"/>
|
---|
508 | </xsl:when>
|
---|
509 | <xsl:when test="string-length($afterSpace) < 60">
|
---|
510 | * <xsl:value-of select="$afterSpace"/>
|
---|
511 | </xsl:when>
|
---|
512 | <xsl:when test="string-length($nextText)">
|
---|
513 | <xsl:call-template name="formatDocs">
|
---|
514 | <xsl:with-param name="content"
|
---|
515 | select="$afterSpace"/>
|
---|
516 | </xsl:call-template>
|
---|
517 | </xsl:when>
|
---|
518 | </xsl:choose>
|
---|
519 | </xsl:template>
|
---|
520 |
|
---|
521 | <!--
|
---|
522 | reusable replace-string function
|
---|
523 | http://aspn.activestate.com/ASPN/Cookbook/XSLT/Recipe/65426
|
---|
524 | -->
|
---|
525 | <xsl:template name="replace-string">
|
---|
526 | <xsl:param name="text"/>
|
---|
527 | <xsl:param name="from"/>
|
---|
528 | <xsl:param name="to"/>
|
---|
529 |
|
---|
530 | <xsl:choose>
|
---|
531 | <xsl:when test="contains($text, $from)">
|
---|
532 |
|
---|
533 | <xsl:variable name="before" select="substring-before($text, $from)"/>
|
---|
534 | <xsl:variable name="after" select="substring-after($text, $from)"/>
|
---|
535 |
|
---|
536 | <xsl:value-of select="$before"/>
|
---|
537 | <xsl:value-of select="$to"/>
|
---|
538 |
|
---|
539 | <xsl:call-template name="replace-string">
|
---|
540 | <xsl:with-param name="text" select="$after"/>
|
---|
541 | <xsl:with-param name="from" select="$from"/>
|
---|
542 | <xsl:with-param name="to" select="$to"/>
|
---|
543 | </xsl:call-template>
|
---|
544 |
|
---|
545 | </xsl:when>
|
---|
546 | <xsl:otherwise>
|
---|
547 | <xsl:value-of select="$text"/>
|
---|
548 | </xsl:otherwise>
|
---|
549 | </xsl:choose>
|
---|
550 | </xsl:template>
|
---|
551 |
|
---|
552 | </xsl:stylesheet>
|
---|
553 | <!-- vim: et:ts=4:sw=4:sts=4
|
---|
554 | -->
|
---|