DECLARE @TaskNAme AS NVARCHAR(100) = 'Location Import'
;
DECLARE @TaskNameId AS BIGINT

 SELECT @TaskNameId = [TaskNameId] 
 FROM tbTaskName
  WHERE TaskName = @TaskNAme
 ;
 
 UPDATE [tbTaskDataImportXSLT] 
 SET  [XSLTScript] = '<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:svc="http://xmlns.chick-fil-a.com/services/locations/v2" xmlns:people="http://xmlns.chick-fil-a.com/enterprise/people/v2" xmlns:ns2="http://xmlns.chick-fil-a.com/enterprise/common/v3" xmlns:loc="http://xmlns.chick-fil-a.com/enterprise/location/v2" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:dist="http://xmlns.chick-fil-a.com/enterprise/distributor/v1" xmlns:common="http://xmlns.chick-fil-a.com/enterprise/common/v3" xmlns:cfa="http://www.cfa.com/service" version="1.0">
  <xsl:output method="xml" indent="yes" />
  <xsl:variable name="productattributes">,00070,00139,00238,00250,00440,00458,00495,00513,00530,00593,00636,00639,00640,00686,00701,00703,00803,00805,00808,00810,00814,00818,00819,00821,00831,00846,00916,00962,01141,01163,01169,01170,01208,01225,01262,01306,01374,01378,01873,01994,02021,02026,02052,02077,02110,02242,02345,02599,02679,02802,02913,02977,02981,02984,03049,03277,03351,03551,03822,03923,04006,04008,04234,70002,70004,70005,70007,70021,70041,70043,70044,70045,70049,70051,70052,00534,00757,00763,00802,00806,00807,01146,02212,03221,03302,03573,00005,00140,00245,00490,00497,00520,00600,00648,00683,00696,00718,00811,00813,00815,00829,00838,00840,00843,00844,00940,01082,01089,01222,01294,01386,01496,01577,01650,01815,01860,01982,02007,02111,02270,02319,02467,02748,02749,03179,03233,03265,03445,03796,03797,03935,04133,04285,04498,</xsl:variable>
  <xsl:template match="svc:Locations">
    <xsl:element name="Entities">
      <xsl:apply-templates select="loc:Location" />
    </xsl:element>
  </xsl:template>
  <xsl:template match="loc:Location">
    <xsl:if test="loc:LocationNumber != ''00000''">
      <xsl:if test="loc:ConceptCode != ''LIC''">
        <xsl:if test="substring(loc:LocationNumber,1,1)!=''8''">
          <xsl:element name="Entity">
            <xsl:element name="StoreNumber">
              <xsl:value-of select="loc:LocationNumber" />
            </xsl:element>
            <xsl:element name="StoreName">
              <xsl:value-of select="concat(loc:LocationNumber, '' - '', loc:Name)" />
            </xsl:element>
            <xsl:element name="StoreType">
              <xsl:value-of select="''Store''" />
            </xsl:element>
            <xsl:choose>
              <xsl:when test="@DeltaStatus = ''Deleted''">
                <xsl:element name="Status">
                  <xsl:value-of select="''Closed''" />
                </xsl:element>
              </xsl:when>
              <xsl:otherwise>
                <xsl:choose>
                  <xsl:when test="loc:Status = ''remodel'' or loc:Status = ''Remodel''">
                    <xsl:element name="Status">
                      <xsl:value-of select="''Open''" />
                    </xsl:element>
                    <xsl:element name="TempCloseDate">
                      <xsl:value-of select="''2000-01-01 00:00:00''" />
                    </xsl:element>
                    <xsl:element name="ReopenDate">
                      <xsl:value-of select="''3000-01-01 00:00:00''" />
                    </xsl:element>
                  </xsl:when>
                  <xsl:when test="loc:Status = ''Open''">
                    <xsl:element name="Status">
                      <xsl:value-of select="loc:Status" />
                    </xsl:element>
                    <xsl:element name="TempCloseDate">
                      <xsl:value-of select="''2000-01-01 00:00:00''" />
                    </xsl:element>
                    <xsl:element name="ReopenDate">
                      <xsl:value-of select="''2000-01-01 00:00:00''" />
                    </xsl:element>
                  </xsl:when>
                  <xsl:when test="loc:Status = ''Future''">
                    <xsl:element name="Status">
                      <xsl:value-of select="''Open''" />
                    </xsl:element>
                    <xsl:element name="TempCloseDate">
                      <xsl:value-of select="''2000-01-01 00:00:00''" />
                    </xsl:element>
                    <xsl:element name="ReopenDate">
                      <xsl:value-of select="''2000-01-01 00:00:00''" />
                    </xsl:element>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:element name="Status">
                      <xsl:value-of select="loc:Status" />
                    </xsl:element>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:element name="OpenDate">
              <xsl:choose>
                <xsl:when test="normalize-space(loc:OpenDate) != ''''">
                  <xsl:value-of select="loc:OpenDate" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="loc:ProjectedOpenDate" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="AddressLine1">
              <xsl:value-of select="loc:LocationContact/common:StreetAddress/common:Address1" />
            </xsl:element>
            <xsl:element name="AddressLine2">
              <xsl:value-of select="concat(loc:LocationContact/common:StreetAddress/common:Address2, '' '' , loc:LocationContact/common:StreetAddress/common:Address3)" />
            </xsl:element>
            <xsl:element name="City">
              <xsl:value-of select="loc:LocationContact/common:StreetAddress/common:City" />
            </xsl:element>
            <xsl:element name="State">
              <xsl:value-of select="loc:LocationContact/common:StreetAddress/common:State" />
            </xsl:element>
            <xsl:element name="PostCode">
              <xsl:choose>
                <xsl:when test="loc:ISOCountryCode = ''CA''">
                  <xsl:value-of select="loc:LocationContact/common:StreetAddress/common:ZipCode/common:Zip" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="concat(loc:LocationContact/common:StreetAddress/common:ZipCode/common:Zip, ''-'', loc:LocationContact/common:StreetAddress/common:ZipCode/common:ZipExtension)" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="IsoCountryCode">
              <xsl:value-of select="loc:ISOCountryCode" />
            </xsl:element>
            <xsl:element name="Country">
              <xsl:value-of select="loc:CountryName" />
            </xsl:element>
            <xsl:element name="Phone">
              <xsl:value-of select="concat(loc:LocationContact/common:DaytimePhone/common:AreaCode,''-'',loc:LocationContact/common:DaytimePhone/common:PhoneNumber)" />
            </xsl:element>
            <xsl:element name="ContactFirstName">
              <xsl:choose>
                <xsl:when test="normalize-space(people:Operator/people:Name) != ''''">
                  <xsl:value-of select="substring-before(people:Operator/people:Name,'' '')" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:if test="normalize-space(loc:OperatorSelect/people:Name) != ''''">
                    <xsl:value-of select="substring-before(loc:OperatorSelect/people:Name,'' '')" />
                  </xsl:if>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="ContactLastName">
              <xsl:choose>
                <xsl:when test="normalize-space(people:Operator/people:Name) != ''''">
                  <xsl:value-of select="substring-after(people:Operator/people:Name,'' '')" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:if test="normalize-space(loc:OperatorSelect/people:Name) != ''''">
                    <xsl:value-of select="substring-after(loc:OperatorSelect/people:Name,'' '')" />
                  </xsl:if>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="ContactPhone">
              <xsl:value-of select="concat(loc:LocationContact/common:DaytimePhone/common:AreaCode,''-'',loc:LocationContact/common:DaytimePhone/common:PhoneNumber)" />
            </xsl:element>
            <xsl:element name="ContactEmail">
              <xsl:value-of select="loc:LocationContact/common:EmailAddress" />
            </xsl:element>
            <xsl:element name="PostalAddressLine1">
              <xsl:value-of select="loc:LocationContact/common:BillingAddress/common:Address1" />
            </xsl:element>
            <xsl:element name="PostalAddressLine2">
              <xsl:value-of select="concat(loc:LocationContact/common:BillingAddress/common:Address2, '' '' , loc:LocationContact/common:BillingAddress/common:Address3)" />
            </xsl:element>
            <xsl:element name="PostalCity">
              <xsl:value-of select="loc:LocationContact/common:BillingAddress/common:City" />
            </xsl:element>
            <xsl:element name="PostalState">
              <xsl:value-of select="loc:LocationContact/common:BillingAddress/common:State" />
            </xsl:element>
            <xsl:element name="PostalPostCode">
              <xsl:choose>
                <xsl:when test="loc:ISOCountryCode = ''CA''">
                  <xsl:value-of select="concat(loc:LocationContact/common:BillingAddress/common:ZipCode/common:Zip, '' '', loc:LocationContact/common:BillingAddress/common:ZipCode/common:ZipExtension)" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="concat(loc:LocationContact/common:BillingAddress/common:ZipCode/common:Zip, ''-'', loc:LocationContact/common:BillingAddress/common:ZipCode/common:ZipExtension)" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="PostalCountry">
              <xsl:value-of select="loc:CountryName" />
            </xsl:element>
            <xsl:element name="TaxCode">
              <xsl:value-of select="''10% Local Tax''" />
            </xsl:element>
            <xsl:element name="TimeZone">
              <xsl:choose>
                <xsl:when test="loc:TimeZoneName = ''(GMT -04:00) Eastern Time (US &amp; Canada)'' or loc:TimeZoneName = ''(GMT -05:00) Eastern Time (US &amp; Canada)''">
                  <xsl:value-of select="''Eastern Standard Time''" />
                </xsl:when>
                <xsl:when test="loc:TimeZoneName = ''(GMT -05:00) Central Time (US &amp; Canada)'' or loc:TimeZoneName = ''(GMT -06:00) Central Time (US &amp; Canada)''">
                  <xsl:value-of select="''Central Standard Time''" />
                </xsl:when>
                <xsl:when test="loc:TimeZoneName = ''(GMT -07:00) Arizona''">
                  <xsl:value-of select="''US Mountain Standard Time''" />
                </xsl:when>
                <xsl:when test="loc:TimeZoneName = ''(GMT -06:00) Mountain Time (US &amp; Canada)'' or loc:TimeZoneName = ''(GMT -07:00) Mountain Time (US &amp; Canada)''">
                  <xsl:value-of select="''Mountain Standard Time''" />
                </xsl:when>
                <xsl:when test="loc:TimeZoneName = ''(GMT -07:00) Pacific Time (US &amp; Canada)'' or loc:TimeZoneName = ''(GMT -08:00) Pacific Time (US &amp; Canada)''">
                  <xsl:value-of select="''Pacific Standard Time''" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="''''" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="Latitude">
              <xsl:value-of select="loc:GPS/loc:Latitude" />
            </xsl:element>
            <xsl:element name="Longitude">
              <xsl:value-of select="loc:GPS/loc:Longitude" />
            </xsl:element>
            <xsl:element name="ReturnType">
              <xsl:value-of select="''Entered By Head Office''" />
            </xsl:element>
            <xsl:element name="Currency">
              <xsl:value-of select="''USD''" />
            </xsl:element>
            <xsl:element name="StoreClassification">
              <xsl:value-of select="loc:LocationCode" />
            </xsl:element>
			<xsl:element name="StoreSubType">
              <xsl:value-of select="loc:LocationSubtypeCode" />
            </xsl:element>
            <xsl:element name="Ownership">
              <xsl:value-of select="loc:ConceptCode" />
            </xsl:element>
            <xsl:element name="AreaManager">
              <xsl:value-of select="loc:OperatorTeam" />
            </xsl:element>
            <xsl:element name="OpenTime">
              <xsl:choose>
                <xsl:when test="loc:LocationCode = ''Mall'' or loc:LocationCode = ''MALL''">
                  <xsl:value-of select="''10:00''" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="''06:00''" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="CloseTime">
              <xsl:choose>
                <xsl:when test="loc:LocationCode = ''Mall'' or loc:LocationCode = ''MALL''">
                  <xsl:value-of select="''21:00''" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="''22:00''" />
                </xsl:otherwise>
              </xsl:choose>
            </xsl:element>
            <xsl:element name="PosSystem">
              <xsl:attribute name="ValidationDirective">
                <xsl:value-of select="''UpdatePollPos''" />
              </xsl:attribute>
              <xsl:value-of select="''RADIANT''" />
            </xsl:element>
            <xsl:element name="Contacts">
              <xsl:element name="Contact">
                <xsl:element name="FirstName">
                  <xsl:value-of select="substring-before(people:BusinessConsultant/people:Name,'' '')" />
                </xsl:element>
                <xsl:element name="LastName">
                  <xsl:value-of select="substring-after(people:BusinessConsultant/people:Name,'' '')" />
                </xsl:element>
              </xsl:element>
              <xsl:element name="Contact">
                <xsl:element name="FirstName">
                  <xsl:value-of select="substring-before(people:MarketingConsultant/people:Name,'' '')" />
                </xsl:element>
                <xsl:element name="LastName">
                  <xsl:value-of select="substring-after(people:MarketingConsultant/people:Name,'' '')" />
                </xsl:element>
              </xsl:element>
              <xsl:element name="Contact">
                <xsl:element name="FirstName">
                  <xsl:value-of select="substring-before(people:FinancialConsultant/people:Name,'' '')" />
                </xsl:element>
                <xsl:element name="LastName">
                  <xsl:value-of select="substring-after(people:FinancialConsultant/people:Name,'' '')" />
                </xsl:element>
              </xsl:element>
            </xsl:element>
            <xsl:choose>
              <xsl:when test="loc:Attributes/loc:Attribute/loc:Name = ''SSParticipation'' and loc:Attributes/loc:Attribute/loc:Value = ''false'' ">
                <xsl:element name="CashupSetting">
                  <xsl:value-of select="''CFA NonSmart Safe''" />
                </xsl:element>
                <xsl:element name="BankingSetting">
                  <xsl:value-of select="''CFA NonSmart Safe''" />
                </xsl:element>
                <xsl:element name="FloatCountSetting">
                  <xsl:value-of select="''CFA NonSmart Safe''" />
                </xsl:element>
                <xsl:element name="Zones">
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - ConceptCode''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:ConceptCode" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - LocationCode''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:LocationCode" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - OperatorTeamName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:OperatorTeamName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - ServiceTeamName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:ServiceTeamName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - RegionName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:RegionName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - MarketName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:MarketName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - CountryName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:CountryName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Transfer''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:CountryName" />
                    </xsl:element>
                  </xsl:element>
                </xsl:element>
              </xsl:when>
              <xsl:otherwise>
                <xsl:element name="CashupSetting">
                  <xsl:value-of select="''CFA Smart Safe''" />
                </xsl:element>
                <xsl:element name="BankingSetting">
                  <xsl:value-of select="''CFA Smart Safe''" />
                </xsl:element>
                <xsl:element name="FloatCountSetting">
                  <xsl:value-of select="''CFA Smart Safe''" />
                </xsl:element>
                <xsl:element name="Zones">
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Cash Rules''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="''SmartSafe Stores''" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - ConceptCode''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:ConceptCode" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - LocationCode''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:LocationCode" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - OperatorTeamName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:OperatorTeamName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - ServiceTeamName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:ServiceTeamName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - RegionName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:RegionName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - MarketName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:MarketName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - CountryName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:CountryName" />
                    </xsl:element>
                  </xsl:element>
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Transfer''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="loc:CountryName" />
                    </xsl:element>
                  </xsl:element>
                </xsl:element>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:choose>
              <xsl:when test="loc:ConceptCode = ''CFA''">
                <xsl:element name="Brands">
                  <xsl:element name="Brand">
                    <xsl:element name="Brand">
                      <xsl:value-of select="''CFA''" />
                    </xsl:element>
                  </xsl:element>
                </xsl:element>
              </xsl:when>
              <xsl:when test="loc:ConceptCode = ''DWH''">
                <xsl:element name="Brands">
                  <xsl:element name="Brand">
                    <xsl:element name="Brand">
                      <xsl:value-of select="''Dwarf House''" />
                    </xsl:element>
                  </xsl:element>
                </xsl:element>
              </xsl:when>
            </xsl:choose>
            <xsl:element name="Vendors">
              <xsl:for-each select="dist:Distributor">
                <xsl:element name="Vendor">
                  <xsl:element name="VendorName">
                    <xsl:value-of select="dist:Name" />
                  </xsl:element>
                  <xsl:element name="DistributionCenter">
                    <xsl:value-of select="dist:DistributionCenter" />
                  </xsl:element>
                </xsl:element>
              </xsl:for-each>
              <xsl:for-each select="loc:LocationNumber">
                <xsl:if test="contains(concat('','', $productattributes), concat('','', string(.), '',''))">
                  <xsl:element name="Vendor">
                    <xsl:element name="VendorName">
                      <xsl:value-of select="''PARISHABLES''" />
                    </xsl:element>
                    <xsl:element name="DistributionCenter">
                      <xsl:value-of select="''ATL''" />
                    </xsl:element>
                  </xsl:element>
                </xsl:if>
              </xsl:for-each>
            </xsl:element>
            <xsl:element name="VendorZones">
              <xsl:for-each select="dist:Distributor">
                <xsl:element name="Zone">
                  <xsl:element name="ZoneType">
                    <xsl:value-of select="''Location - DistributorName''" />
                  </xsl:element>
                  <xsl:element name="ZoneName">
                    <xsl:value-of select="dist:Name" />
                  </xsl:element>
                </xsl:element>
              </xsl:for-each>
              <xsl:for-each select="loc:LocationNumber">
                <xsl:if test="contains(concat('','', $productattributes), concat('','', string(.), '',''))">
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - DistributorName''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="''PARISHABLES''" />
                    </xsl:element>
                  </xsl:element>
                </xsl:if>
              </xsl:for-each>
            </xsl:element>
            <xsl:element name="DistributionCenterZones">
              <xsl:for-each select="dist:Distributor">
                <xsl:element name="Zone">
                  <xsl:element name="ZoneType">
                    <xsl:value-of select="''Location - DistributionCenter''" />
                  </xsl:element>
                  <xsl:element name="ZoneName">
                    <xsl:value-of select="dist:DistributionCenter" />
                  </xsl:element>
                </xsl:element>
              </xsl:for-each>
              <xsl:for-each select="loc:LocationNumber">
                <xsl:if test="contains(concat('','', $productattributes), concat('','', string(.), '',''))">
                  <xsl:element name="Zone">
                    <xsl:element name="ZoneType">
                      <xsl:value-of select="''Location - DistributionCenter''" />
                    </xsl:element>
                    <xsl:element name="ZoneName">
                      <xsl:value-of select="concat(''PARISHABLES'', '' - '', ''ATL'')" />
                    </xsl:element>
                  </xsl:element>
                </xsl:if>
              </xsl:for-each>
            </xsl:element>
          </xsl:element>
        </xsl:if>
      </xsl:if>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>'
 WHERE [TaskNameId] = @TaskNameId
 ;
 