-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtm_to_qml.xsl
47 lines (39 loc) · 1.2 KB
/
htm_to_qml.xsl
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
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="html">
<qt>
<xsl:attribute name="title"><xsl:value-of select="normalize-space(head/title)"/></xsl:attribute>
<xsl:apply-templates select="node()"/>
</qt>
</xsl:template>
<xsl:template match="head">
</xsl:template>
<xsl:template match="body">
<xsl:apply-templates select="node()"/>
</xsl:template>
<xsl:template match="h1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<p>Version: <xsl:value-of select="$version"/></p>
</xsl:template>
<xsl:template match="a[@href]">
<xsl:choose>
<xsl:when test="starts-with(@href,'http:')">
<xsl:apply-templates select="node()"/>
(see <xsl:value-of select="string(@href)"/>)
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>