xml - XSL query for KeePass (Specific Entry) -


my target extract specific keys out of keypass(2.x) xml format xsl.

the keypass xml looks this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <keepassfile>     <meta>         <generator>keepass</generator>     </meta>     <root>         <group>             <uuid>nqdrftuxs0siwvpehbpong==</uuid>             <name>exampledatabase</name>             <entry>                 <string>                     <key>notes</key>                     <value>notes</value>                 </string>                 <string>                     <key>password</key>                     <value protectinmemory="true">password</value>                 </string>                 <string>                     <key>title</key>                     <value>sample entry</value>                 </string>                 <string>                     <key>url</key>                     <value>http://keepass.info/</value>                 </string>                 <string>                     <key>username</key>                     <value>user name</value>                 </string>             </entry>             <entry>                 <string>                     <key>password</key>                     <value protectinmemory="true">12345</value>                 </string>                 <string>                     <key>title</key>                     <value>sample entry #2</value>                 </string>                 <string>                     <key>url</key>                     <value>http://keepass.info/help/kb/testform.html</value>                 </string>                 <string>                     <key>username</key>                     <value>michael321</value>                 </string>             </entry>             <group>                 <uuid>mec/n7hkf0uzmdmrzyao7a==</uuid>                 <name>general</name>             </group>             <group>                 <uuid>mbkjfmgv6uoqqmxlmhzt/a==</uuid>                 <name>windows</name>             </group>             <group>                 <uuid>ckbqjw0rwukdut/go0enjg==</uuid>                 <name>network</name>             </group>             <group>                 <uuid>b6ykdaooskoj6+uvrgdurq==</uuid>                 <name>internet</name>             </group>             <group>                 <uuid>4ig7yyeay0yhbnuutjmx5a==</uuid>                 <name>email</name>                 <entry>                     <string>                         <key>notes</key>                         <value>some note</value>                     </string>                     <string>                         <key>password</key>                         <value protectinmemory="true">1.os0mnye6esel1ygntsx6</value>                     </string>                     <string>                         <key>title</key>                         <value>entry1</value>                     </string>                     <string>                         <key>url</key>                         <value />                     </string>                     <string>                         <key>username</key>                         <value>some@email.com</value>                     </string>                     <history>                         <entry>                             <string>                                 <key>notes</key>                                 <value>some note</value>                             </string>                             <string>                                 <key>password</key>                                 <value protectinmemory="true">os0mnye6esel1ygntsx6</value>                             </string>                             <string>                                 <key>title</key>                                 <value>entry1</value>                             </string>                             <string>                                 <key>url</key>                                 <value />                             </string>                             <string>                                 <key>username</key>                                 <value>firstemail@adress.com</value>                             </string>                         </entry>                     </history>                 </entry>                 <entry>                     <string>                         <key>notes</key>                         <value>some note</value>                     </string>                     <string>                         <key>password</key>                         <value protectinmemory="true">2.rlyocgzdirnjbjcu8td2</value>                     </string>                     <string>                         <key>title</key>                         <value>entry2</value>                     </string>                     <string>                         <key>url</key>                         <value />                     </string>                     <string>                         <key>username</key>                         <value>secondemail@adress.com</value>                     </string>                     <history>                         <entry>                             <string>                                 <key>notes</key>                                 <value>login für den plesk server.</value>                             </string>                             <string>                                 <key>password</key>                                 <value protectinmemory="true">rlyocgzdirnjbjcu8td2</value>                             </string>                             <string>                                 <key>title</key>                                 <value>entry2</value>                             </string>                             <string>                                 <key>url</key>                                 <value />                             </string>                             <string>                                 <key>username</key>                                 <value>adress@bla.com</value>                             </string>                         </entry>                     </history>                 </entry>                 <entry>                     <string>                         <key>notes</key>                         <value>some note</value>                     </string>                     <string>                         <key>password</key>                         <value protectinmemory="true">3.rzjsbtek29ms1gnuitlb</value>                     </string>                     <string>                         <key>title</key>                         <value>entry3</value>                     </string>                     <string>                         <key>url</key>                         <value />                     </string>                     <string>                         <key>username</key>                         <value>thirdemail@adress.com</value>                     </string>                     <history>                         <entry>                             <string>                                 <key>notes</key>                                 <value>some note</value>                             </string>                             <string>                                 <key>password</key>                                 <value protectinmemory="true">rzjsbtek29ms1gnuitlb</value>                             </string>                             <string>                                 <key>title</key>                                 <value>entry3</value>                             </string>                             <string>                                 <key>url</key>                                 <value />                             </string>                             <string>                                 <key>username</key>                                 <value>thirdemail@adress.com</value>                             </string>                         </entry>                     </history>                 </entry>                 <entry>                     <string>                         <key>notes</key>                         <value>some note</value>                     </string>                     <string>                         <key>password</key>                         <value protectinmemory="true">4.8bonlqkfkrhppdtl3luh</value>                     </string>                     <string>                         <key>title</key>                         <value>entry4</value>                     </string>                     <string>                         <key>url</key>                         <value />                     </string>                     <string>                         <key>username</key>                         <value>email@adress.com</value>                     </string>                     <history>                         <entry>                             <string>                                 <key>notes</key>                                 <value>some note</value>                             </string>                             <string>                                 <key>password</key>                                 <value protectinmemory="true">8bonlqkfkrhppdtl3luh</value>                             </string>                             <string>                                 <key>title</key>                                 <value>entry4</value>                             </string>                             <string>                                 <key>url</key>                                 <value />                             </string>                             <string>                                 <key>username</key>                                 <value>email@adress.com</value>                             </string>                         </entry>                     </history>                 </entry>             </group>             <group>                 <uuid>a/oasmuege+zbzepvrtjow==</uuid>                 <name>homebanking</name>             </group>         </group>         <deletedobjects />     </root> </keepassfile> 

i want access value of single 'value' tag. example value of group email in kategory title or password. value (email/title:) 'entry1'. need xsl gather information of keepass.xml.

i assume mean username key, occurs 4 times in group, once in each child entry. in case need select third entry obtain third email. in code can achieve using positional predicate entry:

<xsl:for-each select="./entry[3]/string">     <xsl:if test="key='username'">         <xsl:value-of select="value"/>         <xsl:text>&#xa;</xsl:text>     </xsl:if> </xsl:for-each>  

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -