<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- handles purchase condition -->
<xsl:template name="PurchaseConditionTemplate" match="/">
<!-- Name of the template -->
<PurchaseCondition impl="com.ibm.commerce.marketing.promotion.condition.FreeGiftPurchaseCondition">
<!-- evaluate function of this java file will get callled for evaluation condition and adding reward -->
<BaseItemSelection>
<Quantity><xsl:value-of select="PromotionData/Elements/PurchaseCondition/Data/BaseItemQuantity" /></Quantity>
<!-- Value picked from command centre interface. quantity of Item required for promotion activation -->
<FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain">
<Filter impl="com.ibm.commerce.marketing.promotion.condition.MultiSKUFilter">
<!-- Filter that will evaluate if the promotions shoudl be applied or not -->
<xsl:for-each select="PromotionData/Elements/PurchaseCondition/IncludeCatalogEntryIdentifier">
<!-- Catalog items to be included for promotions -->
<IncludeCatEntryKey>
<xsl:call-template name="CatalogEntryKeyTemplate">
<xsl:with-param name="dn" select="Data/DN" />
<xsl:with-param name="sku" select="Data/SKU" />
</xsl:call-template>
</IncludeCatEntryKey>
</xsl:for-each>
<xsl:for-each select="PromotionData/Elements/PurchaseCondition/ExcludeCatalogEntryIdentifier">
<!-- Catalog items to be excluded for promotions to be activated -->
<ExcludeCatEntryKey>
<xsl:call-template name="CatalogEntryKeyTemplate">
<xsl:with-param name="dn" select="Data/DN" />
<xsl:with-param name="sku" select="Data/SKU" />
</xsl:call-template>
</ExcludeCatEntryKey>
</xsl:for-each>
</Filter>
</FilterChain>
</BaseItemSelection>
<GiftQuantity><xsl:value-of select="PromotionData/Elements/PurchaseCondition/Data/GiftQuantity" /></GiftQuantity>
<!-- Quantity of gift or Reward. -->
<Gift>
<xsl:call-template name="CatalogEntryKeyTemplate">
<!-- Gift or reward to be given in case condition is met. -->
<xsl:with-param name="dn" select="PromotionData/Elements/PurchaseCondition/GiftCatalogEntryIdentifier/Data/DN" />
<xsl:with-param name="sku" select="PromotionData/Elements/PurchaseCondition/GiftCatalogEntryIdentifier/Data/SKU" />
</xsl:call-template>
</Gift>
</PurchaseCondition>
</xsl:template>
</xsl:transform>