| 1 | <?xml version="1.0" encoding="UTF-8" ?>
|
|---|
| 2 | <!--
|
|---|
| 3 | /****************************************************************************
|
|---|
| 4 | **
|
|---|
| 5 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 6 | ** All rights reserved.
|
|---|
| 7 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 8 | **
|
|---|
| 9 | ** This file is part of the Patternist project on Qt Labs.
|
|---|
| 10 | **
|
|---|
| 11 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 12 | ** Commercial Usage
|
|---|
| 13 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 14 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 15 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 16 | ** a written agreement between you and Nokia.
|
|---|
| 17 | **
|
|---|
| 18 | ** GNU Lesser General Public License Usage
|
|---|
| 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 20 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 21 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 22 | ** packaging of this file. Please review the following information to
|
|---|
| 23 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 24 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 25 | **
|
|---|
| 26 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 27 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this 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 have questions regarding the use of this file, please contact
|
|---|
| 39 | ** Nokia 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) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 95 | ** All rights reserved.
|
|---|
| 96 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 97 | **
|
|---|
| 98 | ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
|
|---|
| 99 | **
|
|---|
| 100 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 101 | ** Commercial Usage
|
|---|
| 102 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 103 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 104 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 105 | ** a written agreement between you and Nokia.
|
|---|
| 106 | **
|
|---|
| 107 | ** GNU Lesser General Public License Usage
|
|---|
| 108 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 109 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 110 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 111 | ** packaging of this file. Please review the following information to
|
|---|
| 112 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 113 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 114 | **
|
|---|
| 115 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 116 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 117 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this 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 have questions regarding the use of this file, please contact
|
|---|
| 128 | ** Nokia 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 | /**
|
|---|
| 246 | * XML Schema error code.
|
|---|
| 247 | */
|
|---|
| 248 | XSDError,
|
|---|
| 249 |
|
|---|
| 250 | <!-- The order of the calls is significant. The templates takes into account
|
|---|
| 251 | to avoid the last comma(extractXSLT20 does this). -->
|
|---|
| 252 | <xsl:call-template name="extractXQuery10"/>
|
|---|
| 253 | <xsl:call-template name="extractXQueryFO"/>
|
|---|
| 254 | <xsl:call-template name="extractSerialization"/>
|
|---|
| 255 | <xsl:call-template name="extractXSLT20"/>
|
|---|
| 256 | };
|
|---|
| 257 | <xsl:text disable-output-escaping="yes"><![CDATA[
|
|---|
| 258 | /**
|
|---|
| 259 | * Issues a warning, should not be used excessively. This can
|
|---|
| 260 | * be used to communicate that a certain implementation defined
|
|---|
| 261 | * feature is unsupported or that a certain expression most likely
|
|---|
| 262 | * doesn't do what the users wants, to name a few examples.
|
|---|
| 263 | *
|
|---|
| 264 | * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
|
|---|
| 265 | * 2.3 Error Handling</a>
|
|---|
| 266 | * @param message the message to be read by the user.
|
|---|
| 267 | * @param sourceLocation the location of where the warning originates from.
|
|---|
| 268 | */
|
|---|
| 269 | void warning(const QString &message, const QSourceLocation &sourceLocation = QSourceLocation());
|
|---|
| 270 |
|
|---|
| 271 | /**
|
|---|
| 272 | * Issues an error. May be used at the static analysis phase or
|
|---|
| 273 | * the dynamic evaluation phase.
|
|---|
| 274 | *
|
|---|
| 275 | * For SourceLocationReflection instances, the overload taking an SouourceLocationReflection should be used.
|
|---|
| 276 | *
|
|---|
| 277 | * @see <a href="http://www.w3.org/TR/xpath20/#errors">XML Path Language (XPath) 2.0,
|
|---|
| 278 | * 2.3 Error Handling</a>
|
|---|
| 279 | * @param message the message to be read by the user.
|
|---|
| 280 | * @param errorCode identifies the error condition, as described
|
|---|
| 281 | * @param sourceLocation the location of where the error originates from
|
|---|
| 282 | * in "XML Path Language (XPath) 2.0" section "G Error Conditions"
|
|---|
| 283 | */
|
|---|
| 284 | void error(const QString &message,
|
|---|
| 285 | const ReportContext::ErrorCode errorCode,
|
|---|
| 286 | const QSourceLocation &sourceLocation);
|
|---|
| 287 |
|
|---|
| 288 | /**
|
|---|
| 289 | * Overload.
|
|---|
| 290 | *
|
|---|
| 291 | * Same as the above, but passes the SourceLocationReflection as reference for error reporting.
|
|---|
| 292 | */
|
|---|
| 293 | void error(const QString &message,
|
|---|
| 294 | const ReportContext::ErrorCode errorCode,
|
|---|
| 295 | const SourceLocationReflection *reflection);
|
|---|
| 296 |
|
|---|
| 297 | /**
|
|---|
| 298 | * Issues an error which is not identified in the XPath specifications. This function
|
|---|
| 299 | * is among other things used for implementing the <tt>fn:error()</tt> function.
|
|---|
| 300 | */
|
|---|
| 301 | void error(const QString &message,
|
|---|
| 302 | const QXmlName qName,
|
|---|
| 303 | const SourceLocationReflection *const r);
|
|---|
| 304 |
|
|---|
| 305 | /**
|
|---|
| 306 | * @return the QAbstractMessageHandler which functions such as warning() and
|
|---|
| 307 | * error() should submit messages to. This function
|
|---|
| 308 | * may never return @c null; a valid QAbstractMessageHandler pointer must always be returned.
|
|---|
| 309 | */
|
|---|
| 310 | virtual QAbstractMessageHandler *messageHandler() const = 0;
|
|---|
| 311 |
|
|---|
| 312 | virtual NamePool::Ptr namePool() const = 0;
|
|---|
| 313 |
|
|---|
| 314 | /**
|
|---|
| 315 | * Returns a string representation of the error code @p code.
|
|---|
| 316 | *
|
|---|
| 317 | * @see ReportContext::ErrorCode
|
|---|
| 318 | * @param errorCode identifies the error condition, as described
|
|---|
| 319 | * in <a href="http://www.w3.org/TR/xpath20/#id-errors">XML Path
|
|---|
| 320 | * Language (XPath) 2.0, G Error Conditions</a>
|
|---|
| 321 | */
|
|---|
| 322 | static QString codeToString(const ReportContext::ErrorCode errorCode);
|
|---|
| 323 |
|
|---|
| 324 | /**
|
|---|
| 325 | * @returns the error code part of @p typeURI and sets @p uri to the error namespace. Note
|
|---|
| 326 | * that the error namespace not necessarily is the namespace for XPath and
|
|---|
| 327 | * XQuery errors, http://www.w3.org/2005/xqt-errors, but can be user defined.
|
|---|
| 328 | */
|
|---|
| 329 | static QString codeFromURI(const QString &typeURI,
|
|---|
| 330 | QString &uri);
|
|---|
| 331 |
|
|---|
| 332 | /**
|
|---|
| 333 | * @short Returns the source location applying for @p reflection.
|
|---|
| 334 | */
|
|---|
| 335 | virtual QSourceLocation locationFor(const SourceLocationReflection *const reflection) const = 0;
|
|---|
| 336 |
|
|---|
| 337 | /**
|
|---|
| 338 | * Resolves @p relative against @p baseURI, possibly using a URI resolver.
|
|---|
| 339 | */
|
|---|
| 340 | QUrl resolveURI(const QUrl &relative,
|
|---|
| 341 | const QUrl &baseURI) const;
|
|---|
| 342 |
|
|---|
| 343 | /**
|
|---|
| 344 | * @short The URI resolver in use.
|
|---|
| 345 | *
|
|---|
| 346 | * If no URI resolver is in use, a @c null pointer is returned.
|
|---|
| 347 | *
|
|---|
| 348 | * @note You should probably use resolveURI(), which handles the case of
|
|---|
| 349 | * when uriResolver() is @c null.
|
|---|
| 350 | */
|
|---|
| 351 | virtual QAbstractUriResolver *uriResolver() const = 0;
|
|---|
| 352 |
|
|---|
| 353 | private:
|
|---|
| 354 | void createError(const QString &description,
|
|---|
| 355 | const QtMsgType type,
|
|---|
| 356 | const QUrl &id,
|
|---|
| 357 | const QSourceLocation &sourceLocation) const;
|
|---|
| 358 | static inline QString finalizeDescription(const QString &desc);
|
|---|
| 359 | QSourceLocation lookupSourceLocation(const SourceLocationReflection *const ref) const;
|
|---|
| 360 |
|
|---|
| 361 | Q_DISABLE_COPY(ReportContext)
|
|---|
| 362 | };
|
|---|
| 363 |
|
|---|
| 364 | /**
|
|---|
| 365 | * @short This is the class type that is being thrown when a query error occur.
|
|---|
| 366 | *
|
|---|
| 367 | * @relates ReportContext
|
|---|
| 368 | */
|
|---|
| 369 | typedef bool Exception;
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | QT_END_NAMESPACE
|
|---|
| 373 |
|
|---|
| 374 | QT_END_HEADER
|
|---|
| 375 |
|
|---|
| 376 | #endif]]></xsl:text>
|
|---|
| 377 | </xsl:template>
|
|---|
| 378 | <!--
|
|---|
| 379 | *********************************************
|
|---|
| 380 | *********************************************
|
|---|
| 381 | -->
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 | <!--
|
|---|
| 387 | *********************************************
|
|---|
| 388 | XQuery 1.0 and XPath 2.0 Functions and Operators
|
|---|
| 389 | *********************************************
|
|---|
| 390 | -->
|
|---|
| 391 | <xsl:template name="extractXQueryFO">
|
|---|
| 392 | <xsl:apply-templates mode="xqfo" select="$xqfo/h:html/h:body/h:div[@class = 'back']//
|
|---|
| 393 | h:div[h:h2/h:a/@id = 'error-summary']/h:dl/h:dt"/>
|
|---|
| 394 | </xsl:template>
|
|---|
| 395 |
|
|---|
| 396 | <xsl:template mode="xqfo" match="h:dt">
|
|---|
| 397 | /**<xsl:call-template name="formatDocs">
|
|---|
| 398 | <xsl:with-param name="content" select="substring(., 15)"/>
|
|---|
| 399 | </xsl:call-template>
|
|---|
| 400 | */
|
|---|
| 401 | <xsl:value-of select="substring(h:a/@name, 4)"/>,
|
|---|
| 402 | </xsl:template>
|
|---|
| 403 | <!--
|
|---|
| 404 | *********************************************
|
|---|
| 405 | *********************************************
|
|---|
| 406 | -->
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 | <!--
|
|---|
| 412 | *********************************************
|
|---|
| 413 | XQuery 1.0: An XML Query Language
|
|---|
| 414 | *********************************************
|
|---|
| 415 | -->
|
|---|
| 416 | <xsl:template name="extractXQuery10">
|
|---|
| 417 | <xsl:apply-templates mode="xquery10" select="$xq/h:html/h:body/h:div[@class = 'back']//
|
|---|
| 418 | h:div[h:h2/h:a/@id = 'id-errors']/h:dl/h:dt"/>
|
|---|
| 419 | </xsl:template>
|
|---|
| 420 |
|
|---|
| 421 | <xsl:template mode="xquery10" match="h:dt">
|
|---|
| 422 | /**<xsl:call-template name="formatDocs">
|
|---|
| 423 | <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
|
|---|
| 424 | </xsl:call-template>
|
|---|
| 425 | */
|
|---|
| 426 | <xsl:value-of select="substring(., 5)"/>,
|
|---|
| 427 | </xsl:template>
|
|---|
| 428 | <!--
|
|---|
| 429 | *********************************************
|
|---|
| 430 | *********************************************
|
|---|
| 431 | -->
|
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 | <!--
|
|---|
| 436 | *********************************************
|
|---|
| 437 | XSL Transformations (XSLT) Version 2.0
|
|---|
| 438 | *********************************************
|
|---|
| 439 | -->
|
|---|
| 440 | <xsl:template name="extractXSLT20">
|
|---|
| 441 | <xsl:apply-templates mode="xslt20" select="$xslt20/h:html/h:body/h:div[@class = 'back']//
|
|---|
| 442 | h:div[@class = 'div1' and h:h2/h:a/@id = 'error-summary']/h:dl/h:dt"/>
|
|---|
| 443 | </xsl:template>
|
|---|
| 444 |
|
|---|
| 445 | <xsl:template mode="xslt20" match="h:dt">
|
|---|
| 446 | /**<xsl:call-template name="formatDocs">
|
|---|
| 447 | <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
|
|---|
| 448 | </xsl:call-template>
|
|---|
| 449 | */
|
|---|
| 450 | <xsl:value-of select="normalize-space(substring(h:a/h:span, 4))"/>
|
|---|
| 451 |
|
|---|
| 452 | <xsl:if test="position() != last()">,</xsl:if>
|
|---|
| 453 | <xsl:text>
</xsl:text>
|
|---|
| 454 | </xsl:template>
|
|---|
| 455 | <!--
|
|---|
| 456 | *********************************************
|
|---|
| 457 | *********************************************
|
|---|
| 458 | -->
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 | <!--
|
|---|
| 463 | *********************************************
|
|---|
| 464 | XSLT 2.0 and XQuery 1.0 Serialization
|
|---|
| 465 | *********************************************
|
|---|
| 466 | -->
|
|---|
| 467 | <xsl:template name="extractSerialization">
|
|---|
| 468 | <xsl:apply-templates mode="ser" select="$ser/h:html/h:body/h:div[@class = 'back']//
|
|---|
| 469 | h:div[@class = 'div1' and h:h2/h:a/@id = 'id-errors']/h:dl/h:dt"/>
|
|---|
| 470 | </xsl:template>
|
|---|
| 471 |
|
|---|
| 472 | <xsl:template mode="ser" match="h:dt">
|
|---|
| 473 | /**<xsl:call-template name="formatDocs">
|
|---|
| 474 | <xsl:with-param name="content" select="following-sibling::h:dd/h:p"/>
|
|---|
| 475 | </xsl:call-template>
|
|---|
| 476 | */
|
|---|
| 477 | <xsl:value-of select="substring(., 5)"/>,
|
|---|
| 478 | </xsl:template>
|
|---|
| 479 | <!--
|
|---|
| 480 | *********************************************
|
|---|
| 481 | *********************************************
|
|---|
| 482 | -->
|
|---|
| 483 |
|
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 |
|
|---|
| 487 | <!-- Random stuff -->
|
|---|
| 488 | <xsl:template name="formatDocs">
|
|---|
| 489 | <xsl:param name="content"/>
|
|---|
| 490 |
|
|---|
| 491 | <xsl:call-template name="internalFormatDocs">
|
|---|
| 492 | <xsl:with-param name="content">
|
|---|
| 493 | <!-- Escape # in order to keep Doxygen happy. -->
|
|---|
| 494 | <xsl:call-template name="replace-string">
|
|---|
| 495 | <xsl:with-param name="text" select="translate(normalize-space($content), ' ', '')"/>
|
|---|
| 496 | <xsl:with-param name="from" select="' #'"/>
|
|---|
| 497 | <xsl:with-param name="to" select="' \#'"/>
|
|---|
| 498 | </xsl:call-template>
|
|---|
| 499 | </xsl:with-param>
|
|---|
| 500 | </xsl:call-template>
|
|---|
| 501 |
|
|---|
| 502 | </xsl:template>
|
|---|
| 503 |
|
|---|
| 504 | <xsl:template name="internalFormatDocs">
|
|---|
| 505 | <xsl:param name="content"/>
|
|---|
| 506 |
|
|---|
| 507 | <xsl:variable name="nextText" select="substring($content, 61)"/>
|
|---|
| 508 | <xsl:variable name="afterSpace" select="substring-after($nextText, ' ')"/>
|
|---|
| 509 | * <xsl:value-of select="substring($content, 1, 60)"/>
|
|---|
| 510 | <xsl:value-of select="substring-before($nextText, ' ')"/>
|
|---|
| 511 | <xsl:choose>
|
|---|
| 512 | <xsl:when test="string-length($afterSpace) = 0"><xsl:value-of select="$nextText"/>
|
|---|
| 513 | </xsl:when>
|
|---|
| 514 | <xsl:when test="string-length($afterSpace) < 60">
|
|---|
| 515 | * <xsl:value-of select="$afterSpace"/>
|
|---|
| 516 | </xsl:when>
|
|---|
| 517 | <xsl:when test="string-length($nextText)">
|
|---|
| 518 | <xsl:call-template name="formatDocs">
|
|---|
| 519 | <xsl:with-param name="content"
|
|---|
| 520 | select="$afterSpace"/>
|
|---|
| 521 | </xsl:call-template>
|
|---|
| 522 | </xsl:when>
|
|---|
| 523 | </xsl:choose>
|
|---|
| 524 | </xsl:template>
|
|---|
| 525 |
|
|---|
| 526 | <!--
|
|---|
| 527 | reusable replace-string function
|
|---|
| 528 | http://aspn.activestate.com/ASPN/Cookbook/XSLT/Recipe/65426
|
|---|
| 529 | -->
|
|---|
| 530 | <xsl:template name="replace-string">
|
|---|
| 531 | <xsl:param name="text"/>
|
|---|
| 532 | <xsl:param name="from"/>
|
|---|
| 533 | <xsl:param name="to"/>
|
|---|
| 534 |
|
|---|
| 535 | <xsl:choose>
|
|---|
| 536 | <xsl:when test="contains($text, $from)">
|
|---|
| 537 |
|
|---|
| 538 | <xsl:variable name="before" select="substring-before($text, $from)"/>
|
|---|
| 539 | <xsl:variable name="after" select="substring-after($text, $from)"/>
|
|---|
| 540 |
|
|---|
| 541 | <xsl:value-of select="$before"/>
|
|---|
| 542 | <xsl:value-of select="$to"/>
|
|---|
| 543 |
|
|---|
| 544 | <xsl:call-template name="replace-string">
|
|---|
| 545 | <xsl:with-param name="text" select="$after"/>
|
|---|
| 546 | <xsl:with-param name="from" select="$from"/>
|
|---|
| 547 | <xsl:with-param name="to" select="$to"/>
|
|---|
| 548 | </xsl:call-template>
|
|---|
| 549 |
|
|---|
| 550 | </xsl:when>
|
|---|
| 551 | <xsl:otherwise>
|
|---|
| 552 | <xsl:value-of select="$text"/>
|
|---|
| 553 | </xsl:otherwise>
|
|---|
| 554 | </xsl:choose>
|
|---|
| 555 | </xsl:template>
|
|---|
| 556 |
|
|---|
| 557 | </xsl:stylesheet>
|
|---|
| 558 | <!-- vim: et:ts=4:sw=4:sts=4
|
|---|
| 559 | -->
|
|---|