File: devhelp2qch.xsl

package info (click to toggle)
cppreference-doc 20170409-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 259,868 kB
  • sloc: xml: 570,184; python: 1,923; php: 520; makefile: 167; sh: 25; cpp: 9; ansic: 9
file content (88 lines) | stat: -rw-r--r-- 2,787 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2012  Povilas Kanapickas <povilas@radix.lt>

    This file is part of cppreference-doc

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see http://www.gnu.org/licenses/.
-->
<xsl:stylesheet version="1.0"
                xmlns:devhelp="http://www.devhelp.net/book"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:str="http://exslt.org/strings"
                >

<xsl:param name="qch-namespace" select="'cppreference.com'" />
<xsl:param name="qch-virtual-folder" select="'cpp'" />

<xsl:output indent="yes"/>

<xsl:template match="/devhelp:book">
  <QtHelpProject version="1.0">
    <namespace>
      <xsl:value-of select="concat($qch-namespace, '.', @name)" />
    </namespace>
    <virtualFolder>
      <xsl:value-of select="$qch-virtual-folder" />
    </virtualFolder>

    <customFilter name="{@title}">
      <filterAttribute>
        <xsl:value-of select="@name" />
      </filterAttribute>
    </customFilter>

    <filterSection>
      <filterAttribute>
        <xsl:value-of select="@name" />
      </filterAttribute>

      <toc>
        <section title="{@title}" ref="{@link}">
          <xsl:apply-templates select="devhelp:chapters/devhelp:sub" />
        </section>
      </toc>

      <keywords>
        <xsl:apply-templates select="devhelp:functions/devhelp:keyword" />
      </keywords>

      <files>
        <xsl:copy-of select="document('output/qch-files.xml')/files/*"/>
      </files>

    </filterSection>
  </QtHelpProject>
</xsl:template>

<xsl:template match="devhelp:sub">
  <section title="{@name}" ref="{@link}">
    <xsl:apply-templates select="devhelp:sub" />
  </section>
</xsl:template>

<xsl:template match="devhelp:keyword">
  <xsl:if test="@name != ''">
    <keyword name="{@name}" id="{@name}" ref="{@link}" />
    <!-- Add an additional id for libc++ users -->
    <xsl:if test="starts-with(@name, 'std::')">
      <keyword name="{@name}" id="{concat('std::__LIBCPP_ABI_VERSION::', substring(@name, 6))}" ref="{@link}" />
      <keyword name="{@name}" id="{concat('std::__1::', substring(@name, 6))}" ref="{@link}" />
    </xsl:if>
  </xsl:if>
</xsl:template>

</xsl:stylesheet>