source: trunk/src/xmlpatterns/qtokenautomaton/qautomaton2cpp.xsl@ 350

Last change on this file since 350 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 12.6 KB
Line 
1<?xml version='1.0' encoding="UTF-8"?>
2<xsl:stylesheet version="2.0"
3 xml:lang="en"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns:local="http://www.w3.org/2005/xquery-local-functions"
6 xmlns:xs="http://www.w3.org/2001/XMLSchema">
7
8 <xsl:variable name="className" as="xs:string" select="tokenAutomaton/@className"/>
9 <xsl:variable name="defaultToken" as="xs:string" select="tokenAutomaton/@defaultToken"/>
10 <xsl:variable name="tokens" as="element(token)+" select="tokenAutomaton/tokens/token"/>
11 <xsl:variable name="tokenEnum" as="xs:string" select="tokenAutomaton/@tokenEnum"/>
12
13 <xsl:variable name="warningGenerated" as="xs:string">/* NOTE: This file is AUTO GENERATED by qautomaton2cpp.xsl. */&#xA;</xsl:variable>
14
15 <xsl:template match="tokenAutomaton">
16
17 <xsl:variable name="uniqueLengths" as="xs:integer+" select="distinct-values(tokens/token/string-length())"/>
18
19 <xsl:result-document method="text" href="{@headerFile}">
20
21 <xsl:variable name="includeGuardName" select="string(@includeGuardName)"/>
22
23 <xsl:value-of select="boilerplate/prolog"/>
24
25 <xsl:value-of select="$warningGenerated"/>
26
27 <xsl:text>&#xA;#ifndef </xsl:text>
28 <xsl:value-of select="$includeGuardName"/>
29 <xsl:text>&#xA;#define </xsl:text>
30 <xsl:value-of select="$includeGuardName"/>
31 <xsl:text>&#xA;&#xA;</xsl:text>
32
33 <xsl:text>#include &lt;QtCore/QString>&#xA;</xsl:text>
34 <xsl:text>&#xA;</xsl:text>
35 <xsl:text>QT_BEGIN_NAMESPACE&#xA;</xsl:text>
36 <xsl:text>&#xA;</xsl:text>
37
38 <xsl:if test="@namespace">
39 <xsl:text>namespace </xsl:text>
40 <xsl:value-of select="@namespace"/>