<?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="RootUniqueId">0xCF742638</xsl:variable>
  <xsl:variable name="LicenseNotificationSettingsUniqueId">0x87906A90</xsl:variable>
  <xsl:variable name="RegretPageUniqueId">0x6d1c80b8</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="ApplicationButtonUniqueId">0xB14E3D73</xsl:variable>
  <xsl:variable name="TryTierApplicationButtonUniqueId">0xda839b8a</xsl:variable>
  <xsl:variable name="SidebarButtonSettingsUniqueId">0xa20d6690</xsl:variable>
  <xsl:variable name="LicenseNotificationUniqueId">0x964515ee</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="BackgroundSettingsUniqueId">0x0F145804</xsl:variable>
  <xsl:variable name="UcpReadySettingsUniqueId">0x895F5115</xsl:variable>
  <xsl:variable name="VerCheckUniqueId">0x7b173423</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="UpgradeProtectionPageSettingsUniqueId">0x6860501b</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="ABTestFakeTypeForTestingUniqueId">0xcc08c65e</xsl:variable>
  <xsl:variable name="ABTestScenarioUniqueId">0x4463887d</xsl:variable>
  <xsl:variable name="ABTestSettingsUniqueId">0x282ed05e</xsl:variable>
  <xsl:variable name="ContextualPromoSettingsUniqueId">0xc84203ba</xsl:variable>
  <xsl:variable name="ServiceSettingsPatchUniqueId">0xe32e551f</xsl:variable>
  <xsl:variable name="ServiceSettingsPatchItemUniqueId">0xef209b5c</xsl:variable>
  <xsl:variable name="UpdatableUiSettingsUniqueId">0xda99fe35</xsl:variable>
  <xsl:variable name="AppConfigSettingsUniqueId">0x265f39ec</xsl:variable>
  <xsl:variable name="SupportChatLinkSettingsUniqueId">0x36a75ac1</xsl:variable>
  <xsl:variable name="MidTermUpgradeUniqueId">0x68cacce9</xsl:variable>
  <xsl:variable name="MarketplaceSettingsUniqueId">0xa213624d</xsl:variable>
  <xsl:variable name="MarketplaceNotificationDriveSpaceTriggerUniqueId">0x320384fb</xsl:variable>
  <xsl:variable name="MarketplaceProductPopupUniqueId">0xbb34aba7</xsl:variable>
  <xsl:variable name="MarketplaceProductSystemRequirementsUniqueId">0xf496be6f</xsl:variable>
  <xsl:variable name="MarketplaceProductAgreementsUniqueId">0x12049e66</xsl:variable>
  <xsl:variable name="NotificationScheduleUniqueId">0x0d939edf</xsl:variable>
  <xsl:variable name="NotificationScheduleV2UniqueId">0x74f8d3ad</xsl:variable>  
  <xsl:variable name="MarketplaceProductOfferUniqueId">0x847351b3</xsl:variable>
  <xsl:variable name="MarketplaceProductOfferPromoUniqueId">0x70cc3a77</xsl:variable>
  <xsl:variable name="MarketplaceBundleProductOfferUniqueId">0x8096876b</xsl:variable>
  <xsl:variable name="MarketplaceBundleProductOfferPromoUniqueId">0xeb93c3eb</xsl:variable>
  <xsl:variable name="RecommendationPromoPageUniqueId">0x10A7C68B</xsl:variable>
  <xsl:variable name="RecommendationUniqueId">0x16371D7B</xsl:variable>
  <xsl:variable name="RecommendationCustomizationUniqueId">0x112CEF5E</xsl:variable>
  <xsl:variable name="ExtendApplicationButtonSettingsUniqueId">0x501f8826</xsl:variable>
  <xsl:variable name="RetailToSubscriptionFirstRunWizardUniqueId">0xcfcc9fb8</xsl:variable>
  <xsl:variable name="RetailToSubscriptionUserProfileUniqueId">0xe413112d</xsl:variable>
  <xsl:variable name="RetailToSubscriptionUniqueId">0xce23d34f</xsl:variable>
  <xsl:variable name="FrwTrialOfferTierSettingsUniqueId">0x6ab3520b</xsl:variable>
  <xsl:variable name="FrwTrialOfferBlockUniqueId">0x437ff8f5</xsl:variable>
  <xsl:variable name="FrwTrialOfferSettingsUniqueId">0xf0de9bdd</xsl:variable>
  <xsl:variable name="ToastNotificationUniqueId">0x1a4f2585</xsl:variable>
  <xsl:variable name="SubstitutionUniqueId">0xbc1d4d19</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>

          <!--
              It's crutch for Bug 5294951: [2021MR5][Req] Product receives IPM UCPConnection=disabled.
              After fix the product behavior in next product versions (2021 MR6?) revert this back;
              See https://confluence.kaspersky.com/pages/viewpage.action?pageId=440796533
          -->
          <xsl:choose>
            <xsl:when test="UcpConnection='Disabled'">
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                <xsl:with-param name="sourcePath" select="true()"/>
              </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
                <xsl:with-param name="sourcePath" select="DisableShowContent"/>
              </xsl:call-template>
            </xsl:otherwise>
          </xsl:choose>
          
          <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>
  <!--/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>
        <item_0000>
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$LicenseNotificationSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>
          
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enable'"/>
            <xsl:with-param name="sourcePath" select="EnableIpmMessagesOnly"/>
            <xsl:with-param name="isNegative" select="true()"/>
          </xsl:call-template>
        </item_0000>
      </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:call-template name="CustomizableItem"/>

          <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-->

  <!--RegretPage-->
  <xsl:template match="/IpmContentCustomization[@Version='D16EDD72-BF35-4088-88C4-766CAAD8FF51']/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:call-template name="CustomizableItem"/>

          <xsl:attribute name="url">
            <xsl:value-of select="ExternalContentUrl"/>
          </xsl:attribute>
          <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>
  <!--/RegretPage-->

  <!--VerCheck-->
  <xsl:template match="/IpmContentCustomization[@Version='95CE5CC0-77C1-4F35-94CA-EC93121D6CE5']/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:call-template name="CustomizableItem"/>
            
          <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="distributiveExecutionArguments">
            <xsl:value-of select="DistributiveExecutionArguments"/>
          </xsl:attribute>
          <xsl:attribute name="internalProductName">
            <xsl:value-of select="InternalProductName"/>
          </xsl:attribute>
          <xsl:attribute name="showMessageInDays">
            <xsl:value-of select="ShowMessageDaysCount"/>
          </xsl:attribute>
          <xsl:attribute name="remindLaterInDays">
            <xsl:call-template name="OptionalInt">
              <xsl:with-param name="sourcePath" select="RemindLaterInDays"/>
              <xsl:with-param name="defaultValue" select="0"/>
            </xsl:call-template>
          </xsl:attribute>
        </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'
                or @Version='284FB6B3-96B7-480D-AFE2-457BAFB42F52']/News">
    <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="$NewsUniqueId"/>
          </xsl:attribute>
          <items>
            <item_0000>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$NewsItemUniqueId"/>
              </xsl:attribute>
              <xsl:call-template name="CustomizableItem"/>

              <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:call-template name="NotificationRepeatSettings">
                <xsl:with-param name="sourcePath" select="NotificationSchedule"/>
              </xsl:call-template>
              <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:call-template>
              <xsl:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'ignoreUserSettings'"/>
                <xsl:with-param name="sourcePath" select="IgnoreDisableShowSetting"/>
              </xsl:call-template>
            </item_0000>
          </items>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/News-->

  <!--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>
        <item_0000>
          <xsl:attribute name="unique_id">
            <xsl:value-of select="$ApplicationButtonUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem">
            <xsl:with-param name="contentIdSourcePath" select="Button/Id"/>
          </xsl:call-template>

          <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:value-of select="Button/CustomUri" />
          </xsl:attribute>
        </item_0000>
      </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>
  <!--/ApplicationButtonListSettings-->

  <!--TryTierApplicationButtonSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='B9B6279E-CE13-495C-BE45-D61610D69BF3']/TryTierApplicationButtonSettings">
    <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="$TryTierApplicationButtonUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:attribute name="tierId">
            <xsl:value-of select="Button/TierId"/>
          </xsl:attribute>
          <xsl:attribute name="name">
            <xsl:value-of select="Button/ButtonName"/>
          </xsl:attribute>
          <xsl:attribute name="target">
            <xsl:value-of select="Button/CustomUri" />
          </xsl:attribute>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/TryTierApplicationButtonSettings-->

  <!--SidebarButtonSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='A82F275A-1CF6-456A-8FAA-B5D607590189']/SidebarButtonSettings">
    <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="$SidebarButtonSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:attribute name="name">
            <xsl:value-of select="Button/Name"/>
          </xsl:attribute>
          <xsl:attribute name="description">
            <xsl:value-of select="Button/Description"/>
          </xsl:attribute>
          <xsl:attribute name="iconUri">
            <xsl:value-of select="Button/IconUri"/>
          </xsl:attribute>

          <xsl:if test="Button/Action/ButtonUri">
            <xsl:attribute name="buttonUri">
              <xsl:value-of select="Button/Action/ButtonUri"/>
            </xsl:attribute>
          </xsl:if>
          <xsl:if test="Button/Action/ApplicationPage">
            <xsl:attribute name="applicationPage">
              <xsl:value-of select="Button/Action/ApplicationPage"/>
            </xsl:attribute>
          </xsl:if>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/SidebarButtonSettings-->

  <!--LicenseNotification-->
  <xsl:template match="/IpmContentCustomization[@Version='5185F597-9C2C-4105-B0CF-AE631FF96C5B']/LicenseNotification">
    <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="$LicenseNotificationUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <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:call-template>

          <xsl:call-template name="SetOptionalFieldInitializedFlag">
            <xsl:with-param name="sourcePath" select="NotificationSchedule"/>
            <xsl:with-param name="fieldName" select="'schedule'"/>
          </xsl:call-template>

          <xsl:if test="MessageBox">
          <xsl:call-template name="MessageBoxSettings">
            <xsl:with-param name="sourcePath" select="MessageBox" />
          </xsl:call-template>
          </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:call-template name="BooleanAsInt">
                <xsl:with-param name="resultAttributeName" select="'forceShowButton'"/>
                <xsl:with-param name="sourcePath" select="ApplicationMainPage/ShowApplicationButton"/>
              </xsl:call-template>
            </mainWindowSettings>
          </xsl:if>
          <xsl:if test="NotificationSchedule">
            <schedule>
              <xsl:call-template name="NotificationScheduleSettings">
                <xsl:with-param name="sourcePath" select="NotificationSchedule"/>
              </xsl:call-template>
            </schedule>
          </xsl:if>
        </item_0000>
      </Items>
    </root>
  </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="PrependPad">
                  <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:call-template name="CustomizableItem">
                  <xsl:with-param name="contentIdSourcePath" select="../Id"/>
                  <xsl:with-param name="disableShowContentSourcePath" select="../DisableShowContent"/>
                </xsl:call-template>

                <xsl:attribute name="redirectionUri">
                  <xsl:value-of select="../RedirectionServiceUri"/>
                </xsl:attribute>
                <uriList>
                  <xsl:for-each select="BrowserUri | item">
                    <xsl:variable name="browserUriItemNumber">
                      <xsl:call-template name="PrependPad">
                        <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 | UriIgnoreParameterList/item">
                          <xsl:variable name="ignoreParameterItemNumber">
                            <xsl:call-template name="PrependPad">
                              <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>
                </uriList>
              </xsl:element>
            </xsl:for-each>
          </items>
        </xsl:element>
      </Items>
    </root>
  </xsl:template>
  <!--/BrowserRedirectionSettings-->

  <!--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:call-template name="CustomizableItem"/>

          <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:when test="TargetMigrationProductType = 1">
                <xsl:value-of select="'kav'"/>
              </xsl:when>
              <xsl:when test="TargetMigrationProductType = 2">
                <xsl:value-of select="'pure'"/>
              </xsl:when>
              <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:call-template name="CustomizableItem"/>

          <xsl:attribute name="replaceContentMetaFileUri">
            <xsl:value-of select="ReplaceContentMetaFileUri"/>
          </xsl:attribute>

          <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="PrependPad">
                  <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:call-template name="CustomizableItem"/>

          <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="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:call-template name="CustomizableItem"/>

          <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="PrependPad">
                  <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] | Settings/item[Type]">
        <xsl:variable name="settingsItemListNumber">
          <xsl:call-template name="PrependPad">
            <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:choose>
            <xsl:when test="Type='ABTestFakeTypeForTesting'">
              <xsl:call-template name="ABTestFakeTypeForTesting" />
            </xsl:when>
          </xsl:choose>
        </xsl:element>
      </xsl:for-each>
    </settingsList>
  </xsl:template>
  <!--/ABTestScenario-->

  <!-- ABTestFakeTypeForTesting -->
  <xsl:template name="ABTestFakeTypeForTesting">
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$ABTestFakeTypeForTestingUniqueId"/>
    </xsl:attribute>
    <xsl:for-each select="Fields/Field | Fields/item">
      <xsl:choose>
        <xsl:when test="Key='Key1'">
          <xsl:attribute name='key1'>
            <xsl:value-of select="Value" />
          </xsl:attribute>
        </xsl:when>
        <xsl:when test="Key='Key2'">
          <xsl:attribute name='key2'>
            <xsl:value-of select="Value" />
          </xsl:attribute>
        </xsl:when>
        <xsl:when test="Key='Key3'">
          <xsl:attribute name='key3'>
            <xsl:value-of select="Value" />
          </xsl:attribute>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>

  <!--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:call-template name="CustomizableItem"/>

          <settingsList>
            <xsl:for-each select="Settings/item[Type='ContextualPromoSettings' or Type='ServiceSettingsPatch' or Type='UpdatableUiSettings']">
              <xsl:variable name="strSettingsItemNumber">
                <xsl:call-template name="PrependPad">
                  <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='ContextualPromoSettings'">
                    <xsl:call-template name="ContextualPromoSettings">
                      <xsl:with-param name="uniqueId" select="$ContextualPromoSettingsUniqueId"/>
                    </xsl:call-template>
                  </xsl:when>
                  <xsl:when test="Type='ServiceSettingsPatch'">
                    <xsl:call-template name="ServiceSettingsPatch"/>
                  </xsl:when>
                  <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-->

  <!--ContextualPromoSettings-->
  <xsl:template name="ContextualPromoSettings">
    <xsl:param name="uniqueId"/>
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$uniqueId"/>
    </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='EnablePrivacyCleanerPromo'">
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enablePrivacyCleanerPromo'"/>
            <xsl:with-param name="sourcePath" select="Value"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="Key='EnablePCSpeedUpPromo'">
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enablePCSpeedUpPromo'"/>
            <xsl:with-param name="sourcePath" select="Value"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="Key='EnableDuplicatesPromo'">
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enableDuplicatesPromo'"/>
            <xsl:with-param name="sourcePath" select="Value"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="Key='EnableLargeFilesPromo'">
          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enableLargeFilesPromo'"/>
            <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:when test="Key='PrivacyCleanerPromoSchedule'">
          <xsl:attribute name='privacyCleanerPromoSchedule'>
            <xsl:value-of select="Value" />
          </xsl:attribute>
        </xsl:when>
        <xsl:when test="Key='PCSpeedUpPromoSchedule'">
          <xsl:attribute name='pcSpeedUpPromoSchedule'>
            <xsl:value-of select="Value" />
          </xsl:attribute>
        </xsl:when>
        <xsl:when test="Key='DuplicatesPromoSchedule'">
          <xsl:attribute name='duplicatesPromoSchedule'>
            <xsl:value-of select="Value" />
          </xsl:attribute>
        </xsl:when>
        <xsl:when test="Key='LargeFilesPromoSchedule'">
          <xsl:attribute name='largeFilesPromoSchedule'>
            <xsl:value-of select="Value" />
          </xsl:attribute>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
  </xsl:template>
  <!--/ContextualPromoSettings-->

  <!--ServiceSettingsPatch-->
  <xsl:template name="ServiceSettingsPatch">
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$ServiceSettingsPatchUniqueId"/>
    </xsl:attribute>
    <xsl:attribute name="serviceKey">
      <xsl:value-of select="Fields/item[Key='ServiceKey']/Value"/>
    </xsl:attribute>
    <items>
      <xsl:for-each select="Fields/item[Key != 'ServiceKey']">
        <xsl:variable name="strItemNumber">
          <xsl:call-template name="PrependPad">
            <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="$ServiceSettingsPatchItemUniqueId"/>
          </xsl:attribute>
          <xsl:attribute name="key">
            <xsl:value-of select="Key"/>
          </xsl:attribute>
          <xsl:attribute name="value">
            <xsl:value-of select="Value"/>
          </xsl:attribute>
        </xsl:element>
      </xsl:for-each>
    </items>
  </xsl:template>
  <!--/ServiceSettingsPatch-->

  <!--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-->

  <!--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:call-template name="CustomizableItem"/>

          <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:call-template>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!-- /SupportChatLinkSettings-->

  <!--MidTermUpgrade-->
  <xsl:template match="/IpmContentCustomization[@Version='3477BE55-02DB-4690-9326-76ABBF596B63'
                or @Version='5621A26E-8E22-4CC4-8164-E62F7959E780']/MidTermUpgrade">
    <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="$MidTermUpgradeUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:attribute name="mainPageContentUri">
            <xsl:value-of select="MainPageContentUri"/>
          </xsl:attribute>
          <xsl:attribute name="buttonName">
            <xsl:value-of select="UserProfile/ButtonName"/>
          </xsl:attribute>
          <xsl:attribute name="buttonUrl">
            <xsl:value-of select="UserProfile/ButtonUrl"/>
          </xsl:attribute>
          <xsl:attribute name="title">
            <xsl:value-of select="UserProfile/Title"/>
          </xsl:attribute>
          <xsl:attribute name="description">
            <xsl:value-of select="UserProfile/Description"/>
          </xsl:attribute>
          <xsl:attribute name="iconUri">
            <xsl:value-of select="UserProfile/IconUri"/>
          </xsl:attribute>

          <xsl:call-template name="NotificationRepeatSettings">
            <xsl:with-param name="sourcePath" select="NotificationSchedule"/>
          </xsl:call-template>

          <xsl:if test="MessageBox">
            <xsl:call-template name="MessageBoxSettings">
              <xsl:with-param name="sourcePath" select="MessageBox" />
            </xsl:call-template>
          </xsl:if>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/MidTermUpgrade-->
  
  <!--MarketplaceSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='B4EC25F7-9592-4ED6-B7CE-FFFD6C852153']/MarketplaceSettings">
    <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="$MarketplaceSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'enabled'"/>
            <xsl:with-param name="sourcePath" select="Enabled"/>
          </xsl:call-template>

          <xsl:attribute name="title">
            <xsl:value-of select="Title"/>
          </xsl:attribute>
          <xsl:attribute name="subtitle">
            <xsl:value-of select="Subtitle"/>
          </xsl:attribute>

          <xsl:attribute name="termsOfUseLinkLocation">
            <xsl:choose>
              <xsl:when test="TermsOfUseLinkLocation='Hidden'">
                <xsl:value-of select="0"/>
              </xsl:when>
              <xsl:when test="TermsOfUseLinkLocation='Top'">
                <xsl:value-of select="1"/>
              </xsl:when>
              <xsl:when test="TermsOfUseLinkLocation='Bottom'">
                <xsl:value-of select="2"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="2"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/MarketplaceSettings-->

  <!--MarketplaceProductOffer-->
  <xsl:template match="/IpmContentCustomization[@Version='3779BA63-9444-4F6E-B2FD-541F4CF2ECB5']/MarketplaceProductOffer">
    <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="$MarketplaceProductOfferUniqueId"/>
          </xsl:attribute>
         
          <xsl:call-template name="MarketplaceProductOfferBase">
          </xsl:call-template>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/MarketplaceProductOffer-->

  <!--MarketplaceProductOfferPromo-->
  <xsl:template match="/IpmContentCustomization[@Version='C836BF94-B629-4738-9855-A417E38792F6']/MarketplaceProductOfferPromo">
    <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="$MarketplaceProductOfferPromoUniqueId"/>
          </xsl:attribute>
         
          <xsl:call-template name="MarketplaceProductOfferBase">
          </xsl:call-template>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/MarketplaceProductOfferPromo-->
  
  <!--MarketplaceProductOfferBase-->
  <xsl:template name="MarketplaceProductOfferBase">
    <xsl:call-template name="CustomizableItem"/>

    <xsl:attribute name="productId">
      <xsl:value-of select="ProductId"/>
    </xsl:attribute>
    <xsl:attribute name="productName">
      <xsl:value-of select="ProductName"/>
    </xsl:attribute>
    <xsl:attribute name="productIconUri">
      <xsl:value-of select="ProductIconUri"/>
    </xsl:attribute>
    <xsl:attribute name="productDescription">
      <xsl:value-of select="ProductDescription"/>
    </xsl:attribute>
    <xsl:attribute name="purchaseUrl">
      <xsl:value-of select="PurchaseUrl"/>
    </xsl:attribute>
    <xsl:attribute name="purchaseButtonTitle">
      <xsl:value-of select="PurchaseButtonTitle"/>
    </xsl:attribute>
    <xsl:attribute name="productUserManualUrl">
      <xsl:value-of select="ProductUserManualUrl"/>
    </xsl:attribute>
    <xsl:attribute name="productDetailsUrl">
      <xsl:value-of select="ProductDetailsUrl"/>
    </xsl:attribute>
    <xsl:attribute name="marketingImageUri">
      <xsl:value-of select="MarketingImageUri"/>
    </xsl:attribute>
    <xsl:attribute name="offerId">
      <xsl:value-of select="OfferId"/>
    </xsl:attribute>
    <xsl:attribute name="myKServiceId">
      <xsl:call-template name="OptionalInt">
        <xsl:with-param name="sourcePath" select="MyKServiceId"/>
        <xsl:with-param name="defaultValue" select="0"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:attribute name="priority">
      <xsl:call-template name="OptionalInt">
        <xsl:with-param name="sourcePath" select="Priority"/>
        <xsl:with-param name="defaultValue" select="-1"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:attribute name="productSubtitle">
      <xsl:value-of select="ProductSubtitle"/>
    </xsl:attribute>
    <xsl:attribute name="productManufacturer">
      <xsl:value-of select="ProductManufacturer"/>
    </xsl:attribute>
    <xsl:attribute name="defaultLicenseObject">
      <xsl:value-of select="DefaultLicenseObject"/>
    </xsl:attribute>
    <xsl:attribute name="defaultLicenseTerm">
      <xsl:value-of select="DefaultLicenseTerm"/>
    </xsl:attribute>
    <xsl:attribute name="registrationDisclaimer">
      <xsl:value-of select="RegistrationDisclaimer"/>
    </xsl:attribute>
    <xsl:attribute name="regionalRestrictionsDisclaimer">
      <xsl:value-of select="RegionalRestrictionsDisclaimer"/>
    </xsl:attribute>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="ProductPopup"/>
      <xsl:with-param name="fieldName" select="'productPopup'"/>
    </xsl:call-template>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="SystemRequirements"/>
      <xsl:with-param name="fieldName" select="'systemRequirements'"/>
    </xsl:call-template>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="Agreements"/>
      <xsl:with-param name="fieldName" select="'agreements'"/>
    </xsl:call-template>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="MessageBox"/>
      <xsl:with-param name="fieldName" select="'messageBoxSettings'"/>
    </xsl:call-template>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="NotificationSchedule"/>
      <xsl:with-param name="fieldName" select="'notificationSchedule'"/>
    </xsl:call-template>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="HiddenOffer"/>
      <xsl:with-param name="fieldName" select="'isHidden'"/>
    </xsl:call-template>

    <xsl:call-template name="OptionalBooleanAsInt">
      <xsl:with-param name="resultAttributeName" select="'isHidden'"/>
      <xsl:with-param name="sourcePath" select="HiddenOffer"/>
    </xsl:call-template>

    <xsl:element name="productCategories">
      <xsl:call-template name="ToSimpleVector">
        <xsl:with-param name="sourcePath" select="ProductCategories/Category | ProductCategories/item"/>
      </xsl:call-template>
    </xsl:element>

    <xsl:element name="extraMarketingImageList">
      <xsl:call-template name="ToSimpleVector">
        <xsl:with-param name="sourcePath" select="ExtraMarketingImageList/ExtraMarketingImageUri | ExtraMarketingImageList/item"/>
      </xsl:call-template>
    </xsl:element>

    <xsl:element name="highResolutionMarketingImageList">
      <xsl:call-template name="ToSimpleVector">
        <xsl:with-param name="sourcePath" select="HighResolutionMarketingImageList/HighResolutionMarketingImageUri | HighResolutionMarketingImageList/item"/>
      </xsl:call-template>
    </xsl:element>

    <xsl:element name="osCompatibilityList">
      <xsl:for-each select="ProductOsCompatibilityList/Os | ProductOsCompatibilityList/item">
        <xsl:call-template name="ToVectorItem">
          <xsl:with-param name="targetValue">
            <xsl:call-template name="OfferCompatibleOs">
              <xsl:with-param name="osType" select="current()"/>
            </xsl:call-template>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:for-each>
    </xsl:element>

    <xsl:if test="ProductPopup">
      <productPopup>
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$MarketplaceProductPopupUniqueId"/>
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:value-of select="ProductPopup/Title"/>
        </xsl:attribute>
        <xsl:attribute name="description">
          <xsl:value-of select="ProductPopup/Description"/>
        </xsl:attribute>
        <xsl:attribute name="descriptionHtmlUri">
          <xsl:value-of select="ProductPopup/DescriptionHtmlUri"/>
        </xsl:attribute>
      </productPopup>
    </xsl:if>

    <xsl:if test="SystemRequirements">
      <systemRequirements>
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$MarketplaceProductSystemRequirementsUniqueId"/>
        </xsl:attribute>
        <xsl:attribute name="link">
          <xsl:value-of select="SystemRequirements/Link"/>
        </xsl:attribute>
        <xsl:attribute name="buttonTitle">
          <xsl:value-of select="SystemRequirements/ButtonTitle"/>
        </xsl:attribute>
      </systemRequirements>
    </xsl:if>

    <xsl:if test="Agreements">
      <agreements>
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$MarketplaceProductAgreementsUniqueId"/>
        </xsl:attribute>
        <xsl:attribute name="link">
          <xsl:value-of select="Agreements/Link"/>
        </xsl:attribute>
        <xsl:attribute name="buttonTitle">
          <xsl:value-of select="Agreements/ButtonTitle"/>
        </xsl:attribute>
      </agreements>
    </xsl:if>

    <xsl:if test="MessageBox">
      <xsl:call-template name="MessageBoxSettings">
        <xsl:with-param name="sourcePath" select="MessageBox" />
      </xsl:call-template>
    </xsl:if>

    <xsl:if test="NotificationSchedule">
      <xsl:call-template name="NotificationScheduleV2Settings">
        <xsl:with-param name="sourcePath" select="NotificationSchedule" />
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  <!--/MarketplaceProductOfferBase-->

  <!--MarketplaceBundleProductOffer-->
  <xsl:template match="/IpmContentCustomization[@Version='850A681B-C9C2-40FA-9155-C34AC1C370D0']/MarketplaceBundleProductOffer">
    <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="$MarketplaceBundleProductOfferUniqueId"/>
          </xsl:attribute>

          <xsl:call-template name="MarketplaceBundleProductOfferBase">
          </xsl:call-template>

          <xsl:element name="offers">
            <xsl:call-template name="ToSimpleVector">
              <xsl:with-param name="sourcePath" select="Offers/Offer/OfferId | Offers/item/item"/>
            </xsl:call-template>
          </xsl:element>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/MarketplaceBundleProductOffer-->

  <!--MarketplaceBundleProductOfferPromo-->
  <xsl:template match="/IpmContentCustomization[@Version='134D4479-252A-400A-B91B-804EFA160B44']/MarketplaceBundleProductOfferPromo">
    <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="$MarketplaceBundleProductOfferPromoUniqueId"/>
          </xsl:attribute>

          <xsl:call-template name="MarketplaceBundleProductOfferBase">
          </xsl:call-template>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/MarketplaceBundleProductOfferPromo-->

  <!--MarketplaceBundleProductOfferBase-->
  <xsl:template name="MarketplaceBundleProductOfferBase">
    <xsl:call-template name="CustomizableItem"/>

    <xsl:attribute name="bundleId">
      <xsl:value-of select="BundleId"/>
    </xsl:attribute>
    <xsl:attribute name="bundleName">
      <xsl:value-of select="BundleName"/>
    </xsl:attribute>
    <xsl:attribute name="bundleSubtitle">
      <xsl:value-of select="BundleSubtitle"/>
    </xsl:attribute>
    <xsl:attribute name="bundlePopupName">
      <xsl:value-of select="BundlePopupName"/>
    </xsl:attribute>
    <xsl:attribute name="bundleIconUri">
      <xsl:value-of select="BundleIconUri"/>
    </xsl:attribute>
    <xsl:attribute name="bundleDescription">
      <xsl:value-of select="BundleDescription"/>
    </xsl:attribute>
    <xsl:attribute name="priority">
      <xsl:call-template name="OptionalInt">
        <xsl:with-param name="sourcePath" select="Priority"/>
        <xsl:with-param name="defaultValue" select="-1"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:attribute name="benefitDescription">
      <xsl:value-of select="BenefitDescription"/>
    </xsl:attribute>
    <xsl:attribute name="benefitIconUri">
      <xsl:value-of select="BenefitIconUri"/>
    </xsl:attribute>
    <xsl:attribute name="purchaseUrl">
      <xsl:value-of select="PurchaseUrl"/>
    </xsl:attribute>
    <xsl:attribute name="purchaseButtonTitle">
      <xsl:value-of select="PurchaseButtonTitle"/>
    </xsl:attribute>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="MessageBox"/>
      <xsl:with-param name="fieldName" select="'messageBoxSettings'"/>
    </xsl:call-template>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="NotificationSchedule"/>
      <xsl:with-param name="fieldName" select="'notificationSchedule'"/>
    </xsl:call-template>

    <xsl:if test="MessageBox">
      <xsl:call-template name="MessageBoxSettings">
        <xsl:with-param name="sourcePath" select="MessageBox" />
      </xsl:call-template>
    </xsl:if>

    <xsl:if test="NotificationSchedule">
      <xsl:call-template name="NotificationScheduleV2Settings">
        <xsl:with-param name="sourcePath" select="NotificationSchedule" />
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  <!--/MarketplaceBundleProductOfferBase-->

  <!--TODO: Use it for Ipm client structs (e.g. NewsItem) that use NotificationSchedule as the member instead of inheriting RepeatableItem-->
  <!--NotificationScheduleSettings-->
  <xsl:template name="NotificationScheduleSettings">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="unique_id">
      <xsl:value-of select="$NotificationScheduleUniqueId"/>
    </xsl:attribute>
    <xsl:call-template name="NotificationRepeatSettings">
      <xsl:with-param name="sourcePath" select="$sourcePath"/>
    </xsl:call-template>
  </xsl:template>
  <!--/NotificationScheduleSettings-->

  <!--NotificationScheduleV2Settings-->
  <xsl:template name="NotificationScheduleV2Settings">
    <xsl:param name="sourcePath"/>
    <notificationSchedule>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$NotificationScheduleV2UniqueId"/>
      </xsl:attribute>

      <!--Although DateTimeRangeList means a LIST of values, really according to the xsd-schema must be one pair of From/To-->
      <xsl:attribute name="timeFrom">
        <xsl:value-of select="$sourcePath/DateTimeRangeList/TimeRange/From"/>
      </xsl:attribute>

      <xsl:attribute name="timeTo">
        <xsl:value-of select="$sourcePath/DateTimeRangeList/TimeRange/To"/>
      </xsl:attribute>

      <xsl:choose>
        <xsl:when test="$sourcePath/DriveSpaceTrigger">
          <xsl:call-template name="NotificationRepeatSettings">
            <xsl:with-param name="sourcePath" select="$sourcePath/DriveSpaceTrigger"/>
            <xsl:with-param name="defaultValue" select="-1"/>
          </xsl:call-template>

          <driveSpaceTrigger>
            <xsl:attribute name="unique_id">
              <xsl:value-of select="$MarketplaceNotificationDriveSpaceTriggerUniqueId"/>
            </xsl:attribute>

            <xsl:attribute name="minFreePercent">
              <xsl:value-of select="$sourcePath/DriveSpaceTrigger/MinFreePercent"/>
            </xsl:attribute>
          </driveSpaceTrigger>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="NotificationRepeatSettings">
            <xsl:with-param name="sourcePath" select="$sourcePath"/>
            <xsl:with-param name="defaultValue" select="-1"/>
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>

      <xsl:element name="dayOfWeekList">
        <xsl:for-each select="$sourcePath/DayOfTheWeekList/DayOfTheWeek | $sourcePath/DayOfTheWeekList/item">
          <xsl:call-template name="ToVectorItem">
            <xsl:with-param name="targetValue">
              <xsl:call-template name="DayOfTheWeek">
                <xsl:with-param name="dayOfTheWeek" select="current()"/>
              </xsl:call-template>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:for-each>
      </xsl:element>

      <xsl:element name="licenseStatusList">
        <xsl:for-each select="$sourcePath/LicenseStatusList/LicenseStatus | $sourcePath/LicenseStatusList/item">
          <xsl:call-template name="ToVectorItem">
            <xsl:with-param name="targetValue">
              <xsl:call-template name="LicenseStatus">
                <xsl:with-param name="licenseStatus" select="current()"/>
              </xsl:call-template>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:for-each>
      </xsl:element>

      <xsl:element name="licenseTypeList">
        <xsl:for-each select="$sourcePath/LicenseTypesList/LicenseType | $sourcePath/LicenseTypesList/item">
          <xsl:call-template name="ToVectorItem">
            <xsl:with-param name="targetValue">
              <xsl:call-template name="LicenseTypes">
                <xsl:with-param name="licenseType" select="current()"/>
              </xsl:call-template>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:for-each>
      </xsl:element>
    </notificationSchedule>
  </xsl:template>
  <!--/NotificationScheduleV2Settings-->  

  <!--OfferCompatibleOs-->
  <xsl:template name="OfferCompatibleOs">
    <xsl:param name="osType"/>
    <xsl:choose>
      <xsl:when test="$osType='Windows'">
        <xsl:value-of select="1"/>
      </xsl:when>
      <xsl:when test="$osType='Linux'">
        <xsl:value-of select="2"/>
      </xsl:when>
      <xsl:when test="$osType='Android'">
        <xsl:value-of select="3"/>
      </xsl:when>
      <xsl:when test="$osType='iOs'">
        <xsl:value-of select="4"/>
      </xsl:when>
      <xsl:when test="$osType='Osx'">
        <xsl:value-of select="5"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--/OfferCompatibleOs-->

  <!--DayOfTheWeek-->
  <xsl:template name="DayOfTheWeek">
    <xsl:param name="dayOfTheWeek"/>
    <xsl:choose>
      <xsl:when test="$dayOfTheWeek='Monday'">
        <xsl:value-of select="1"/>
      </xsl:when>
      <xsl:when test="$dayOfTheWeek='Tuesday'">
        <xsl:value-of select="2"/>
      </xsl:when>
      <xsl:when test="$dayOfTheWeek='Wednesday'">
        <xsl:value-of select="3"/>
      </xsl:when>
      <xsl:when test="$dayOfTheWeek='Thursday'">
        <xsl:value-of select="4"/>
      </xsl:when>
      <xsl:when test="$dayOfTheWeek='Friday'">
        <xsl:value-of select="5"/>
      </xsl:when>
      <xsl:when test="$dayOfTheWeek='Saturday'">
        <xsl:value-of select="6"/>
      </xsl:when>
      <xsl:when test="$dayOfTheWeek='Sunday'">
        <xsl:value-of select="7"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--/DayOfTheWeek-->

  <!--LicenseStatus-->
  <xsl:template name="LicenseStatus">
    <xsl:param name="licenseStatus"/>
    <xsl:choose>
      <xsl:when test="$licenseStatus='Blocked'">
        <xsl:value-of select="1"/>
      </xsl:when>
      <xsl:when test="$licenseStatus='Limited'">
        <xsl:value-of select="2"/>
      </xsl:when>
      <xsl:when test="$licenseStatus='Valid'">
        <xsl:value-of select="3"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--/LicenseStatus-->

  <!--LicenseTypes-->
  <xsl:template name="LicenseTypes">
    <xsl:param name="licenseType"/>
    <xsl:choose>
      <xsl:when test="$licenseType='Free'">
        <xsl:value-of select="1"/>
      </xsl:when>
      <xsl:when test="$licenseType='Commercial'">
        <xsl:value-of select="2"/>
      </xsl:when>
      <xsl:when test="$licenseType='Beta'">
        <xsl:value-of select="3"/>
      </xsl:when>
      <xsl:when test="$licenseType='Trial'">
        <xsl:value-of select="4"/>
      </xsl:when>
      <xsl:when test="$licenseType='Test'">
        <xsl:value-of select="5"/>
      </xsl:when>
      <xsl:when test="$licenseType='Oem'">
        <xsl:value-of select="6"/>
      </xsl:when>
      <xsl:when test="$licenseType='Subscription'">
        <xsl:value-of select="7"/>
      </xsl:when>
      <xsl:when test="$licenseType='SubscriptionLimit'">
        <xsl:value-of select="8"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="0"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!--/LicenseTypes-->

  <!--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-->

  <!--NotificationRepeatSettings-->
  <xsl:template name="NotificationRepeatSettings">
    <xsl:param name="sourcePath"/>
    <xsl:param name="defaultValue" select="0"/>
    <xsl:attribute name="repeatPeriodInHours">
      <xsl:call-template name="OptionalInt">
        <xsl:with-param name="sourcePath" select="$sourcePath/RepeatPeriodInHours"/>
        <xsl:with-param name="defaultValue" select="$defaultValue"/>
      </xsl:call-template>
    </xsl:attribute>
    <xsl:attribute name="maxRepeatCount">
      <xsl:call-template name="OptionalInt">
        <xsl:with-param name="sourcePath" select="$sourcePath/MaxRepeatCount"/>
        <xsl:with-param name="defaultValue" select="$defaultValue"/>
      </xsl:call-template>
    </xsl:attribute>
  </xsl:template>
  <!--/NotificationRepeatSettings-->

  <!--BooleanAsInt-->
  <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 = '1' or $lowerSourceValue = 'true') and $isNegative = false()) or (($lowerSourceValue = '0' 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>
  <!--/BooleanAsInt-->

  <!--OptionalBooleanAsInt-->
  <xsl:template name="OptionalBooleanAsInt">
    <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:if test="$sourcePath != ''"><!--i.e. when sourcePath exists and is not empty-->
      <xsl:attribute name="{$resultAttributeName}">
        <xsl:choose>
          <xsl:when test="(($lowerSourceValue = '1' or $lowerSourceValue = 'true') and $isNegative = false()) or (($lowerSourceValue = '0' 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:if>
  </xsl:template>
  <!--/OptionalBooleanAsInt-->

  <!--OptionalInt-->
  <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>
  <!--/OptionalInt-->

  <!--SetOptionalFieldInitializedFlag-->
  <xsl:template name="SetOptionalFieldInitializedFlag">
    <xsl:param name="sourcePath"/>
    <xsl:param name="fieldName"/>
    <xsl:attribute name="{concat($fieldName, '_initialized')}">
      <xsl:choose>
        <xsl:when test="$sourcePath != ''">
          <!--i.e. when sourcePath exists and is not empty-->
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="0"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--/SetOptionalFieldInitializedFlag-->

  <!--PrependPad-->
  <xsl:template name="PrependPad">
    <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="PrependPad">
          <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>
  <!--/PrependPad-->

  <!--ToVectorItem-->
  <xsl:template name="ToVectorItem">
    <xsl:param name="targetValue" select="current()"/>
    <xsl:variable name="itemNumber">
      <xsl:call-template name="PrependPad">
        <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_', $itemNumber)}">
      <xsl:value-of select="$targetValue"/>
    </xsl:attribute>
  </xsl:template>
  <!--/ToVectorItem-->

  <!--ToSimpleVector-->
  <xsl:template name="ToSimpleVector">
    <xsl:param name="sourcePath"/>
    <xsl:for-each select="$sourcePath">
      <xsl:call-template name="ToVectorItem">
      </xsl:call-template>
    </xsl:for-each>
  </xsl:template>
  <!--/ToSimpleVector-->

  <!--WindowShowModeAttribute-->
  <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>
  <!--/WindowShowModeAttribute-->

  <!--WindowDisplaySettings-->
  <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:attribute name="autoCloseTimeInSec">
        <xsl:call-template name="OptionalInt">
          <xsl:with-param name="sourcePath" select="$sourcePath/AutoCloseTimeInSec"/>
          <xsl:with-param name="defaultValue" select="0"/>
        </xsl:call-template>
      </xsl:attribute>
      <xsl:call-template name="BooleanAsInt">
        <xsl:with-param name="resultAttributeName" select="'autoClose'"/>
        <xsl:with-param name="sourcePath" select="$sourcePath/AutoClose"/>
      </xsl:call-template>
    </windowDisplaySettings>
  </xsl:template>
  <!--/WindowDisplaySettings-->

  <!--MessageBoxSettings-->
  <xsl:template name="MessageBoxSettings">
    <xsl:param name="sourcePath"/>
    <messageBoxSettings>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$MessageBoxSettingsUniqueId"/>
      </xsl:attribute>
      <xsl:attribute name="height">
        <xsl:value-of select="$sourcePath/WindowDisplaySettings/WindowHeigth"/>
      </xsl:attribute>
      <xsl:attribute name="width">
        <xsl:value-of select="$sourcePath/WindowDisplaySettings/WindowWidth"/>
      </xsl:attribute>
      <xsl:attribute name="contentUri">
        <xsl:value-of select="$sourcePath/ContentUri"/>
      </xsl:attribute>
      <xsl:call-template name="WindowDisplaySettings">
        <xsl:with-param name="sourcePath" select="$sourcePath/WindowDisplaySettings"/>
      </xsl:call-template>
    </messageBoxSettings>
  </xsl:template>
  <!--/MessageBoxSettings-->

  <!--CustomizableItem-->
  <xsl:template name="CustomizableItem">
    <xsl:param name="contentIdSourcePath" select="Id"/>
    <xsl:param name="disableShowContentSourcePath" select="DisableShowContent"/>
    <xsl:attribute name="contentId">
      <xsl:value-of select="$contentIdSourcePath"/>
    </xsl:attribute>
    <xsl:call-template name="BooleanAsInt">
      <xsl:with-param name="resultAttributeName" select="'disableShowContent'"/>
      <xsl:with-param name="sourcePath" select="$disableShowContentSourcePath"/>
    </xsl:call-template>
  </xsl:template>
  <!--/CustomizableItem-->

  <!--ipm::recommendation_display_settings-->
  <xsl:template name="RecommendationDisplaySettings">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="displaySettings">
      <xsl:choose>
        <xsl:when test="$sourcePath='Hidden'">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:when test="$sourcePath='NotificationCenter'">
          <xsl:value-of select="2"/>
        </xsl:when>
        <xsl:when test="$sourcePath='NotificationCenterAndMainPage'">
          <xsl:value-of select="3"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="0"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--/ipm::recommendation_display_settings-->

  <!--ipm::recommendation_type-->
  <xsl:template name="RecommendationType">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="recommendationType">
      <xsl:choose>
        <xsl:when test="$sourcePath='Embedded'">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:when test="$sourcePath='Custom'">
          <xsl:value-of select="2"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="0"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--/ipm::recommendation_type-->

  <!--ipm::RecommendationPromoPage-->
  <xsl:template name="RecommendationPromoPage">
    <xsl:param name="sourcePath"/>
    <promoPage>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RecommendationPromoPageUniqueId"/>
      </xsl:attribute>

      <xsl:attribute name="title">
        <xsl:value-of select="$sourcePath/Title"/>
      </xsl:attribute>

      <xsl:attribute name="subtitle">
        <xsl:value-of select="$sourcePath/Subtitle"/>
      </xsl:attribute>

      <xsl:attribute name="subtitleDescription">
        <xsl:value-of select="$sourcePath/SubtitleDescription"/>
      </xsl:attribute>

      <xsl:attribute name="description">
        <xsl:value-of select="$sourcePath/Description"/>
      </xsl:attribute>

      <xsl:attribute name="descriptionHtmlUri">
        <xsl:value-of select="$sourcePath/DescriptionHtmlUri"/>
      </xsl:attribute>

      <xsl:attribute name="imageUri">
        <xsl:value-of select="$sourcePath/ImageUri"/>
      </xsl:attribute>
    </promoPage>
  </xsl:template>
  <!--/ipm::RecommendationPromoPage-->

  <!--ipm::Recommendation-->
  <xsl:template name="RecommendationInfo">
    <xsl:param name="sourcePath"/>
    <recommendation>
      <xsl:attribute name="unique_id">
        <xsl:value-of select="$RecommendationUniqueId"/>
      </xsl:attribute>

      <xsl:attribute name="title">
        <xsl:value-of select="$sourcePath/Title"/>
      </xsl:attribute>

      <xsl:attribute name="subtitle">
        <xsl:value-of select="$sourcePath/Subtitle"/>
      </xsl:attribute>

      <xsl:attribute name="buttonName">
        <xsl:value-of select="$sourcePath/ButtonName"/>
      </xsl:attribute>

      <xsl:attribute name="buttonUri">
        <xsl:value-of select="$sourcePath/ButtonAction/ButtonUri"/>
      </xsl:attribute>

      <xsl:attribute name="buttonApplicationPageId">
        <xsl:value-of select="$sourcePath/ButtonAction/ApplicationPage"/>
      </xsl:attribute>

      <xsl:attribute name="priority">
        <xsl:call-template name="OptionalInt">
          <xsl:with-param name="sourcePath" select="$sourcePath/Priority"/>
          <xsl:with-param name="defaultValue" select="-1"/>
        </xsl:call-template>
      </xsl:attribute>

      <xsl:attribute name="iconUri">
        <xsl:value-of select="$sourcePath/IconUri"/>
      </xsl:attribute>

      <xsl:if test="$sourcePath/PromoPage">
        <xsl:call-template name="RecommendationPromoPage">
          <xsl:with-param name="sourcePath" select="$sourcePath/PromoPage" />
        </xsl:call-template>
      </xsl:if>
    </recommendation>
  </xsl:template>
  <!--/ipm::Recommendation-->

  <!--ipm::RecommendationCustomization-->
  <xsl:template match="/IpmContentCustomization[@Version='F68AA9B7-5069-41A7-A0E8-BE89C0175D7D']/RecommendationCustomization">
    <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="$RecommendationCustomizationUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:attribute name="recommendationId">
            <xsl:value-of select="RecommendationId"/>
          </xsl:attribute>

          <xsl:call-template name="RecommendationType">
            <xsl:with-param name="sourcePath" select="RecommendationType"/>
          </xsl:call-template>

          <xsl:call-template name="RecommendationDisplaySettings">
            <xsl:with-param name="sourcePath" select="DisplaySettings"/>
          </xsl:call-template>

          <xsl:if test="Recommendation">
            <xsl:call-template name="RecommendationInfo">
              <xsl:with-param name="sourcePath" select="Recommendation" />
            </xsl:call-template>
          </xsl:if>

        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/ipm::RecommendationCustomization-->

  <!--ipm::ExtendApplicationButtonSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='8D1CA0EC-DCC2-40A2-B40D-134307270EBF']/ExtendApplicationButtonSettings">
    <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="$ExtendApplicationButtonSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:attribute name="buttonId">
            <xsl:value-of select="ExtendButton/Id"/>
          </xsl:attribute>
          <xsl:attribute name="name">
            <xsl:value-of select="ExtendButton/ButtonName"/>
          </xsl:attribute>
          <xsl:attribute name="target">
            <xsl:value-of select="ExtendButton/CustomUri"/>
          </xsl:attribute>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/ipm::ExtendApplicationButtonSettings-->

  <!--ipm::RetailToSubscription-->
  <xsl:template match="/IpmContentCustomization[@Version='41A19383-1DF8-4397-BEB8-5BC9209D8B6B']/RetailToSubscription">  
    <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="$RetailToSubscriptionUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:attribute name="buttonUri">
            <xsl:value-of select="ButtonUri"/>
          </xsl:attribute>

          <xsl:if test="FirstRunWizard">
            <firstRunWizard>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$RetailToSubscriptionFirstRunWizardUniqueId"/>
              </xsl:attribute>
              <xsl:attribute name="title">
                <xsl:value-of select="FirstRunWizard/Title"/>
              </xsl:attribute>
              <xsl:attribute name="description">
                <xsl:value-of select="FirstRunWizard/Description"/>
              </xsl:attribute>
              <xsl:attribute name="acceptButtonName">
                <xsl:value-of select="FirstRunWizard/AcceptButtonName"/>
              </xsl:attribute>
              <xsl:attribute name="cancelButtonName">
                <xsl:value-of select="FirstRunWizard/CancelButtonName"/>
              </xsl:attribute>
            </firstRunWizard>
          </xsl:if>

          <xsl:if test="UserProfile">
            <userProfile>
              <xsl:attribute name="unique_id">
                <xsl:value-of select="$RetailToSubscriptionUserProfileUniqueId"/>
              </xsl:attribute>
              <xsl:attribute name="title">
                <xsl:value-of select="UserProfile/Title"/>
              </xsl:attribute>
              <xsl:attribute name="description">
                <xsl:value-of select="UserProfile/Description"/>
              </xsl:attribute>
              <xsl:attribute name="iconUri">
                <xsl:value-of select="UserProfile/IconUri"/>
              </xsl:attribute>
              <xsl:attribute name="acceptButtonName">
                <xsl:value-of select="UserProfile/AcceptButtonName"/>
              </xsl:attribute>
            </userProfile>
          </xsl:if>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/ipm::RetailToSubscription-->

  <!--ipm::FrwTrialOfferBlock-->
  <xsl:template name="FrwTrialOfferBlock">
    <xsl:param name="sourcePath"/>

    <xsl:attribute name="unique_id">
      <xsl:value-of select="$FrwTrialOfferBlockUniqueId"/>
    </xsl:attribute>

    <xsl:attribute name="behavior">
        <xsl:choose>
          <xsl:when test="$sourcePath/Behavior='Default'">
            <xsl:value-of select="0" />
          </xsl:when>
          <xsl:when test="$sourcePath/Behavior='Hidden'">
            <xsl:value-of select="1" />
          </xsl:when>
          <xsl:when test="$sourcePath/Behavior='Customize'">
            <xsl:value-of select="2" />
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="0" />
          </xsl:otherwise>
        </xsl:choose>
    </xsl:attribute>

    <xsl:call-template name="SetOptionalFieldInitializedFlag">
      <xsl:with-param name="sourcePath" select="$sourcePath/TierSettings"/>
      <xsl:with-param name="fieldName" select="'tierSettings'"/>
    </xsl:call-template>

    <xsl:if test="$sourcePath/TierSettings">
      <tierSettings>
        <xsl:attribute name="unique_id">
          <xsl:value-of select="$FrwTrialOfferTierSettingsUniqueId"/>
        </xsl:attribute>

        <xsl:attribute name="tierId">
          <xsl:value-of select="$sourcePath/TierSettings/TierId"/>
        </xsl:attribute>
        <xsl:attribute name="contentUri">
          <xsl:value-of select="$sourcePath/TierSettings/ContentUri"/>
        </xsl:attribute>
        <xsl:call-template name="BooleanAsInt">
          <xsl:with-param name="resultAttributeName" select="'isDefaultOffer'"/>
          <xsl:with-param name="sourcePath" select="$sourcePath/TierSettings/IsDefaultOffer"/>
        </xsl:call-template>
      </tierSettings>
    </xsl:if>
  </xsl:template>
  <!--/ipm::FrwTrialOfferBlock-->

  <!--ipm::FrwTrialOfferSettings-->
  <xsl:template match="/IpmContentCustomization[@Version='44322387-617E-45F9-93FA-16552A8BC619']/FrwTrialOfferSettings">
    <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="$FrwTrialOfferSettingsUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>
         
          <leftBlock>
            <xsl:call-template name="FrwTrialOfferBlock">
              <xsl:with-param name="sourcePath" select="LeftBlock"/>
            </xsl:call-template>
          </leftBlock>
          <rightBlock>
            <xsl:call-template name="FrwTrialOfferBlock">
              <xsl:with-param name="sourcePath" select="RightBlock"/>
            </xsl:call-template>
          </rightBlock>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/ipm::FrwTrialOfferSettings-->

<!--ipm::toast_data::substitution_type-->
  <xsl:template name="SubstitutionKindType">
    <xsl:param name="sourcePath"/>
    <xsl:attribute name="type">
      <xsl:choose>
        <xsl:when test="$sourcePath='OpenUrl'">
          <xsl:value-of select="0"/>
        </xsl:when>
        <xsl:when test="$sourcePath='LocalResource'">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:when test="$sourcePath='Substitution'">
          <xsl:value-of select="2"/>
        </xsl:when>
        <xsl:when test="$sourcePath='OpenApplicationPage'">
          <xsl:value-of select="3"/>
        </xsl:when>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>
  <!--/ipm::toast_data::substitution_type-->

  <!--ipm::ToastNotification-->
  <xsl:template match="/IpmContentCustomization[@Version='A223782E-865B-4AD2-815D-58E58FFA4C03']/ToastNotification">
    <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="$ToastNotificationUniqueId"/>
          </xsl:attribute>
          <xsl:call-template name="CustomizableItem"/>

          <xsl:attribute name="notificationXmlPath">
            <xsl:value-of select="NotificationXml"/>
          </xsl:attribute>

          <xsl:attribute name="dependentContentId">
            <xsl:value-of select="DependentContentId"/>
          </xsl:attribute>

          <xsl:call-template name="BooleanAsInt">
            <xsl:with-param name="resultAttributeName" select="'waitForGameModeExit'"/>
            <xsl:with-param name="sourcePath" select="WaitForGameModeExit"/>
          </xsl:call-template>

          <xsl:call-template name="SetOptionalFieldInitializedFlag">
            <xsl:with-param name="sourcePath" select="NotificationSchedule"/>
            <xsl:with-param name="fieldName" select="'notificationSchedule'"/>
          </xsl:call-template>

          <xsl:if test="NotificationSchedule">
            <xsl:call-template name="NotificationScheduleV2Settings">
              <xsl:with-param name="sourcePath" select="NotificationSchedule" />
            </xsl:call-template>
          </xsl:if>

          <substitutions>
            <xsl:for-each select="Substitutions/Substitution">
              <xsl:variable name="substitutionItemNumber">
                <xsl:call-template name="PrependPad">
                  <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_', $substitutionItemNumber)}">
                <xsl:attribute name="unique_id">
                  <xsl:value-of select="$SubstitutionUniqueId"/>
                </xsl:attribute>
                <xsl:attribute name="name">
                  <xsl:value-of select="Name"/>
                </xsl:attribute>
                <xsl:call-template name="SubstitutionKindType">
                  <xsl:with-param name="sourcePath" select="Type"/>
                </xsl:call-template>
                <xsl:attribute name="value">
                  <xsl:value-of select="Value"/>
                </xsl:attribute>
              </xsl:element>
            </xsl:for-each>
          </substitutions>
        </item_0000>
      </Items>
    </root>
  </xsl:template>
  <!--/ipm::ToastNotification-->
  
</xsl:stylesheet>