<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" encoding="utf-8" indent="yes"/>
  <!-- constants -->
  <xsl:variable name="ItemNumberMaxLength">4</xsl:variable>
  <xsl:variable name="LicenseNotificationSettingsUniqueId">0x87906A90</xsl:variable>
  <xsl:variable name="SlideShowUniqueId">0xCBF622BF</xsl:variable>
  <xsl:variable name="SlideShowImageUniqueId">0x20D0F4BD</xsl:variable>
  <xsl:variable name="ScheduleUniqueId">0x87ED8826</xsl:variable>
  <xsl:variable name="WelcomePageUniqueId">0x32DA2F69</xsl:variable>
  <xsl:variable name="RegretPageUniqueId">0x5F607A86</xsl:variable>
  <xsl:variable name="LicenseExpirationRegretPageUniqueId">0xAF643C53</xsl:variable>
  <xsl:variable name="UninstallRegretPageUniqueId">0xAE45E0F2</xsl:variable>
  <xsl:variable name="EndOfLicenseUniqueId">0xF65EBE49</xsl:variable>
  <xsl:variable name="NewsUniqueId">0xC3D378E9</xsl:variable>
  <xsl:variable name="NewsItemUniqueId">0xA232DC45</xsl:variable>
  <xsl:variable name="SecurityNewsUniqueId">0x71D4E6B0</xsl:variable>
  <xsl:variable name="ApplicationButtonUniqueId">0xB14E3D73</xsl:variable>
  <xsl:variable name="LicenseNotificationUniqueId">0x88C7D961</xsl:variable>
  <xsl:variable name="MessageBoxSettingsUniqueId">0x26113741</xsl:variable>
  <xsl:variable name="BalloonSettingsUniqueId">0x3487BF5C</xsl:variable>
  <xsl:variable name="ProblemListSettingsUniqueId">0x1605AE48</xsl:variable>
  <xsl:variable name="ApplicationMainPageSettingsUniqueId">0x10656BE1</xsl:variable>
  <xsl:variable name="LicenseManagerSettingsUniqueId">0xEE49F394</xsl:variable>
  <xsl:variable name="BackgroundSettingsUniqueId">0x0F145804</xsl:variable>
  <xsl:variable name="LicenseManagerButtonUniqueId">0xBBA48DDC</xsl:variable>
  <xsl:variable name="RootUniqueId">0xCF742638</xsl:variable>
  <xsl:variable name="FilterContainerUniqueId">0x8BFCB846</xsl:variable>
  <xsl:variable name="FilterDateUniqueId">0x88875F16</xsl:variable>
  <xsl:variable name="FilterIntegerUniqueId">0x0F2F0F07</xsl:variable>
  <xsl:variable name="FilterStringUniqueId">0x47D0764F</xsl:variable>
  <xsl:variable name="UcpReadySettingsUniqueId">0x895F5115</xsl:variable>
  <xsl:variable name="VerCheckUniqueId">0xDDDFB07C</xsl:variable>
  <xsl:variable name="BrowserRedirectionSettingsUriUniqueId">0x118F1DF7</xsl:variable>
  <xsl:variable name="BrowserRedirectionSettingsItemUniqueId">0xEAB9A3E3</xsl:variable>
  <xsl:variable name="BrowserRedirectionSettingsUniqueId">0x0C92D970</xsl:variable>  
  <xsl:variable name="ApplicationMigrationSettingsUniqueId">0x7FB5175A</xsl:variable>
  <xsl:variable name="MigrationToKfaSettingsUniqueId">0x1530c3e2</xsl:variable>
  <xsl:variable name="UpgradeProtectionPageSettingsUniqueId">0x6860501b</xsl:variable>
  <xsl:variable name="KfaApplicationMigrationSettingsUniqueId">0x5E25EC54</xsl:variable>
  <xsl:variable name="WindowDisplaySettingsUniqueId">0x960BD480</xsl:variable>
  <xsl:variable name="UpdateContentSettingsUniqueId">0x5CA7F3C3</xsl:variable>
  <xsl:variable name="ReplaceContentFileUniqueId">0xA2C22679</xsl:variable>
  <xsl:variable name="MoreInfoFromKasperskySettingsUniqueId">0xF1C3D1CC</xsl:variable>
  <xsl:variable name="ABTestContextualPromoSettingsUniqueId">0x7d26b35a</xsl:variable>
  <xsl:variable name="ABTestUcpRegistrationSettingsUniqueId">0xe80f5d4a</xsl:variable>
  <xsl:variable name="ABTestCompromisedAccountsSettingsUniqueId">0x7ff6b682</xsl:variable>
  <xsl:variable name="ABTestEndOfLicensePageSettingsUniqueId">0x3074821e</xsl:variable>
  <xsl:variable name="ABTestScenarioUniqueId">0x4463887d</xsl:variable>	
  <xsl:variable name="ABTestSettingsUniqueId">0x282ed05e</xsl:variable>
  <xsl:variable name="SupportChatLinkSettingsUniqueId">0x36a75ac1</xsl:variable>
  <xsl:variable name="UpdatableUiSettingsUniqueId">0xda99fe35</xsl:variable>
  <xsl:variable name="AppConfigSettingsUniqueId">0x265f39ec</xsl:variable>
  <!-- /constants -->

  <!--UcpReadySettings-->
  <xsl:template match="/IpmContentCustomization[@Version='940DB931-E560-48A8-BAD6-6A970C07EA25']/UcpReadySettings">
  <root>
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$RootUniqueId"/>
    </xsl:attribute>
    <Items>
      <xsl:element name="item_0000">
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$UcpReadySettingsUniqueId"/>
        </xsl:attribute>
      
        <xsl:attribute name="contentId">
          <xsl:value-of select="Id"/>
        </xsl:attribute>

        <xsl:call-template name="BooleanAsInt">
          <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
          <xsl:with-param name="sourcePath" select="DisableShowContent"/>
          <xsl:with-param name="isNegative" select="false()"/>
        </xsl:call-template>
    
        <xsl:attribute name="isUcpEnabled">
          <xsl:call-template name="EnabledFlag">
            <xsl:with-param name="sourcePath" select="UcpConnection"/>
          </xsl:call-template>
        </xsl:attribute>
      
        <xsl:attribute name="portalActivationTarget">
          <xsl:value-of select="UcpPortalActivationTarget"/>
        </xsl:attribute>
        <xsl:attribute name="portalRegistrationTarget">
          <xsl:value-of select="UcpPortalRegistrationTarget"/>
        </xsl:attribute>
      
        <xsl:attribute name="registrationFormType">
          <xsl:choose>
            <xsl:when test="UcpRegistrationOnActivationMode='Optional'">
              <xsl:value-of select="1" />
            </xsl:when>
            <xsl:when test="UcpRegistrationOnActivationMode='Mandatory'">
              <xsl:value-of select="2" />
            </xsl:when>
            <xsl:otherwise><!--Disabled-->
              <xsl:value-of select="0" />
            </xsl:otherwise>
          </xsl:choose>
        </xsl:attribute>

        <xsl:attribute name="showAlertsAfterActivationSkipped">
          <xsl:call-template name="EnabledFlag">
            <xsl:with-param name="sourcePath" select="UcpRegistrationAlertAfterManualActivation"/>
          </xsl:call-template>
        </xsl:attribute>

        <xsl:attribute name="showAlertsAfterSilentActivation">
          <xsl:call-template name="EnabledFlag">
            <xsl:with-param name="sourcePath" select="UcpRegistrationAlertAfterAutoActivation"/>
          </xsl:call-template>
        </xsl:attribute>

        <xsl:attribute name="alertFirstStartAtReboot">
          <xsl:call-template name="OptionalInt">
            <xsl:with-param name="sourcePath" select="UcpRegistrationAlertFirstStartAtReboot"/>
            <xsl:with-param name="defaultValue" select="0"/>
          </xsl:call-template>
        </xsl:attribute>

        <xsl:attribute name="alertFirstStartPeriod">
          <xsl:call-template name="OptionalInt">
            <xsl:with-param name="sourcePath" select="UcpRegistrationAlertFirstStartAtHour"/>
            <xsl:with-param name="defaultValue" select="0"/>
          </xsl:call-template>
        </xsl:attribute>

        <xsl:attribute name="alertRepeatAtReboot">
          <xsl:call-template name="OptionalInt">
            <xsl:with-param name="sourcePath" select="UcpRegistrationAlertRepeatAtReboot"/>
            <xsl:with-param name="defaultValue" select="0"/>
          </xsl:call-template>
        </xsl:attribute>

        <xsl:attribute name="alertRepeatPeriod">
          <xsl:call-template name="OptionalInt">
            <xsl:with-param name="sourcePath" select="UcpRegistrationAlertRepeatAtHour"/>
            <xsl:with-param name="defaultValue" select="0"/>
          </xsl:call-template>
        </xsl:attribute>

        <xsl:attribute name="alertCount">
          <xsl:call-template name="OptionalInt">
            <xsl:with-param name="sourcePath" select="UcpRegistrationAlertCount"/>
            <xsl:with-param name="defaultValue" select="0"/>
          </xsl:call-template>
        </xsl:attribute>
      </xsl:element>
    </Items>
  </root>
  </xsl:template>

  <xsl:template name="EnabledFlag">
    <xsl:param name="sourcePath"/>
    <xsl:choose>
      <xsl:when test="$sourcePath='Enabled'">
        <xsl:value-of select="1"/>
      </xsl:when>
      <xsl:otherwise><!--Disabled-->
        <xsl:value-of select="0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="OptionalInt">
    <xsl:param name="sourcePath"/>
    <xsl:param name="defaultValue"/>
    <xsl:choose>
      <xsl:when test="$sourcePath != ''"><!--i.e. when sourcePath exists and is not empty-->
        <xsl:value-of select="$sourcePath"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$defaultValue"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- /UcpReadySettings-->
  
  <!--LicenseNotificationSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='96758B3C-3625-4A06-B74B-5484EE9CFCAA']/LicenseNotificationSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$FilterContainerUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="Schedule">
            <xsl:with-param name="sourcePath" select="Schedule"/>
          </xsl:call-template>
          <Items>
            <item_0000>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$LicenseNotificationSettingsUniqueId"/>
              </xsl:attribute>
              <xsl:attribute name="contentId">
                <xsl:value-of select="Id"/>
              </xsl:attribute>
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                <xsl:with-param name="sourcePath" select="DisableShowContent"/>
                <xsl:with-param name="isNegative" select="false()"/>
              </xsl:call-template>
          
              <xsl:attribute name="enable">
                <xsl:choose>
                  <xsl:when test="EnableIpmMessagesOnly='true'">
                    <xsl:value-of select="'0'"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="'1'"/>
                  </xsl:otherwise>
                  </xsl:choose>
              </xsl:attribute>
            </item_0000>
          </Items>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!-- /LicenseNotificationSettings-->

  <!--EndOfLicense-->
  <xsl:template match="/IpmContentCustomization[@Version='D7E93CC4-751B-42CE-88D8-E2A38561DCFE']/EndOfLicenseSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$EndOfLicenseUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'show'"/>
            <xsl:with-param name="sourcePath" select="DisableEndOfLicense"/>
            <xsl:with-param name="isNegative" select="true()"/>
          </xsl:call-template>
          <xsl:attribute name="contentUri">
            <xsl:value-of select="ContentUri"/>
          </xsl:attribute>
          <xsl:call-template name="WindowDisplaySettings">
            <xsl:with-param name="sourcePath" select="WindowDisplaySettings"/>
          </xsl:call-template>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/EndOfLicense-->

  <!--WelcomePage-->
  <xsl:template match="/IpmContentCustomization[@Version='F5ACBC74-0089-45DB-A887-E7D96DD74E3F']/WelcomePage">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$FilterContainerUniqueId"/>
          </xsl:attribute>
          <Items>
            <item_0000>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$WelcomePageUniqueId"/>
              </xsl:attribute>
              <xsl:attribute name="contentId">
                <xsl:value-of select="Id"/>
              </xsl:attribute>
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                <xsl:with-param name="sourcePath" select="DisableShowContent"/>
                <xsl:with-param name="isNegative" select="false()"/>
              </xsl:call-template>
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'show'"/>
                <xsl:with-param name="sourcePath" select="DisableWelcomePage"/>
                <xsl:with-param name="isNegative" select="true()"/>
              </xsl:call-template>
              <xsl:attribute name="contentUri">
                <xsl:value-of select="ContentUri"/>
              </xsl:attribute>
              <xsl:call-template name="WindowDisplaySettings">
                <xsl:with-param name="sourcePath" select="WindowDisplaySettings"/>
              </xsl:call-template>
            </item_0000>
          </Items>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/WelcomePage-->
  
  <!--RegretPage-->
  <xsl:template match="/IpmContentCustomization[@Version='106CE91E-D10F-475E-A34A-3ED3AF63721D']/RegretPage">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$RegretPageUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:attribute name="url">
            <xsl:value-of select="ContentUri"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enable'"/>
            <xsl:with-param name="sourcePath" select="DisableRegretPage"/>
            <xsl:with-param name="isNegative" select="true()"/>
          </xsl:call-template>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/RegretPage-->
  
   <!--LicenseExpirationRegretPage-->
  <xsl:template match="/IpmContentCustomization[@Version='4D73A510-0493-4286-8E0E-BD4745CEB52B']/LicenseExpirationRegretPageSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$LicenseExpirationRegretPageUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:attribute name="contentUri">
            <xsl:value-of select="ContentUri"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enable'"/>
            <xsl:with-param name="sourcePath" select="DisableRegretPage"/>
            <xsl:with-param name="isNegative" select="true()"/>
          </xsl:call-template>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/LicenseExpirationRegretPage-->
  
  <!--UninstallRegretPage-->
  <xsl:template match="/IpmContentCustomization[@Version='39B4D0DA-F506-48CC-8771-85363BC4B25F']/UninstallRegretPageSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$UninstallRegretPageUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:attribute name="contentUri">
            <xsl:value-of select="ContentUri"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enable'"/>
            <xsl:with-param name="sourcePath" select="DisableRegretPage"/>
            <xsl:with-param name="isNegative" select="true()"/>
          </xsl:call-template>
       </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/UninstallRegretPage-->
  
  <!--VerCheck-->
  <xsl:template match="/IpmContentCustomization[@Version='45759B03-1F6B-4775-82A1-7CA129984782']/NewVersionInfo">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$VerCheckUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:attribute name="applicationId">
            <xsl:value-of select="ApplicationId"/>
          </xsl:attribute>
          <xsl:attribute name="applicationVersion">
            <xsl:value-of select="ApplicationVersion"/>
          </xsl:attribute>
          <xsl:attribute name="distributiveDownloadUrl">
            <xsl:value-of select="DistributiveDownloadUri"/>
          </xsl:attribute>
          <xsl:attribute name="showMessageInDays">
            <xsl:value-of select="ShowMessageDaysCount"/>
          </xsl:attribute>
          <xsl:attribute name="showMessageDelayInDays">
            <xsl:call-template name="OptionalInt">
              <xsl:with-param name="sourcePath" select="ShowMessageDelayInDays"/>
              <xsl:with-param name="defaultValue" select="0"/>
            </xsl:call-template>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'skipEulaAcceptance'"/>
            <xsl:with-param name="sourcePath" select="SkipEulaAcceptance"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:call-template name="OptionalBooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'usePPCSSettingsFromInstalledVersion'"/>
            <xsl:with-param name="sourcePath" select="UsePPCSSettingsFromInstalledVersion"/>
            <xsl:with-param name="isNegative" select="false()"/>
            <xsl:with-param name="defaultValue" select="1"/>
          </xsl:call-template>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/VerCheck-->
  
  <!--News-->
  <xsl:template match="/IpmContentCustomization[@Version='F6E5B43B-1D58-4CF2-895C-E6FBA746A3D4' or @Version='D0C8B949-41BF-4DA6-861B-5FCE9BAB9DDB']/News">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$FilterContainerUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="Schedule">
            <xsl:with-param name="sourcePath" select="Schedule"/>
          </xsl:call-template>
          <Items>
            <item_0000>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$NewsUniqueId"/>
              </xsl:attribute>
              <items>
                <item_0000>
                  <xsl:attribute name="unique_id">
                    <xsl:value-of select="$NewsItemUniqueId"/>
                  </xsl:attribute>
                  <xsl:attribute name="contentId">
                    <xsl:value-of select="Id"/>
                  </xsl:attribute>
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                    <xsl:with-param name="sourcePath" select="DisableShowContent"/>
                    <xsl:with-param name="isNegative" select="false()"/>
                  </xsl:call-template>
                  <xsl:attribute name="contentUri">
                    <xsl:value-of select="ContentUri"/>
                  </xsl:attribute>
                  <xsl:call-template name="Severity">
                    <xsl:with-param name="sourcePath" select="Severity"/>
                  </xsl:call-template>
                  <xsl:attribute name="title">
                    <xsl:value-of select="Title"/>
                  </xsl:attribute>
                  <xsl:attribute name="announcement">
                    <xsl:value-of select="Announcement"/>
                  </xsl:attribute>
                  <xsl:attribute name="creationDate">
                    <xsl:value-of select="PublicationDate"/>
                  </xsl:attribute>
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'show'"/>
                    <xsl:with-param name="sourcePath" select="AutoOpenInApplication"/>
                    <xsl:with-param name="isNegative" select="false()"/>
                  </xsl:call-template>
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'ignoreUserSettings'"/>
                    <xsl:with-param name="sourcePath" select="IgnoreDisableShowSetting"/>
                    <xsl:with-param name="isNegative" select="false()"/>
                  </xsl:call-template>
                </item_0000>
              </items>
            </item_0000>
          </Items>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/News-->

  <!--SecurityNews-->
  <xsl:template match="/IpmContentCustomization[@Version='88BB0B96-9FF8-4F52-AC1F-79AE73C44E83']/SecurityNewsSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$SecurityNewsUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:attribute name="title">
            <xsl:value-of select="Title"/>
          </xsl:attribute>
          <xsl:attribute name="description">
            <xsl:value-of select="Description"/>
          </xsl:attribute>
          <xsl:attribute name="publicationDate">
            <xsl:value-of select="PublicationDate"/>
          </xsl:attribute>
          <xsl:attribute name="contentUri">
            <xsl:value-of select="ContentUri"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:call-template name="Severity">
            <xsl:with-param name="sourcePath" select="Severity"/>
          </xsl:call-template>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/SecurityNews-->
  
  <!--ApplicationButtonListSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='10C631A6-91C4-4753-8D65-48571A0D95B0']/ApplicationButtonSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$FilterContainerUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="Schedule">
            <xsl:with-param name="sourcePath" select="Schedule"/>
          </xsl:call-template>
          <Items>
            <item_0000>
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                <xsl:with-param name="sourcePath" select="DisableShowContent"/>
                <xsl:with-param name="isNegative" select="false()"/>
              </xsl:call-template>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$ApplicationButtonUniqueId"/>
              </xsl:attribute>
              <xsl:attribute name="contentId">
                <xsl:value-of select="Button/Id"/>
              </xsl:attribute>
              <xsl:attribute name="parentContentId">
                <xsl:value-of select="Id"/>
              </xsl:attribute>
              <xsl:attribute name="name">
                <xsl:value-of select="Button/ButtonName"/>
              </xsl:attribute>
              <xsl:call-template name="ButtonType">
                <xsl:with-param name="buttonType" select="Button/ButtonType" />
              </xsl:call-template>
              <xsl:attribute name="target">
                <xsl:choose>
                  <xsl:when test="Button/CustomUri != ''">
                    <xsl:value-of select="Button/CustomUri" />
                  </xsl:when>
                  <xsl:when test="Button/ProductStoreUri != ''">
                    <xsl:value-of select="concat('ipp:', Button/ProductStoreUri)" />
                  </xsl:when>
                </xsl:choose>
              </xsl:attribute>
            </item_0000>
          </Items>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  
  <xsl:template name="ButtonType">
    <xsl:param name="buttonType" />
    <xsl:attribute name="type">
      <xsl:choose>
        <xsl:when test="$buttonType = 'Buy'">
          <xsl:value-of select="1" />
        </xsl:when>
        <xsl:when test="$buttonType = 'Renew'">
          <xsl:value-of select="2" />
        </xsl:when>
        <xsl:when test="$buttonType = 'Upgrade'">
          <xsl:value-of select="3" />
        </xsl:when>
        <xsl:when test="$buttonType = 'ManageLicense'">
          <xsl:value-of select="4" />
        </xsl:when>
        <xsl:when test="$buttonType = 'ManageSubscription'">
          <xsl:value-of select="5" />
        </xsl:when>
        <xsl:when test="$buttonType = 'SubscriptionProvider'">
          <xsl:value-of select="6" />
        </xsl:when>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="ActionTarget">
    <xsl:param name="applicationAction" />
    <xsl:param name="customUri" />
    <xsl:param name="productStoreUri" />
    <xsl:attribute name="target">
      <xsl:choose>
        <xsl:when test="$applicationAction = 'OpenCustomUri'">
          <xsl:value-of select="$customUri" />
        </xsl:when>
        <xsl:when test="$applicationAction = 'OpenCustomProductStore'">
          <xsl:value-of select="concat('ipp:',$productStoreUri)" />
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$applicationAction" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--/ApplicationButtonListSettings-->
  
  <!--LicenseNotification-->
  <xsl:template match="/IpmContentCustomization[@Version='81A8D8D3-A596-4F1E-8A16-F8114299F14F']/LicenseNotification">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$FilterContainerUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="Schedule">
            <xsl:with-param name="sourcePath" select="Schedule"/>
          </xsl:call-template>
          <Items>
            <item_0000>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$LicenseNotificationUniqueId"/>
              </xsl:attribute>
              <xsl:attribute name="contentId">
                <xsl:value-of select="Id"/>
              </xsl:attribute>
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                <xsl:with-param name="sourcePath" select="DisableShowContent"/>
                <xsl:with-param name="isNegative" select="false()"/>
              </xsl:call-template>
              <xsl:call-template name="Severity">
                <xsl:with-param name="sourcePath" select="Severity"/>
              </xsl:call-template>
              <xsl:call-template name="BooleanAsInt">
                  <xsl:with-param name="resultAttributeName" select="'showToast'" />
                  <xsl:with-param name="sourcePath" select="ShowToast" />
                  <xsl:with-param name="isNegative" select="false()" />
              </xsl:call-template>
              <xsl:if test="MessageBox">
                <messageBoxSettings>
                  <xsl:attribute name="unique_id">
                    <xsl:value-of select="$MessageBoxSettingsUniqueId"/>
                  </xsl:attribute>
                  <xsl:attribute name="height">
                    <xsl:value-of select="MessageBox/WindowDisplaySettings/WindowHeigth"/>
                  </xsl:attribute>
                  <xsl:attribute name="width">
                    <xsl:value-of select="MessageBox/WindowDisplaySettings/WindowWidth"/>
                  </xsl:attribute>
                  <xsl:attribute name="contentUri">
                    <xsl:value-of select="MessageBox/ContentUri"/>
                  </xsl:attribute>
                  <xsl:call-template name="WindowDisplaySettings">
                    <xsl:with-param name="sourcePath" select="MessageBox/WindowDisplaySettings"/>
                  </xsl:call-template>
                </messageBoxSettings>
              </xsl:if>
              <xsl:if test="Balloon">
                <balloonSettings>
                  <xsl:attribute name="unique_id">
                    <xsl:value-of select="$BalloonSettingsUniqueId"/>
                  </xsl:attribute>
                  <xsl:attribute name="description">
                    <xsl:value-of select="Balloon/Description"/>
                  </xsl:attribute>
                </balloonSettings>
              </xsl:if>
              <xsl:if test="ProblemList">
                <problemListSettings>
                  <xsl:attribute name="unique_id">
                    <xsl:value-of select="$ProblemListSettingsUniqueId"/>
                  </xsl:attribute>
                  <xsl:attribute name="title">
                    <xsl:value-of select="ProblemList/Title"/>
                  </xsl:attribute>
                  <xsl:attribute name="description">
                    <xsl:value-of select="ProblemList/LicenseProblemDescription"/>
                  </xsl:attribute>
                </problemListSettings>
              </xsl:if>
              <xsl:if test="ApplicationMainPage">
                <mainWindowSettings>
                  <xsl:attribute name="unique_id">
                    <xsl:value-of select="$ApplicationMainPageSettingsUniqueId"/>
                  </xsl:attribute>
                  <xsl:attribute name="protectionState">
                    <xsl:value-of select="ApplicationMainPage/ProtectionStateName"/>
                  </xsl:attribute>
                  <xsl:attribute name="licenseState">
                    <xsl:value-of select="ApplicationMainPage/LicenseStateName"/>
                  </xsl:attribute>
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'forceShowButton'"/>
                    <xsl:with-param name="sourcePath" select="ApplicationMainPage/ShowApplicationButton"/>
                    <xsl:with-param name="isNegative" select="false()"/>
                  </xsl:call-template>
                </mainWindowSettings>
              </xsl:if>
              <xsl:if test="LicenseManager">
                <licenseManagerSettings>
                  <xsl:attribute name="unique_id">
                    <xsl:value-of select="$LicenseManagerSettingsUniqueId"/>
                  </xsl:attribute>
                  <xsl:attribute name="title">
                    <xsl:value-of select="LicenseManager/Title"/>
                  </xsl:attribute>
                  <xsl:attribute name="description">
                    <xsl:value-of select="LicenseManager/Description"/>
                  </xsl:attribute>
                  <xsl:if test="LicenseManager/HtmlDescriptionUri">
                    <xsl:attribute name="htmlDescriptionUri">
                      <xsl:value-of select="LicenseManager/HtmlDescriptionUri"/>
                    </xsl:attribute>
                  </xsl:if>
                  <xsl:if test="LicenseManager/Background">
                    <background>
                      <xsl:attribute name="unique_id">
                        <xsl:value-of select="$BackgroundSettingsUniqueId"/>
                      </xsl:attribute>
                      <xsl:attribute name="contentUri">
                        <xsl:value-of select="LicenseManager/Background/BackgroundImageUri"/>
                      </xsl:attribute>
                      <xsl:attribute name="rightMargin">
                        <xsl:value-of select="LicenseManager/Background/RightMargin"/>
                      </xsl:attribute>
                      <xsl:attribute name="topMargin">
                        <xsl:value-of select="LicenseManager/Background/TopMargin"/>
                      </xsl:attribute>
                      <xsl:attribute name="leftMargin">
                        <xsl:value-of select="LicenseManager/Background/LeftMargin"/>
                      </xsl:attribute>
                      <xsl:attribute name="bottomMargin">
                        <xsl:value-of select="LicenseManager/Background/BottomMargin"/>
                      </xsl:attribute>
                    </background>
                  </xsl:if>
                  <xsl:call-template name="LicenseManagerButtonList">
                    <xsl:with-param name="sourcePath" select="LicenseManager/Buttons"/>
                  </xsl:call-template>
                </licenseManagerSettings>
              </xsl:if>
            </item_0000>
          </Items>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  
  
  <xsl:template name="LicenseManagerButtonList">
    <xsl:param name="sourcePath"/>
    <buttons>
      <xsl:for-each select="$sourcePath/Button">
        <xsl:variable name="strItemNumber">
          <xsl:call-template name="prepend-pad">
            <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
            <xsl:with-param name="padChar" select="0"/>
            <xsl:with-param name="padVar" select="string(position()-1)"/>
          </xsl:call-template>
        </xsl:variable>
        <xsl:element name="{concat('item_', $strItemNumber)}">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$LicenseManagerButtonUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="$sourcePath/DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:attribute name="name">
            <xsl:value-of select="ButtonName"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'showBasket'"/>
            <xsl:with-param name="sourcePath" select="DisplayShoppingCart"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:call-template name="ActionTarget">
            <xsl:with-param name="applicationAction" select="current()/ApplicationAction" />
            <xsl:with-param name="customUri" select="current()/CustomUri" />
            <xsl:with-param name="productStoreUri" select="current()/ProductStoreUri" />
          </xsl:call-template>
        </xsl:element>
      </xsl:for-each>
    </buttons>
  </xsl:template>
  <!--/LicenseNotification-->

  <!--BrowserRedirectionSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='9280B874-8324-449E-9CD4-69F5DB2DF3DA']/BrowserRedirectionSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$BrowserRedirectionSettingsUniqueId"/>
          </xsl:attribute>
          <items>
            <xsl:for-each select="BrowserUriList">
              <xsl:variable name="browserUriItemListNumber">
                <xsl:call-template name="prepend-pad">
                  <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                  <xsl:with-param name="padChar" select="0"/>
                  <xsl:with-param name="padVar" select="string(position()-1)"/>
                </xsl:call-template>
              </xsl:variable>
              <xsl:element name="{concat('item_', $browserUriItemListNumber)}">
                <xsl:attribute name="unique_id">
                  <xsl:value-of select="$BrowserRedirectionSettingsItemUniqueId"/>
                </xsl:attribute>
                <xsl:attribute name="contentId">
                  <xsl:value-of select="/IpmContentCustomization/BrowserRedirectionSettings/Id"/>
                </xsl:attribute>
                <xsl:call-template name="BooleanAsInt">
                  <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                  <xsl:with-param name="sourcePath" select="DisableShowContent"/>
                  <xsl:with-param name="isNegative" select="false()"/>
                </xsl:call-template>
                <xsl:attribute name="redirectionUri">
                  <xsl:value-of select="/IpmContentCustomization/BrowserRedirectionSettings/RedirectionServiceUri"/>
                </xsl:attribute>
                <uriList>
                  <xsl:choose>
                    <xsl:when test="BrowserUri/item">
                      <xsl:for-each select="BrowserUri/item">
                        <xsl:variable name="browserUriItemNumber">
                          <xsl:call-template name="prepend-pad">
                            <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                            <xsl:with-param name="padChar" select="0"/>
                            <xsl:with-param name="padVar" select="string(position()-1)"/>
                          </xsl:call-template>
                        </xsl:variable>
                        <xsl:element name="{concat('item_', $browserUriItemNumber)}">
                          <xsl:attribute name="unique_id">
                            <xsl:value-of select="$BrowserRedirectionSettingsUriUniqueId"/>
                          </xsl:attribute>
                          <xsl:attribute name="uriMask">
                            <xsl:value-of select="UriMask"/>
                          </xsl:attribute>
                          <xsl:element name="ignoreParams">
                            <xsl:for-each select="UriIgnoreParameterList/ParameterName/item">
                              <xsl:variable name="ignoreParameterItemNumber">
                                <xsl:call-template name="prepend-pad">
                                  <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                                  <xsl:with-param name="padChar" select="0"/>
                                  <xsl:with-param name="padVar" select="string(position()-1)"/>
                                </xsl:call-template>
                              </xsl:variable>
                              <xsl:attribute name="{concat('item_', $ignoreParameterItemNumber)}">
                                <xsl:value-of select="current()"/>
                              </xsl:attribute>
                            </xsl:for-each>
                          </xsl:element>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:for-each select="BrowserUri">
                        <xsl:variable name="browserUriItemNumber">
                          <xsl:call-template name="prepend-pad">
                            <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                            <xsl:with-param name="padChar" select="0"/>
                            <xsl:with-param name="padVar" select="string(position()-1)"/>
                          </xsl:call-template>
                        </xsl:variable>
                        <xsl:element name="{concat('item_', $browserUriItemNumber)}">
                          <xsl:attribute name="unique_id">
                            <xsl:value-of select="$BrowserRedirectionSettingsUriUniqueId"/>
                          </xsl:attribute>
                          <xsl:attribute name="uriMask">
                            <xsl:value-of select="UriMask"/>
                          </xsl:attribute>
                          <xsl:element name="ignoreParams">
                            <xsl:for-each select="UriIgnoreParameterList/ParameterName">
                              <xsl:variable name="ignoreParameterItemNumber">
                                <xsl:call-template name="prepend-pad">
                                  <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                                  <xsl:with-param name="padChar" select="0"/>
                                  <xsl:with-param name="padVar" select="string(position()-1)"/>
                                </xsl:call-template>
                              </xsl:variable>
                              <xsl:attribute name="{concat('item_', $ignoreParameterItemNumber)}">
                                <xsl:value-of select="current()"/>
                              </xsl:attribute>
                            </xsl:for-each>
                          </xsl:element>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:otherwise>
                  </xsl:choose>
                </uriList>
              </xsl:element>
            </xsl:for-each>
          </items>
        </xsl:element>
    </Items>
  </root>
  </xsl:template>
  <!--/BrowserRedirectionSettings-->
	
  <!--ApplicationMigrationSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='1C139A43-9736-4598-8775-5E33A557FDA2']/ApplicationMigrationSettings">
  <root>
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$RootUniqueId"/>
    </xsl:attribute>
    <Items>
      <xsl:element name="item_0000">
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$ApplicationMigrationSettingsUniqueId"/>
        </xsl:attribute>
        <xsl:attribute name="contentId">
          <xsl:value-of select="Id"/>
        </xsl:attribute>
        <xsl:call-template name="BooleanAsInt">
          <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
          <xsl:with-param name="sourcePath" select="DisableShowContent"/>
          <xsl:with-param name="isNegative" select="false()"/>
        </xsl:call-template>
        <xsl:if test="AdvertMigrationSettings">
          <xsl:call-template name="MigrationSettings">
              <xsl:with-param name="advertMigrationSettings" select="AdvertMigrationSettings"/>
          </xsl:call-template>
        </xsl:if>
        <xsl:if test="KfaAutomaticMigrationDelaySec">
          <xsl:attribute name="isDelaySet">
            <xsl:value-of select="1"/>
          </xsl:attribute>
          <xsl:attribute name="kfaAutomaticMigrationDelayInSec">
            <xsl:value-of select="KfaAutomaticMigrationDelaySec"/>
          </xsl:attribute>
        </xsl:if>
	    </xsl:element>
    </Items>
  </root>
  </xsl:template>
  <!--/ApplicationMigrationSettings-->

  <!--KfaApplicationMigrationSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='574EDF06-4A51-4DFE-B426-5EA3CBEB73D3']/ApplicationMigrationSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$KfaApplicationMigrationSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enableMigrationToKsc'"/>
            <xsl:with-param name="sourcePath" select="EnableMigrationToKsc"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/KfaApplicationMigrationSettings-->
  
  <!--MigrationSettings-->
  <xsl:template name="MigrationSettings">
    <xsl:param name="advertMigrationSettings"/>
    <xsl:attribute name="advertizeProductType">
      <xsl:choose>
        <xsl:when test="$advertMigrationSettings = 'MigrateToKis'">
          <xsl:value-of select="'kis'"/>
        </xsl:when>
      </xsl:choose>
	    <xsl:choose>
		    <xsl:when test="$advertMigrationSettings = 'MigrateToPure'">
		      <xsl:value-of select="'pure'"/>
		    </xsl:when>
       </xsl:choose>
	    <xsl:choose>
		    <xsl:when test="$advertMigrationSettings = 'MigrateDisable'">
		      <xsl:value-of select="'disable'"/>
		    </xsl:when>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--/MigrationSettings-->

  <!--MigrationToKfaSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='7C54D112-7683-4A28-B809-BD057D688E0B']/MigrationToKfaSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$MigrationToKfaSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'isMigrationToKfaOnUninstallAllowed'"/>
            <xsl:with-param name="sourcePath" select="IsMigrationToKfaOnUninstallAllowed"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'isAutomaticMigrationToKfaOnLicenseExpirationAllowed'"/>
            <xsl:with-param name="sourcePath" select="IsAutomaticMigrationToKfaOnLicenseExpirationAllowed"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/MigrationToKfaSettings-->

  <!--UpgradeProtectionPageSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='FBCEF80F-D1C8-4531-BAFB-19510C28208B']/UpgradeProtectionPageSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$UpgradeProtectionPageSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:attribute name="contentUri">
            <xsl:value-of select="ContentUri"/>
          </xsl:attribute>
          <xsl:attribute name="targetProductType">
            <xsl:choose>
              <xsl:when test="TargetMigrationProductType = 0">
                <xsl:value-of select="'kis'"/>
              </xsl:when>
            </xsl:choose>
            <xsl:choose>
              <xsl:when test="TargetMigrationProductType = 1">
                <xsl:value-of select="'kav'"/>
              </xsl:when>
            </xsl:choose>
            <xsl:choose>
              <xsl:when test="TargetMigrationProductType = 2">
                <xsl:value-of select="'pure'"/>
              </xsl:when>
            </xsl:choose>
            <xsl:choose>
              <xsl:when test="TargetMigrationProductType = 3">
                <xsl:value-of select="'saas'"/>
              </xsl:when>
            </xsl:choose>
          </xsl:attribute>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/UpgradeProtectionPageSettings-->

  <!--UpdateContentSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='6A61C2DA-4B9A-4930-924D-F3D497FCCDA0']/UpdateContentSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
      
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$UpdateContentSettingsUniqueId"/>
          </xsl:attribute>
      
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>

          <xsl:attribute name="replaceContentMetaFileUri">
            <xsl:value-of select="ReplaceContentMetaFileUri"/>
          </xsl:attribute>
      
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
      
          <xsl:attribute name="destinationContentId">
            <xsl:value-of select="DestinationContentId"/>
          </xsl:attribute>

          <xsl:element name ="replacements">
        
            <xsl:for-each select="ReplaceContentFile">
              <xsl:variable name="internalItemNumber">
                <xsl:call-template name="prepend-pad">
                  <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                  <xsl:with-param name="padChar" select="0"/>
                  <xsl:with-param name="padVar" select="string(position()-1)"/>
                </xsl:call-template>
              </xsl:variable>
          
              <xsl:element name="{concat('item_', $internalItemNumber)}">

                <xsl:attribute name="unique_id">
                  <xsl:value-of select="$ReplaceContentFileUniqueId"/>
                </xsl:attribute>
        
                <xsl:attribute name="sourceFileUri">
                  <xsl:value-of select="SourceFileUri"/>
                </xsl:attribute>

                <xsl:attribute name="destinationFileUri">
                  <xsl:value-of select="DestinationFileUri"/>
                </xsl:attribute>
          
               </xsl:element>
             </xsl:for-each>
        
          </xsl:element>
     
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/UpdateContentSettings-->

  <!--MoreInfoFromKasperskySettings-->
  <xsl:template match="/IpmContentCustomization[@Version='7968B404-C2FA-42BC-9060-CF78C17A72C7']/MoreInfoFromKasperskySettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">

          <xsl:attribute name="unique_id">
            <xsl:value-of select="$MoreInfoFromKasperskySettingsUniqueId"/>
          </xsl:attribute>

          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>

          <xsl:attribute name="name">
            <xsl:value-of select="ButtonName"/>
          </xsl:attribute>

          <xsl:attribute name="target">
            <xsl:value-of select="ButtonUrl"/>
          </xsl:attribute>
      
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>

          <xsl:call-template name="MoreBtnColorEnum">
            <xsl:with-param name="sourcePath" select="Color"/>
          </xsl:call-template>

        </xsl:element>
      </Items>
    </root>
  </xsl:template>

  <xsl:template name="MoreBtnColorEnum">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="color">
      <xsl:choose>
        <xsl:when test="$sourcePath='Pink'">
          <xsl:value-of select="'1'"/>
        </xsl:when>
        <xsl:when test="$sourcePath='Red'">
          <xsl:value-of select="'2'"/>
        </xsl:when>
        <xsl:when test="$sourcePath='Brown'">
          <xsl:value-of select="'3'"/>
        </xsl:when>
        <xsl:when test="$sourcePath='Lime'">
          <xsl:value-of select="'4'"/>
        </xsl:when>
        <xsl:when test="$sourcePath='Green'">
          <xsl:value-of select="'5'"/>
        </xsl:when>
        <xsl:when test="$sourcePath='Blue'">
          <xsl:value-of select="'6'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'0'" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--/MoreInfoFromKasperskySettings-->

  <!--ABTestSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='5ACFB706-D723-4F57-9AB1-1C313ED13FA1']/ABTestSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$ABTestSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:attribute name="testName">
            <xsl:value-of select="TestName"/>
          </xsl:attribute>
          <xsl:attribute name="testId">
            <xsl:value-of select="TestId"/>
          </xsl:attribute>
          <xsl:attribute name="targetFrom">
            <xsl:call-template name="OptionalInt">
              <xsl:with-param name="sourcePath" select="TargetFrom"/>
              <xsl:with-param name="defaultValue" select="0"/>
            </xsl:call-template>
          </xsl:attribute>
          <xsl:attribute name="targetTo">
            <xsl:call-template name="OptionalInt">
              <xsl:with-param name="sourcePath" select="TargetTo"/>
              <xsl:with-param name="defaultValue" select="362880000"/>
            </xsl:call-template>
          </xsl:attribute>
          <scenarios>
            <xsl:for-each select="Scenarios/Scenario | Scenarios/item">
              <xsl:variable name="scenarioItemListNumber">
                <xsl:call-template name="prepend-pad">
                  <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                  <xsl:with-param name="padChar" select="0"/>
                  <xsl:with-param name="padVar" select="string(position()-1)"/>
                </xsl:call-template>
              </xsl:variable>
              <xsl:element name="{concat('item_', $scenarioItemListNumber)}">
                <xsl:call-template name="ABTestScenario">
                </xsl:call-template>
              </xsl:element>
            </xsl:for-each>
          </scenarios>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/ABTestSettings-->

  <!--ABTestScenario-->
  <xsl:template name="ABTestScenario">
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$ABTestScenarioUniqueId"/>
    </xsl:attribute>
    <xsl:attribute name="name">
      <xsl:value-of select="Name"/>
    </xsl:attribute>
    <xsl:attribute name="percent">
      <xsl:call-template name="OptionalInt">
        <xsl:with-param name="sourcePath" select="Percent"/>
        <xsl:with-param name="defaultValue" select="100"/>
      </xsl:call-template>
    </xsl:attribute>
    <settingsList>
      <xsl:for-each select="Settings[Type='ContextualPromoSettings' or Type='UcpRegistrationSettings' or Type='CompromisedAccountsSettings' or Type='EndOfLicensePageSettings'] 
        | Settings/item[Type='ContextualPromoSettings' or Type='UcpRegistrationSettings' or Type='CompromisedAccountsSettings' or Type='EndOfLicensePageSettings']">

        <xsl:variable name="settingsItemListNumber">
          <xsl:call-template name="prepend-pad">
            <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
            <xsl:with-param name="padChar" select="0"/>
            <xsl:with-param name="padVar" select="string(position()-1)"/>
          </xsl:call-template>
        </xsl:variable>
        <xsl:element name="{concat('item_', $settingsItemListNumber)}">
          <xsl:if test="Type='ContextualPromoSettings'">
            <xsl:attribute name="unique_id">
              <xsl:value-of select="$ABTestContextualPromoSettingsUniqueId"/>
            </xsl:attribute>
            <xsl:for-each select="Fields/Field | Fields/item">
              <xsl:choose>
                <xsl:when test="Key='EnableDntPromo'">
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'enableDntPromo'"/>
                    <xsl:with-param name="sourcePath" select="Value"/>
                  </xsl:call-template>
                </xsl:when>
                <xsl:when test="Key='EnableSafeMoneyPromo'">
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'enableSafeMoneyPromo'"/>
                    <xsl:with-param name="sourcePath" select="Value"/>
                  </xsl:call-template>
                </xsl:when>
                <xsl:when test="Key='EnableWebcamPromo'">
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'enableWebcamPromo'"/>
                    <xsl:with-param name="sourcePath" select="Value"/>
                  </xsl:call-template>
                </xsl:when>
                <xsl:when test="Key='EnablePatchManagementPromo'">
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'enablePatchManagementPromo'"/>
                    <xsl:with-param name="sourcePath" select="Value"/>
                  </xsl:call-template>
                </xsl:when>
                <xsl:when test="Key='DntPromoSchedule'">
                  <xsl:attribute name='dntPromoSchedule'>
                    <xsl:value-of select="Value" />
                  </xsl:attribute>
                </xsl:when>
                <xsl:when test="Key='SafeMoneyPromoSchedule'">
                  <xsl:attribute name='safeMoneyPromoSchedule'>
                    <xsl:value-of select="Value" />
                  </xsl:attribute>
                </xsl:when>
                <xsl:when test="Key='WebcamPromoSchedule'">
                  <xsl:attribute name='webcamPromoSchedule'>
                    <xsl:value-of select="Value" />
                  </xsl:attribute>
                </xsl:when>
                <xsl:when test="Key='PatchManagementPromoSchedule'">
                  <xsl:attribute name='patchManagementPromoSchedule'>
                    <xsl:value-of select="Value" />
                  </xsl:attribute>
                </xsl:when>
              </xsl:choose>
            </xsl:for-each>
          </xsl:if>
          <xsl:if test="Type='UcpRegistrationSettings'">
            <xsl:attribute name="unique_id">
              <xsl:value-of select="$ABTestUcpRegistrationSettingsUniqueId"/>
            </xsl:attribute>
            <xsl:for-each select="Fields/Field | Fields/item">
              <xsl:choose>
                <xsl:when test="Key='EnableEnhancedFRWFlow'">
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'enableEnhancedFRWFlow'"/>
                    <xsl:with-param name="sourcePath" select="Value"/>
                  </xsl:call-template>
                </xsl:when>
              </xsl:choose>
            </xsl:for-each>
          </xsl:if>
          <xsl:if test="Type='CompromisedAccountsSettings'">
            <xsl:attribute name="unique_id">
              <xsl:value-of select="$ABTestCompromisedAccountsSettingsUniqueId"/>
            </xsl:attribute>
            <xsl:for-each select="Fields/Field | Fields/item">
              <xsl:choose>
                <xsl:when test="Key='EnableEnhancedCompromisedAccounts'">
                  <xsl:call-template name="BooleanAsInt">
                    <xsl:with-param name="resultAttributeName" select="'enableEnhancedCompromisedAccounts'"/>
                    <xsl:with-param name="sourcePath" select="Value"/>
                  </xsl:call-template>
                </xsl:when>
              </xsl:choose>
            </xsl:for-each>
          </xsl:if>
          <xsl:if test="Type='EndOfLicensePageSettings'">
            <xsl:attribute name="unique_id">
              <xsl:value-of select="$ABTestEndOfLicensePageSettingsUniqueId"/>
            </xsl:attribute>
            <xsl:for-each select="Fields/Field | Fields/item">
              <xsl:choose>
                <xsl:when test="Key='PageType'">
                  <xsl:attribute name='pageType'>
                    <xsl:value-of select="Value" />
                  </xsl:attribute>
                </xsl:when>
              </xsl:choose>
            </xsl:for-each>
          </xsl:if>
        </xsl:element>
      </xsl:for-each>
    </settingsList>
  </xsl:template>
  <!--/ABTestScenario-->

  <!--SupportChatLinkSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='0C391486-2834-42F8-8AD9-568B1B1DD58E']/SupportChatLinkSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <item_0000>
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$SupportChatLinkSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
            <xsl:with-param name="sourcePath" select="DisableShowContent"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
          <xsl:attribute name="title">
            <xsl:value-of select="Title"/>
          </xsl:attribute>
          <xsl:attribute name="description">
            <xsl:value-of select="Description"/>
          </xsl:attribute>
          <xsl:attribute name="chatUri">
            <xsl:value-of select="ChatUri"/>
          </xsl:attribute>
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'disableSupportChatLink'"/>
            <xsl:with-param name="sourcePath" select="DisableSupportChatLink"/>
            <xsl:with-param name="isNegative" select="false()"/>
          </xsl:call-template>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/SupportChatLinkSettings-->

  <!--ApplicationConfigurationSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='2E73E557-92AA-4172-8570-00A8A4E48D7E']/ApplicationConfigurationSettings">
    <root>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RootUniqueId"/>
      </xsl:attribute>
      <Items>
        <xsl:element name="item_0000">
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$AppConfigSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="contentId">
            <xsl:value-of select="Id"/>
          </xsl:attribute>
          <settingsList>
            <xsl:for-each select="Settings/item[Type='UpdatableUiSettings']">
              <xsl:variable name="strSettingsItemNumber">
                <xsl:call-template name="prepend-pad">
                  <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
                  <xsl:with-param name="padChar" select="0"/>
                  <xsl:with-param name="padVar" select="string(position()-1)"/>
                </xsl:call-template>
              </xsl:variable>
              <xsl:element name="{concat('item_', $strSettingsItemNumber)}">
                <xsl:choose>
                  <xsl:when test="Type='UpdatableUiSettings'">
                    <xsl:call-template name="UpdatableUiSettings"/>
                  </xsl:when>
                </xsl:choose>
              </xsl:element>
            </xsl:for-each>
          </settingsList>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/ApplicationConfigurationSettings-->

  <!--UpdatableUiSettings-->
  <xsl:template name="UpdatableUiSettings">
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$UpdatableUiSettingsUniqueId"/>
    </xsl:attribute>
    <xsl:attribute name="downloadUri">
      <xsl:value-of select="Fields/item[Key='DownloadUri']/Value"/>
    </xsl:attribute>
    <xsl:attribute name="checksum">
      <xsl:value-of select="Fields/item[Key='Checksum']/Value"/>
    </xsl:attribute>
    <xsl:attribute name="expirationDate">
      <xsl:value-of select="Fields/item[Key='ExpirationDate']/Value"/>
    </xsl:attribute>
  </xsl:template>
  <!--/UpdatableUiSettings-->

  <!--Severity-->
	<xsl:template name="Severity">
    <xsl:param name="sourcePath"/>
    <xsl:variable name="severity">
      <xsl:value-of select="$sourcePath"/>
    </xsl:variable>
    <xsl:attribute name="severity">
      <xsl:choose>
        <xsl:when test="$severity='Alarm'">
          <xsl:value-of select="1"/> 
        </xsl:when>
        <xsl:when test="$severity='Warning'">
          <xsl:value-of select="2"/>
        </xsl:when>
        <!-- This important state is used in SecurityNews content. 
             In ipm_severity.h 2 - is Important. Why it translates from Warning to Important i don't know.
             -->
        <xsl:when test="$severity='Important'">
          <xsl:value-of select="2"/>
        </xsl:when>
        <xsl:when test="$severity='Information'">
          <xsl:value-of select="3"/>
        </xsl:when>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--Severity-->

  <!--Schedule-->
  <xsl:template name="Schedule">
    <xsl:param name="sourcePath"/>
    <Filter>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$ScheduleUniqueId"/>
      </xsl:attribute>
      <xsl:call-template name="RangeNodeListToAttribute">
        <xsl:with-param name="sourcePath" select="$sourcePath/LicenseExpiration/DaysToExpiration"/>
        <xsl:with-param name="resultAttributeName" select="'DaysLeft'"/>
      </xsl:call-template>
      <xsl:call-template name="RangeNodeListToAttribute">
        <xsl:with-param name="sourcePath" select="$sourcePath/LicenseExpiration/DaysAfterExpiration"/>
        <xsl:with-param name="resultAttributeName" select="'DaysAfter'"/>
      </xsl:call-template>
      <xsl:call-template name="RangeNodeListToAttribute">
        <xsl:with-param name="sourcePath" select="$sourcePath/LicenseExpiration/DaysAfterActivation"/>
        <xsl:with-param name="resultAttributeName" select="'LicUsageDays'"/>
      </xsl:call-template>
      <xsl:call-template name="RangeNodeListToAttribute">
        <xsl:with-param name="sourcePath" select="$sourcePath/LicenseSubscription/DaysToExpiration"/>
        <xsl:with-param name="resultAttributeName" select="'LicDaysToSubsExp'"/>
      </xsl:call-template>
      <xsl:call-template name="RangeNodeListToAttribute">
        <xsl:with-param name="sourcePath" select="$sourcePath/LicenseSubscription/DaysAfterExpiration"/>
        <xsl:with-param name="resultAttributeName" select="'LicDaysSinceSubsExp'"/>
      </xsl:call-template>
      <xsl:call-template name="RangeNodeListToAttribute">
        <xsl:with-param name="sourcePath" select="$sourcePath/DateTimeRangeList/DateTimeRange"/>
        <xsl:with-param name="resultAttributeName" select="'ViewDates'"/>
      </xsl:call-template>
      <xsl:call-template name="IncludeExcludeNodeListToAttribute">
        <xsl:with-param name="includeListSourcePath" select="$sourcePath/IncludeLicenseStatusList/LicenseStatus"/>
        <xsl:with-param name="excludeListSourcePath" select="$sourcePath/ExcludeLicenseStatusList/LicenseStatus"/>
        <xsl:with-param name="resultAttributeName" select="'LegalStatus'"/>
      </xsl:call-template>
      <xsl:call-template name="IncludeExcludeNodeListToAttribute">
        <xsl:with-param name="includeListSourcePath" select="$sourcePath/IncludeLicenseTypeList/LicenseType"/>
        <xsl:with-param name="excludeListSourcePath" select="$sourcePath/ExcludeLicenseTypeList/LicenseType"/>
        <xsl:with-param name="resultAttributeName" select="'KeyType'"/>
      </xsl:call-template>
      <xsl:call-template name="IncludeExcludeNodeListToAttribute">
        <xsl:with-param name="includeListSourcePath" select="$sourcePath/IncludeApplicationStatusList/ApplicationStatus"/>
        <xsl:with-param name="excludeListSourcePath" select="$sourcePath/ExcludeApplicationStatusList/ApplicationStatus"/>
        <xsl:with-param name="resultAttributeName" select="'ProductState'"/>
      </xsl:call-template>
      <xsl:call-template name="DateParam">
        <xsl:with-param name="sourcePath" select="$sourcePath/ProviderParamList/ProviderParam"/>
      </xsl:call-template>
      <xsl:call-template name="IntegerParam">
        <xsl:with-param name="sourcePath" select="$sourcePath/ProviderParamList/ProviderParam"/>
      </xsl:call-template>
      <xsl:call-template name="StringParam">
        <xsl:with-param name="sourcePath" select="$sourcePath/ProviderParamList/ProviderParam"/>
      </xsl:call-template>
    </Filter>
  </xsl:template>
  <!--/Schedule-->
    
  <!-- DateParam -->
  <xsl:template name="DateParam">
    <xsl:param name="sourcePath"/>
    <LicAddInfoDate>
    <xsl:for-each select="$sourcePath/DateParam[ExactDateValueRange]/ParamId|$sourcePath/DateParam[ExactDateValue]/ParamIdRange/From|$sourcePath/DateParam[ExactDateValue]/ParamIdRange/To|$sourcePath/DateParam[CurrentDateValue]/ParamIdRange/From|$sourcePath/DateParam[CurrentDateValue]/ParamIdRange/To">
      <xsl:variable name="itemNumber">
        <xsl:call-template name="prepend-pad">
          <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
          <xsl:with-param name="padChar" select="0"/>
          <xsl:with-param name="padVar" select="string(position()-1)"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:element name="{concat('item_', $itemNumber)}">
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$FilterDateUniqueId"/>
        </xsl:attribute>
        <!-- ExactDateValueRange -->
        <xsl:if test="name() = 'ParamId'">
          <xsl:call-template name="ExactDateValueRange">
            <xsl:with-param name="sourcePath" select="current()/.."/>
          </xsl:call-template>
        </xsl:if>				
        <!-- ExactDateValue -->
        <xsl:if test="(current()/../../ExactDateValue) and (name() = 'From')">
          <xsl:call-template name="ExactDateValueFrom">
            <xsl:with-param name="sourcePath" select="current()/../.."/>
          </xsl:call-template>
        </xsl:if>
        <xsl:if test="(current()/../../ExactDateValue) and (name() = 'To')">
          <xsl:call-template name="ExactDateValueTo">
            <xsl:with-param name="sourcePath" select="current()/../.."/>
          </xsl:call-template>
        </xsl:if>
        <!-- CurrentDateValue -->
        <xsl:if test="(current()/../../CurrentDateValue) and (name() = 'From')">
          <xsl:call-template name="CurrentDateValueFrom">
            <xsl:with-param name="sourcePath" select="current()/../.."/>
          </xsl:call-template>
        </xsl:if>
        <xsl:if test="(current()/../../CurrentDateValue) and (name() = 'To')">
          <xsl:call-template name="CurrentDateValueTo">
            <xsl:with-param name="sourcePath" select="current()/../.."/>
          </xsl:call-template>
        </xsl:if>				
      </xsl:element>
    </xsl:for-each>
    </LicAddInfoDate>
  </xsl:template>
  <xsl:template name="ExactDateValueRange">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="Id">
      <xsl:value-of select="$sourcePath/ParamId/text()"/>
    </xsl:attribute>
    <xsl:attribute name="Value">
      <xsl:value-of select="concat($sourcePath/ExactDateValueRange/From/text(),'-',$sourcePath/ExactDateValueRange/To/text())"/>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="ExactDateValueFrom">
    <xsl:param name="sourcePath"/>
      <xsl:attribute name="Id">
    <xsl:value-of select="$sourcePath/ParamIdRange/From/text()"/>
    </xsl:attribute>
    <xsl:attribute name="Value">
      <xsl:value-of select="concat('-',$sourcePath/ExactDateValue/text())"/>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="ExactDateValueTo">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="Id">
      <xsl:value-of select="$sourcePath/ParamIdRange/To/text()"/>
    </xsl:attribute>
    <xsl:attribute name="Value">
      <xsl:value-of select="concat($sourcePath/ExactDateValue/text(),'-')"/>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="CurrentDateValueFrom">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="Id">
      <xsl:value-of select="$sourcePath/ParamIdRange/From/text()"/>
    </xsl:attribute>
    <xsl:attribute name="Value">
      <xsl:value-of select="'-now'"/>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="CurrentDateValueTo">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="Id">
      <xsl:value-of select="$sourcePath/ParamIdRange/To/text()"/>
    </xsl:attribute>
    <xsl:attribute name="Value">
      <xsl:value-of select="'now-'"/>
    </xsl:attribute>
  </xsl:template>
  <!-- /DateParam -->

  <!-- IntegerParam -->
  <xsl:template name="IntegerParam">
    <xsl:param name="sourcePath"/>
    <LicAddInfoInt>
    <xsl:for-each select="$sourcePath/IntegerParam">
      <xsl:variable name="itemNumber">
        <xsl:call-template name="prepend-pad">
          <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
          <xsl:with-param name="padChar" select="0"/>
          <xsl:with-param name="padVar" select="string(position()-1)"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:element name="{concat('item_', $itemNumber)}">
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$FilterIntegerUniqueId"/>
        </xsl:attribute>
        <xsl:call-template name="ExactIntegerValue">
          <xsl:with-param name="sourcePath" select="current()"/>
        </xsl:call-template>
      </xsl:element>			
    </xsl:for-each>
    </LicAddInfoInt>
  </xsl:template>
  <xsl:template name="ExactIntegerValue">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="Id">
      <xsl:value-of select="$sourcePath/ParamId/text()"/>
    </xsl:attribute>
    <xsl:attribute name="Value">
      <xsl:value-of select="concat($sourcePath/Value/From/text(),'-',$sourcePath/Value/To/text())"/>
    </xsl:attribute>
  </xsl:template>
  <!-- /IntegerParam -->

  <!-- StringParam -->
  <xsl:template name="StringParam">
    <xsl:param name="sourcePath"/>
    <LicAddInfoStr>
    <xsl:for-each select="$sourcePath/StringParam">
      <xsl:variable name="itemNumber">
      <xsl:call-template name="prepend-pad">
        <xsl:with-param name="length" select="$ItemNumberMaxLength"/>
        <xsl:with-param name="padChar" select="0"/>
        <xsl:with-param name="padVar" select="string(position()-1)"/>
      </xsl:call-template>
      </xsl:variable>
      <xsl:element name="{concat('item_', $itemNumber)}">
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$FilterStringUniqueId"/>
        </xsl:attribute>
        <xsl:call-template name="ExactStringValue">
          <xsl:with-param name="sourcePath" select="current()"/>
        </xsl:call-template>
      </xsl:element>			
    </xsl:for-each>
    </LicAddInfoStr>
  </xsl:template>
  <xsl:template name="ExactStringValue">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="Id">
      <xsl:value-of select="$sourcePath/ParamId/text()"/>
    </xsl:attribute>
    <xsl:attribute name="Value">
      <xsl:value-of select="$sourcePath/Value/text()"/>
    </xsl:attribute>
  </xsl:template>
  <!-- /StringParam -->
  
  <xsl:template name="RangeNodeListToAttribute">
    <xsl:param name="sourcePath"/>
    <xsl:param name="isNegative"/>
    <xsl:param name="resultAttributeName" select="name($sourcePath)"/>
    <xsl:param name="result">
      <xsl:for-each select="$sourcePath">
        <xsl:if test="$isNegative='true'">
          <xsl:value-of select="'!'"/>
        </xsl:if>
        <xsl:if test="position()!=1">
          <xsl:value-of select="','"/>
        </xsl:if>
        <xsl:value-of select="concat(current()/From/text(),'-',current()/To/text())"/>
      </xsl:for-each>
    </xsl:param>
    <xsl:attribute name="{$resultAttributeName}">
      <xsl:value-of select="$result"/>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="IncludeExcludeNodeListToAttribute">
    <xsl:param name="includeListSourcePath"/>
    <xsl:param name="excludeListSourcePath"/>
    <xsl:param name="resultAttributeName"/>
    <xsl:param name="result">
      <xsl:for-each select="$includeListSourcePath">
        <xsl:if test="position()!=1">
          <xsl:value-of select="';'"/>
        </xsl:if>
        <xsl:value-of select="current()/text()"/>
      </xsl:for-each>
      <xsl:for-each select="$excludeListSourcePath">
        <xsl:if test="position()!=1 or count($includeListSourcePath)>0">
          <xsl:value-of select="';'"/>
        </xsl:if>
        <xsl:value-of select="'!'"/>
        <xsl:value-of select="current()/text()"/>
      </xsl:for-each>
    </xsl:param>
    <xsl:attribute name="{$resultAttributeName}">
      <xsl:value-of select="$result"/>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="BooleanAsInt">
    <xsl:param name="sourcePath"/>
    <xsl:param name="resultAttributeName"/>
    <xsl:param name="isNegative" select="false()"/>
    <xsl:variable name="sourceValue" select="$sourcePath"/>
    <xsl:variable name="lowerSourceValue" select="translate($sourceValue,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
    <xsl:attribute name="{$resultAttributeName}">
      <xsl:choose>
        <xsl:when test="($lowerSourceValue = 'true' and $isNegative = false()) or ($lowerSourceValue = 'false' and $isNegative = true())">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="0"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="OptionalBooleanAsInt">
    <xsl:param name="sourcePath"/>
    <xsl:param name="resultAttributeName"/>
    <xsl:param name="isNegative" select="false()"/>
    <xsl:param name="defaultValue"/>
    <xsl:variable name="sourceValue" select="$sourcePath"/>
    <xsl:variable name="lowerSourceValue" select="translate($sourceValue,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
    <xsl:attribute name="{$resultAttributeName}">
      <xsl:choose>
        <xsl:when test="not($sourcePath) or $sourcePath = ''">
          <xsl:value-of select="$defaultValue"/>
        </xsl:when>
        <xsl:when test="($lowerSourceValue = 'true' and $isNegative = false()) or ($lowerSourceValue = 'false' and $isNegative = true())">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="0"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="prepend-pad">
    <xsl:param name="padChar"/>
    <xsl:param name="padVar"/>
    <xsl:param name="length"/>
    <xsl:choose>
      <xsl:when test="string-length($padVar) &lt; $length">
        <xsl:call-template name="prepend-pad">
          <xsl:with-param name="padChar" select="$padChar"/>
          <xsl:with-param name="padVar" select="concat($padChar,$padVar)"/>
          <xsl:with-param name="length" select="$length"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="substring($padVar,string-length($padVar) - $length + 1)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="WindowShowModeAttribute">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="showMode">
      <xsl:choose>
        <xsl:when test="$sourcePath='ShowBehindActiveWindow'">
          <xsl:value-of select="'1'"/>
        </xsl:when>
        <xsl:when test="$sourcePath='ShowInFrontOfActiveWindow'">
          <xsl:value-of select="'2'"/>
        </xsl:when>
        <xsl:when test="$sourcePath='ShowDefault'">
          <xsl:value-of select="'0'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'0'" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <xsl:template name="WindowDisplaySettings">
    <xsl:param name="sourcePath"/>
    <windowDisplaySettings>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$WindowDisplaySettingsUniqueId"/>
      </xsl:attribute>
      <xsl:call-template name="WindowShowModeAttribute">
        <xsl:with-param name="sourcePath" select="$sourcePath/ShowMode"/>
      </xsl:call-template>
      <xsl:if test="$sourcePath/AutoCloseTimeInSec">
        <xsl:attribute name="autoCloseTimeInSec">
          <xsl:value-of select="$sourcePath/AutoCloseTimeInSec"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:call-template name="BooleanAsInt">
        <xsl:with-param name="resultAttributeName" select="'autoClose'"/>
        <xsl:with-param name="sourcePath" select="$sourcePath/AutoClose"/>
        <xsl:with-param name="isNegative" select="false()"/>
      </xsl:call-template>
    </windowDisplaySettings>
  </xsl:template>
</xsl:stylesheet>
