1 | <?xml version="1.0"?>
|
---|
2 | <!--
|
---|
3 | Copyright (C) 2020-2022 Oracle Corporation
|
---|
4 |
|
---|
5 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
6 | available from http://www.virtualbox.org. This file is free software;
|
---|
7 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
8 | General Public License (GPL) as published by the Free Software
|
---|
9 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
10 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
11 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
12 | -->
|
---|
13 | <xsl:stylesheet version="1.0"
|
---|
14 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
15 | xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
---|
16 | <xsl:output method="xml" omit-xml-declaration="no"/>
|
---|
17 | <!-- Don't include non matching elements in output -->
|
---|
18 | <xsl:template match="text()"/>
|
---|
19 | <xsl:strip-space elements="*"/>
|
---|
20 |
|
---|
21 | <!-- maybe a bit nicer way of adding a new line to the output -->
|
---|
22 | <xsl:variable name="newline"><xsl:text>
|
---|
23 | </xsl:text></xsl:variable>
|
---|
24 |
|
---|
25 | <xsl:variable name="inputFileName">
|
---|
26 | <xsl:text>UserManual.xhtml</xsl:text>
|
---|
27 | </xsl:variable>
|
---|
28 |
|
---|
29 | <xsl:template match="/">
|
---|
30 | <xsl:element name="QtHelpProject">
|
---|
31 | <xsl:attribute name="version">
|
---|
32 | <xsl:value-of select="format-number(1, '.0')" />
|
---|
33 | </xsl:attribute>
|
---|
34 | <xsl:value-of select="$newline" />
|
---|
35 | <xsl:element name="namespace">org.virtualbox</xsl:element>
|
---|
36 | <xsl:value-of select="$newline" />
|
---|
37 | <xsl:element name="virtualFolder">manual</xsl:element>
|
---|
38 | <xsl:value-of select="$newline" />
|
---|
39 | <xsl:element name="filterSection">
|
---|
40 | <xsl:value-of select="$newline" />
|
---|
41 | <xsl:element name="toc">
|
---|
42 | <xsl:apply-templates select="//xhtml:div[@class='toc']//xhtml:span[@class='chapter'] | //xhtml:div[@class='toc']//xhtml:span[@class='preface']"/>
|
---|
43 | </xsl:element><!-- toc -->
|
---|
44 | <xsl:value-of select="$newline" />
|
---|
45 | <!-- <xsl:element name="keywords"></xsl:element> -->
|
---|
46 | <xsl:value-of select="$newline" />
|
---|
47 | <xsl:element name="files">
|
---|
48 | <!-- ======================input html file(s)============================= -->
|
---|
49 | <xsl:value-of select="$newline" />
|
---|
50 | <!-- ====================chunked html input files========================== -->
|
---|
51 | <!-- Process div tag with class='toc'. For each space with class='chapter' -->
|
---|
52 | <!-- add a <file>ch(position()).html</file> assuming our docbook chunked html -->
|
---|
53 | <!-- files are named in this fashion. -->
|
---|
54 | <!-- <xsl:apply-templates select="//xhtml:div[@class='toc']//xhtml:span[@class='chapter']"/> -->
|
---|
55 | <!-- ====================single html input file========================== -->
|
---|
56 | <xsl:element name="file">
|
---|
57 | <xsl:value-of select="$inputFileName" />
|
---|
58 | </xsl:element>
|
---|
59 | <xsl:value-of select="$newline" />
|
---|
60 | <!-- ===================================================================== -->
|
---|
61 | <!-- ===================image files======================================= -->
|
---|
62 | <xsl:apply-templates select="//xhtml:img"/>
|
---|
63 | <!-- ===================================================================== -->
|
---|
64 |
|
---|
65 | </xsl:element>
|
---|
66 | <xsl:value-of select="$newline" />
|
---|
67 | </xsl:element>
|
---|
68 | <xsl:value-of select="$newline" />
|
---|
69 | </xsl:element>
|
---|
70 | </xsl:template>
|
---|
71 |
|
---|
72 | <!-- ===================toc related template(s)====================== -->
|
---|
73 | <xsl:template match="xhtml:span[@class='chapter'] | xhtml:span[@class='preface']">
|
---|
74 | <xsl:element name="section">
|
---|
75 | <xsl:attribute name="title">
|
---|
76 | <xsl:value-of select="*" />
|
---|
77 | </xsl:attribute>
|
---|
78 | <xsl:attribute name="ref">
|
---|
79 | <xsl:value-of select="$inputFileName" /><xsl:value-of select="xhtml:a/@href" />
|
---|
80 | </xsl:attribute>
|
---|
81 | </xsl:element>
|
---|
82 | <xsl:value-of select="$newline" />
|
---|
83 | </xsl:template>
|
---|
84 | <!-- ============================================================== -->
|
---|
85 |
|
---|
86 | <xsl:template match="//xhtml:img">
|
---|
87 | <xsl:element name="file">
|
---|
88 | <xsl:value-of select="@src"/>
|
---|
89 | </xsl:element>
|
---|
90 | <xsl:value-of select="$newline" />
|
---|
91 | </xsl:template>
|
---|
92 |
|
---|
93 |
|
---|
94 | </xsl:stylesheet>
|
---|