-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsms.xsl
138 lines (137 loc) · 3.67 KB
/
sms.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:functx="http://www.functx.com"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://android.riteshsahu.com">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<head>
<style type="text/css">
body
{
font-family:arial,sans-serif;
color:#000;
font-size:13px;
color:#333;
}
table
{
font-size:1em;
margin:0 0 1em;
border-collapse:collapse;
border-width:0;
empty-cells:show;
}
td,th
{
border:1px solid #ccc;
padding:6px 12px;
text-align:left;
vertical-align:top;
background-color:inherit;
}
th
{
background-color:#dee8f1;
}
</style>
</head>
<body>
<h2>SMS Messages</h2>
<table>
<colgroup>
<col style="width:80px"/>
<col style="width:120px"/>
<col style="width:120px"/>
<col style="width:160px"/>
</colgroup>
<tr>
<th>Type</th>
<th>Number</th>
<th>Contact</th>
<th>Date</th>
<th>Message</th>
</tr>
<xsl:for-each select="smses/*">
<!-- the following xsl:sort line sorts all messages by date, interleaving SMS and MMS -->
<xsl:sort select="@date"/>
<tr>
<!-- comment out the next xsl:if and its closing tag to output ALL messages, not just those matching a certain contact name -->
<xsl:if test="contains(@contact_name, 'CONTACT_NAME')">
<xsl:choose>
<xsl:when test="name() = 'sms'">
<td>
<xsl:if test="@type = 1">
Received
</xsl:if>
<xsl:if test="@type = 2">
Sent
</xsl:if>
<xsl:if test="@type = 3">
Draft
</xsl:if>
</td>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:if test="@msg_box = 1">
Received
</xsl:if>
<xsl:if test="@msg_box = 2">
Sent
</xsl:if>
<xsl:if test="@msg_box = 3">
Draft
</xsl:if>
</td>
</xsl:otherwise>
</xsl:choose>
<td>
<xsl:if test="addrs/addr[3]/@address != 0">
<xsl:value-of select="addrs/addr[1]/@address"/>
<xsl:text> to </xsl:text>
</xsl:if>
<xsl:value-of select="@address"/>
</td>
<td><xsl:value-of select="@contact_name"/></td>
<td><xsl:value-of select="@readable_date"/></td>
<td>
<xsl:choose>
<xsl:when test="name() = 'sms'">
<xsl:value-of select="@body"/>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="parts/part">
<xsl:choose>
<xsl:when test="@ct = 'application/smil'">
</xsl:when>
<xsl:when test="@ct = 'text/plain'">
<xsl:value-of select="@text"/><br/>
</xsl:when>
<xsl:when test="starts-with(@ct,'image/')" >
<img height="300">
<xsl:attribute name="src">
<xsl:value-of select="concat(concat('data:',@ct), concat(';base64,',@data))"/>
</xsl:attribute>
</img><br/>
</xsl:when>
<xsl:otherwise>
<i>Preview of <xsl:value-of select="@ct"/> not supported.</i><br/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</td>
<!-- the xsl:if line below is associated with the specific contact output line above -->
</xsl:if>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>