1<?xml version="1.0"?>
2<!-- To convert DroidDriver dump (say dd.xml) to UiAutomatorViewer format (say ua.uix), run: -->
3<!-- xsltproc -o ua.uix to-uiautomator.xsl dd.xml -->
4<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5  <xsl:strip-space elements="*" />
6  <xsl:template match="/">
7    <hierarchy rotation="0">
8      <xsl:apply-templates />
9    </hierarchy>
10  </xsl:template>
11  <xsl:template match="*">
12    <node>
13      <xsl:attribute name="index"><xsl:value-of select="position()-1" /></xsl:attribute>
14      <xsl:attribute name="text"><xsl:value-of select="@text" /></xsl:attribute>
15      <xsl:attribute name="resource-id"><xsl:value-of select="@resource-id" /></xsl:attribute>
16      <xsl:attribute name="class"><xsl:value-of select="@class" /></xsl:attribute>
17      <xsl:attribute name="package"><xsl:value-of select="@package" /></xsl:attribute>
18      <xsl:attribute name="content-desc"><xsl:value-of select="@content-desc" /></xsl:attribute>
19      <xsl:attribute name="checkable"><xsl:value-of select="boolean(@checkable)" /></xsl:attribute>
20      <xsl:attribute name="checked"><xsl:value-of select="boolean(@checked)" /></xsl:attribute>
21      <xsl:attribute name="clickable"><xsl:value-of select="boolean(@clickable)" /></xsl:attribute>
22      <xsl:attribute name="enabled"><xsl:value-of select="boolean(@enabled)" /></xsl:attribute>
23      <xsl:attribute name="focusable"><xsl:value-of select="boolean(@focusable)" /></xsl:attribute>
24      <xsl:attribute name="focused"><xsl:value-of select="boolean(@focused)" /></xsl:attribute>
25      <xsl:attribute name="scrollable"><xsl:value-of select="boolean(@scrollable)" /></xsl:attribute>
26      <xsl:attribute name="long-clickable"><xsl:value-of select="boolean(@long-clickable)" /></xsl:attribute>
27      <xsl:attribute name="password"><xsl:value-of select="boolean(@password)" /></xsl:attribute>
28      <xsl:attribute name="selected"><xsl:value-of select="boolean(@selected)" /></xsl:attribute>
29      <xsl:if test="@selection-start">
30        <xsl:attribute name="selection-start"><xsl:value-of select="@selection-start" /></xsl:attribute>
31      </xsl:if>
32      <xsl:if test="@selection-end">
33        <xsl:attribute name="selection-end"><xsl:value-of select="@selection-end" /></xsl:attribute>
34      </xsl:if>
35      <xsl:attribute name="bounds"><xsl:value-of select="@bounds" /></xsl:attribute>
36      <!-- These two attributes are added by DroidDriver to help diagnosis -->
37      <!-- They are intentionally named in a different style -->
38      <xsl:if test="@NotVisible">
39        <xsl:attribute name="NotVisible">true</xsl:attribute>
40      </xsl:if>
41      <xsl:if test="@VisibleBounds">
42        <xsl:attribute name="VisibleBounds"><xsl:value-of select="@VisibleBounds" /></xsl:attribute>
43      </xsl:if>
44      <xsl:apply-templates />
45    </node>
46  </xsl:template>
47</xsl:transform>