<?xml version="1.0" encoding="utf-8"?>
<bag
   xsl:version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:exsl="http://exslt.org/common" 
   exsl:keep_exsl_namespace=""
   syntax="norules"
>
  <xsl:variable name="normalConnections">
    <item idToUse="%LocalhostConnection"/>
    <item idToUse="%AdbConnection"/>
    <item idToUse="%SshConnection"/>
    <item idToUse="%MicConnection"/>
    <item idToUse="%MicOffloadConnection"/>
    <item idToUse="%EmulatorConnection"/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="exsl:is_experimental('sniper')">
      <workflow displayName="%RealConnection">
        <description>%RealConnectionFolderDescription</description>
        <hierarchy>
            <xsl:copy-of select="$normalConnections"/>
        </hierarchy>
      </workflow>
      <workflow displayName="%Simulation">
        <description>%SimulationFolderDescription</description>
        <hierarchy>
          <item idToUse="%SniperConnection"/>
        </hierarchy>
      </workflow>
    </xsl:when>
    <xsl:otherwise>
        <xsl:copy-of select="$normalConnections"/>
    </xsl:otherwise>
   </xsl:choose>
   <xsl:choose>
     <xsl:when test="exsl:ctx('defaultConnection','') = 'adb'">
       <defaultItem idToUse="%AdbConnection"/>
     </xsl:when>
     <xsl:when test="exsl:ctx('defaultConnection','') = 'ssh'">
       <defaultItem idToUse="%SshConnection"/>
     </xsl:when>
     <xsl:when test="exsl:ctx('defaultConnection','') = 'localhost'">
       <defaultItem idToUse="%LocalhostConnection"/>
     </xsl:when>
     <xsl:otherwise>
       <xsl:choose>
          <xsl:when test="exsl:ctx('hostOS') = 'MacOSX'">
            <defaultItem idToUse="%SshConnection"/>
          </xsl:when>
          <xsl:otherwise>
            <defaultItem idToUse="%LocalhostConnection"/>
          </xsl:otherwise>
       </xsl:choose>
     </xsl:otherwise>
   </xsl:choose>
</bag>
