1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
- <xsl : stylesheet version =" 1.0"
3
- xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" >
4
- <!-- Convert KeePass XML (2.x) format ClickStudios PasswordState Import
5
- format
6
- Toni Comerma September 2013
7
- Copyright (c) 2013 Toni Comerma - Televisió de Catalunya.
8
- GNU GENERAL PUBLIC LICENSE - See attached License File
9
-
10
- Based on LiosK/keepass2keeper.xsl (https://gist.github.com/LiosK/388889)
11
- -->
12
-
13
- <!-- Config Section -->
14
- <xsl : param name =" PasswordListID" >14</xsl : param >
15
- <xsl : param name =" AccountType" />
16
-
17
-
18
- <!-- Code Section -->
19
-
20
- <xsl : variable name =" cometa" >"</xsl : variable >
21
-
2
+ <xsl : stylesheet version =" 1.0" xmlns : xsl =" http://www.w3.org/1999/XSL/Transform" >
22
3
<xsl : output method =" text" encoding =" utf-8" />
4
+ <xsl : variable name =" cometa" >"</xsl : variable >
23
5
24
6
<xsl : template match =" /" >
25
7
<!-- Header Row -->
26
- <xsl : text >PasswordListID,Title,UserName,Description,AccountType,Notes,URL,Password,ExpiryDate,GenericField1,GenericField2,GenericField3,GenericField4,GenericField5,GenericField6,GenericField7,GenericField8,GenericField9,GenericField10
27
- </xsl : text >
8
+ <xsl : text >Title,UserName,Password,Url,Notes </xsl : text >
28
9
<xsl : apply-templates select =" /KeePassFile/Root/Group" />
29
10
</xsl : template >
30
11
12
+ <!-- These groups will be ignored -->
13
+ <xsl : template match =" Group[Name='Recycle Bin']" />
14
+
31
15
<xsl : template match =" Group" >
32
16
<xsl : param name =" parent" select =" '/'" />
33
17
<xsl : variable name =" current" select =" concat($parent, Name)" />
43
27
</xsl : apply-templates >
44
28
</xsl : template >
45
29
46
-
47
30
<xsl : template match =" Entry" >
48
31
<xsl : param name =" group" />
49
32
56
39
<xsl : with-param name =" by" select =" concat($cometa,$cometa)" />
57
40
</xsl : call-template >
58
41
</xsl : if >
42
+ <xsl : text >From KeePass conversion, Group: </xsl : text >
43
+ <xsl : value-of select =" $group" />
44
+ <xsl : text >, Icon: </xsl : text >
45
+ <xsl : call-template name =" iconName" >
46
+ <xsl : with-param name =" iconId" select =" IconID" />
47
+ </xsl : call-template >
59
48
</xsl : variable >
60
49
61
50
<!-- Escape Double quotes in password field -->
69
58
</xsl : if >
70
59
</xsl : variable >
71
60
72
- <!-- Escape Double quotes in password field (yes, someone put quotes in that field too)-->
61
+ <!-- Escape Double quotes in URL field (yes, someone put quotes in that field too)-->
73
62
<xsl : variable name =" url" >
74
63
<xsl : if test =" String[Key='URL']/Value!=''" >
75
64
<xsl : call-template name =" string-replace-all" >
92
81
</xsl : choose >
93
82
</xsl : variable >
94
83
95
- <!-- Fix wrong dates (year 2999) -->
96
- <xsl : variable name =" date" >
97
- <xsl : call-template name =" replaceDate" >
98
- <xsl : with-param name =" value" select =" Times/ExpiryTime" />
99
- </xsl : call-template >
100
- </xsl : variable >
101
-
102
- <!-- put tab-separated fields: Title, UserName, Password, Notes, Group,
103
- URL, JSON -->
84
+ <!-- put CSV fields: Title, UserName, Password, Group, URL, Notes -->
104
85
<xsl : text >"</xsl : text >
105
- <xsl : value-of select =" $PasswordListID" />
106
- <xsl : text >","</xsl : text >
107
86
<xsl : value-of select =" $title" />
108
87
<xsl : text >","</xsl : text >
109
88
<xsl : value-of select =" String[Key='UserName']/Value" />
110
89
<xsl : text >","</xsl : text >
111
- <xsl : value-of select =" $group" />
112
- <xsl : text >","</xsl : text >
113
- <xsl : value-of select =" $AccountType" />
114
- <xsl : text >","</xsl : text >
115
- <xsl : value-of select =" $notes" />
90
+ <xsl : value-of select =" $password" />
116
91
<xsl : text >","</xsl : text >
117
92
<xsl : value-of select =" $url" />
118
93
<xsl : text >","</xsl : text >
119
- <xsl : value-of select =" $password" />
120
- <xsl : text >","</xsl : text >
121
- <xsl : value-of select =" $date" />
94
+ <xsl : value-of select =" $notes" />
122
95
<xsl : text >" </xsl : text >
123
96
</xsl : template >
124
97
165
138
</xsl : choose >
166
139
</xsl : template >
167
140
168
- <xsl : template name =" replaceDate " >
169
- <xsl : param name =" value " />
141
+ <xsl : template name =" iconName " >
142
+ <xsl : param name =" iconId " />
170
143
<xsl : choose >
171
- <xsl : when test =" $value!=''" >
172
- <xsl : choose >
173
- <xsl : when test =" substring($value,1,4) > 2020" >
174
- <xsl : text >2020-12-31T23:59:59Z</xsl : text >
175
- </xsl : when >
176
- <xsl : otherwise >
177
- <xsl : value-of select =" $value" />
178
- </xsl : otherwise >
179
- </xsl : choose >
180
- </xsl : when >
181
- <xsl : otherwise >
182
- <xsl : value-of select =" $value" />
183
- </xsl : otherwise >
144
+ <xsl : when test =" $iconId=0" >Default Key</xsl : when >
145
+ <xsl : when test =" $iconId=43" >Trash Bin</xsl : when >
146
+ <xsl : when test =" $iconId=45" >Red X</xsl : when >
147
+ <xsl : otherwise >
148
+ <xsl : value-of select =" $iconId" />
149
+ </xsl : otherwise >
184
150
</xsl : choose >
185
151
</xsl : template >
152
+
186
153
</xsl : stylesheet >
0 commit comments