<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) (Block Financial) -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:exsl="D:\Rohit\Downloads\exsl" extension-element-prefixes="exsl">
	<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
	<xsl:variable name="FMVdoc" select="document('DPNoncashDetails.xml')"/>
	<xsl:variable name="Namedoc" select="document('DPCategoryDescriptionChanges.xml')"/>
	<xsl:variable name="OPEdoc" select="document('DPOPE.xml')"/>
	<xsl:variable name="CompEvalMethod">Comparable Retail Value</xsl:variable>
	<xsl:variable name="NumberFormat">#########0.00</xsl:variable>
	<xsl:variable name="otherEvalMethod">Thrift Shop Value</xsl:variable>
	<xsl:variable name="newOther">Other</xsl:variable>
	<xsl:param name="tempParam"/>
	<xsl:template name="GetMileageAmount">
		<xsl:param name="origData"/>
		<xsl:for-each select="$OPEdoc/*">
			<xsl:variable name="NewMileList" select="//Mileage"/>
			<xsl:if test="$NewMileList">
				<xsl:variable name="perMile" select="$NewMileList[1]/@value"/>
				<xsl:value-of
					select="format-number(translate($origData/@miles,',','')*$perMile, $NumberFormat)"
				/>
			</xsl:if>
			<xsl:if test="not($NewMileList)">
				<xsl:value-of select="$origData/@amount"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetTotalMileageAmount">
		<xsl:param name="origData"/>
		<xsl:for-each select="$OPEdoc/*">
			<xsl:variable name="NewMileList" select="//Mileage"/>
			<xsl:if test="$NewMileList">
				<xsl:variable name="perMile" select="$NewMileList[1]/@value"/>
				<xsl:value-of
					select="format-number(translate($origData/@totalMiles,',','')*$perMile, $NumberFormat)"
				/>
			</xsl:if>
			<xsl:if test="not($NewMileList)">
				<xsl:value-of select="$origData/@amount"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetCatList">
		<xsl:param name="origData"/>
		<xsl:for-each select="$Namedoc/*">
			<xsl:variable name="NewCatList"
				select="Entry[@oldCategory=$origData/@category and @oldDescription=$origData/@description]"/>
			<xsl:if test="$NewCatList">
				<xsl:value-of select="$NewCatList[1]/@category"/>
			</xsl:if>
			<xsl:if test="not($NewCatList)">
				<xsl:variable name="ckOthers" select="$origData/@category"/>
				<xsl:variable name="NewOthers">Other-Unlisted Item</xsl:variable>
				<xsl:choose>
					<xsl:when test="$ckOthers= 'Others'">
						<xsl:value-of select="$NewOthers"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$origData/@category"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="GetCategory">
		<xsl:param name="origData"/>
		<xsl:for-each select="$Namedoc/*">
			<xsl:variable name="NewCatList"
				select="Entry[@oldCategory=$origData/@category and @oldDescription=$origData/@description]"/>
			<xsl:if test="$NewCatList">
				<xsl:if test="not(substring-after($NewCatList[1]/@category,'/'))">
					<xsl:value-of select="$NewCatList[1]/@category"/>
				</xsl:if>
				<xsl:if test="substring-after($NewCatList[1]/@category,'/')">
					<xsl:value-of select="substring-before($NewCatList[1]/@category,'/')"/>
				</xsl:if>
			</xsl:if>
			<xsl:if test="not($NewCatList)">
				<xsl:variable name="ckOthers" select="$origData/@category"/>
				<xsl:variable name="NewOthers">Other-Unlisted Item</xsl:variable>
				<xsl:choose>
					<xsl:when test="$ckOthers= 'Others'">
						<xsl:value-of select="$NewOthers"/>
					</xsl:when>
					<xsl:when test="$ckOthers= 'Other-Mixed Bag of Clothing'">
						<xsl:value-of select="$NewOthers"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$origData/@category"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- added 21 Apr start -->
	<xsl:template name="GetSubCategory">
		<xsl:param name="origData"/>
		<xsl:for-each select="$Namedoc/*">
			<xsl:variable name="NewCatList"
				select="Entry[@oldCategory=concat($origData/@category,'/',$origData/@subCategory) and @oldDescription=$origData/@description]"/>
			<xsl:if test="$NewCatList">
				<xsl:variable name="tempSubStr" select="$NewCatList/@subCat"/>
				<xsl:if test="$tempSubStr">
					<xsl:value-of select="$NewCatList/@subCat"/>
				</xsl:if>

			</xsl:if>
			<xsl:if test="not($NewCatList)">
				<xsl:variable name="ckOthers" select="$origData/@subCategory"/>
				<xsl:variable name="NewOthers">Other-Unlisted Item</xsl:variable>
				<xsl:choose>
					<xsl:when test="$ckOthers= 'Others'">
						<xsl:value-of select="$NewOthers"/>
					</xsl:when>
					<xsl:when test="$ckOthers= 'Other-Mixed Bag of Clothing'">
						<xsl:value-of select="$NewOthers"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$origData/@subCategory"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="GetSubSubCategory">
		<xsl:param name="origData"/>
		<xsl:for-each select="$Namedoc/*">
			<xsl:variable name="empty"/>
			<xsl:variable name="NewCatList"
				select="Entry[@oldCategory=concat($origData/@category,'/',$origData/@subCategory,'/',$origData/@subSubCategory) and @oldDescription=$origData/@description]"/>
			<xsl:if test="$NewCatList">
				<xsl:variable name="tempSubStr" select="$NewCatList/@subSubCat"/>
				<!--xsl:if test="$tempSubStr">
					<xsl:value-of select="$tempSubStr"/>
				</xsl:if-->
				<!-- 
					     added on 24 August 2006, Deduction Pro 2006 
					     exceptions to the generic code accounted here
					     Rashmi Kriplani,nexgenix
					     start
					-->
				<xsl:if
					test="$tempSubStr and ($tempSubStr ='TV/Stereo' or $tempSubStr ='Kitchen/Dining' or $tempSubStr ='Living/Office' or $tempSubStr ='Baseball/Softball' or $tempSubStr ='Cycles/Scooters' or $tempSubStr ='Ski/Snowboard')">
					<xsl:variable name="tempSubSubStr" select="$empty"/>
					<xsl:value-of select="$tempSubSubStr"/>
				</xsl:if>
				<xsl:if
					test="$tempSubStr and not($tempSubStr ='TV/Stereo' or $tempSubStr ='Kitchen/Dining' or $tempSubStr ='Living/Office' or $tempSubStr ='Baseball/Softball' or $tempSubStr ='Cycles/Scooters' or $tempSubStr ='Ski/Snowboard')">

					<xsl:variable name="tempSubSubStr" select="$tempSubStr"/>
					<xsl:value-of select="$tempSubSubStr"/>
				</xsl:if>
				<!-- 
					     end
					-->
			</xsl:if>
			<xsl:if test="not($NewCatList)">
				<xsl:variable name="ckOthers" select="$origData/@subSubCategory"/>
				<xsl:variable name="NewOthers">Other-Unlisted Item</xsl:variable>
				<xsl:choose>
					<xsl:when test="$ckOthers= 'Others'">
						<xsl:value-of select="$NewOthers"/>
					</xsl:when>
					<xsl:when test="$ckOthers= 'Other-Mixed Bag of Clothing'">
						<xsl:value-of select="$NewOthers"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$origData/@subSubCategory"/>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<!-- added 21 Apr start -->
	<xsl:template name="GetDescription">
		<xsl:param name="origData"/>
		<xsl:for-each select="$Namedoc/*">


			<!-- Fix for new description not getting reflected-->

			<xsl:choose>
				<xsl:when test="(string-length($origData/@subSubCategory) > 0)">
					<xsl:variable name="NewDescList"
						select="Entry[@oldCategory=concat($origData/@category,'/',$origData/@subCategory,'/',$origData/@subSubCategory) and @oldDescription=$origData/@description]"/>
					<xsl:if test="$NewDescList">
						<xsl:value-of select="$NewDescList[1]/@description"/>
					</xsl:if>
					<xsl:if test="not($NewDescList)">
						<xsl:value-of select="$origData/@description"/>
					</xsl:if>

				</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="(string-length($origData/@subCategory) > 0)">
							<xsl:variable name="NewDescList"
								select="Entry[@oldCategory=concat($origData/@category,'/',$origData/@subCategory) and @oldDescription=$origData/@description]"/>
							<xsl:if test="$NewDescList">
								<xsl:value-of select="$NewDescList[1]/@description"/>
							</xsl:if>
							<xsl:if test="not($NewDescList)">
								<xsl:value-of select="$origData/@description"/>
							</xsl:if>
						</xsl:when>
						<xsl:otherwise>
							<xsl:variable name="NewDescList"
								select="Entry[@oldCategory=$origData/@category and @oldDescription=$origData/@description]"/>

							<xsl:if test="$NewDescList">
								<xsl:value-of select="$NewDescList[1]/@description"/>
							</xsl:if>
							<xsl:if test="not($NewDescList)">
								<xsl:value-of select="$origData/@description"/>
							</xsl:if>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>

		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetQuality">
		<xsl:param name="origData"/>
		<xsl:variable name="newExcellent">Like New</xsl:variable>
		<xsl:variable name="newGood">Minor Wear</xsl:variable>
		<xsl:variable name="newAverage">Average Wear</xsl:variable>
		<xsl:variable name="newPoor">Heavy Wear</xsl:variable>
		<xsl:if test="$origData/@quality='Excellent'">
			<xsl:value-of select="$newExcellent"/>
		</xsl:if>
		<xsl:if test="$origData/@quality='Good'">
			<xsl:value-of select="$newGood"/>
		</xsl:if>
		<xsl:if test="$origData/@quality='Average'">
			<xsl:value-of select="$newAverage"/>
		</xsl:if>
		<xsl:if test="$origData/@quality='Poor'">
			<xsl:value-of select="$newPoor"/>
		</xsl:if>
		<xsl:if test="$origData/@quality='Like New'">
			<xsl:value-of select="$newExcellent"/>
		</xsl:if>
		<xsl:if test="$origData/@quality='Minor Wear'">
			<xsl:value-of select="$newGood"/>
		</xsl:if>
		<xsl:if test="$origData/@quality='Average Wear'">
			<xsl:value-of select="$newAverage"/>
		</xsl:if>
		<xsl:if test="$origData/@quality='Heavy Wear'">
			<xsl:value-of select="$newPoor"/>
		</xsl:if>
	</xsl:template>
	<xsl:template name="GetFMV">
		<xsl:param name="origData"/>
		<xsl:param name="category"/>
		<xsl:param name="subCategory"/>
		<xsl:param name="subSubCategory"/>
		<xsl:param name="description"/>
		<xsl:param name="quality"/>

		<xsl:for-each select="$FMVdoc/*">
			<xsl:variable name="ckCategory" select="$origData/@category"/>
			<xsl:choose>
				<xsl:when
					test="$ckCategory='Baby/Toddler Gear' or $ckCategory='Lawn/Garden' or $ckCategory='Music/Movies' or $ckCategory='Toys/Games'">
					<xsl:variable name="tempFMV0"
						select="$FMVdoc//Category[@name=$ckCategory]/Item[@desc=$description and @quality=$quality]"/>
					<xsl:if test="$tempFMV0">
						<xsl:value-of select="number(translate($tempFMV0[1]/@fmv,',',''))"/>
					</xsl:if>
					<xsl:if test="not($tempFMV0)">
						<xsl:value-of select="number(translate($origData/@fmv,',',''))"/>
					</xsl:if>
				</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="not($subCategory='') and not($subSubCategory='')">
							<xsl:variable name="tempFMV2"
								select="$FMVdoc//Category[@name=$category]/Category[@name=$subCategory]/Category[@name=$subSubCategory]/Item[@desc=$description and @quality=$quality]"/>
							<xsl:if test="$tempFMV2">
								<xsl:value-of select="number(translate($tempFMV2[1]/@fmv,',',''))"/>
							</xsl:if>
							<xsl:if test="not($tempFMV2)">
								<xsl:value-of select="number(translate($origData/@fmv,',',''))"/>
							</xsl:if>
						</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="not($subCategory='') and ($subSubCategory='')">
									<xsl:variable name="tempFMV2"
										select="$FMVdoc//Category[@name=$category]/Category[@name=$subCategory]/Item[@desc=$description and @quality=$quality]"/>
									<xsl:if test="$tempFMV2">
										<xsl:value-of
											select="number(translate($tempFMV2[1]/@fmv,',',''))"/>
									</xsl:if>
									<xsl:if test="not($tempFMV2)">
										<xsl:value-of
											select="number(translate($origData/@fmv,',',''))"/>
									</xsl:if>
								</xsl:when>
								<xsl:otherwise>
									<xsl:variable name="tempFMV2"
										select="$FMVdoc//Category[@name=$category]/Item[@desc=$description and @quality=$quality]"/>
									<xsl:if test="$tempFMV2">
										<xsl:value-of
											select="number(translate($tempFMV2[1]/@fmv,',',''))"/>
									</xsl:if>
									<xsl:if test="not($tempFMV2)">
										<xsl:value-of
											select="number(translate($origData/@fmv,',',''))"/>
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="GetAmount">
		<xsl:param name="userQuantity"/>
		<xsl:param name="userCategory"/>
		<xsl:param name="subSubCategory"/>
		<xsl:param name="userFMV"/>
		<xsl:variable name="subStrin1" select="Clothing"/>
		<xsl:choose>

			<!-- 
					     added on 24 August 2006, Deduction Pro 2006 
					     exceptions to the generic code accounted here
					     Rashmi Kriplani,nexgenix
					     start
					-->
			<xsl:when
				test="$userQuantity='' or $userCategory='Other-Unlisted Item' or $userCategory='Other-Mixed Bag of Clothing' or $userCategory='Baby/Toddler Gear' or $userCategory='Lawn/Garden' or $userCategory='Music/Movies' or $userCategory='Toys/Games'">
				<xsl:if
					test="$subSubCategory='' or $userCategory='Baby/Toddler Gear' or $userCategory='Lawn/Garden' or $userCategory='Music/Movies' or $userCategory='Toys/Games'">
					<xsl:value-of
						select="format-number(number(translate($userQuantity,',',''))*$userFMV, $NumberFormat)"
					/>
				</xsl:if>
				<xsl:if
					test="not($subSubCategory='') and not($userCategory='Baby/Toddler Gear' or $userCategory='Lawn/Garden' or $userCategory='Music/Movies' or $userCategory='Toys/Games')">
					<xsl:value-of select="format-number($userFMV, $NumberFormat)"/>
				</xsl:if>
			</xsl:when>
			<!-- 
					     end
					-->
			<xsl:otherwise>
				<xsl:value-of
					select="format-number(number(translate($userQuantity,',',''))*$userFMV, $NumberFormat)"
				/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="GetEvtFMV">
		<xsl:param name="nodes"/>
		<xsl:param name="totalSoFar"/>
		<xsl:choose>
			<xsl:when test="$nodes">
				<xsl:variable name="userData" select="$nodes[1]"/>
				<xsl:variable name="newCategory">
					<xsl:call-template name="GetCategory">
						<xsl:with-param name="origData" select="$userData"/>
					</xsl:call-template>
				</xsl:variable>
				<!-- added 21 apr start-->
				<xsl:variable name="newSubCategory">
					<xsl:call-template name="GetSubCategory">
						<xsl:with-param name="origData" select="$userData"/>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="newSubSubCategory">
					<xsl:call-template name="GetSubSubCategory">
						<xsl:with-param name="origData" select="$userData"/>
					</xsl:call-template>
				</xsl:variable>
				<!-- added 21 apr end-->
				<xsl:variable name="newDescription">
					<xsl:call-template name="GetDescription">
						<xsl:with-param name="origData" select="$userData"/>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="newQuality">
					<xsl:call-template name="GetQuality">
						<xsl:with-param name="origData" select="$userData"/>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="newFMV">
					<xsl:call-template name="GetFMV">
						<xsl:with-param name="origData" select="$userData"/>
						<xsl:with-param name="category" select="normalize-space($newCategory)"/>
						<xsl:with-param name="subCategory" select="normalize-space($newSubCategory)"/>
						<xsl:with-param name="subSubCategory"
							select="normalize-space($newSubSubCategory)"/>
						<xsl:with-param name="description" select="normalize-space($newDescription)"/>
						<xsl:with-param name="quality" select="normalize-space($newQuality)"/>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="newAmount">
					<xsl:call-template name="GetAmount">
						<xsl:with-param name="userQuantity" select="$userData/@quantity"/>
						<xsl:with-param name="userCategory" select="normalize-space($newCategory)"/>
						<xsl:with-param name="subSubCategory" select="$newSubSubCategory"/>
						<xsl:with-param name="userFMV" select="$newFMV"/>
					</xsl:call-template>
				</xsl:variable>
				<xsl:variable name="newTotal" select="$newAmount+$totalSoFar"/>
				<xsl:call-template name="GetEvtFMV">
					<xsl:with-param name="nodes" select="$nodes[position() &gt; 1]"/>
					<xsl:with-param name="totalSoFar" select="$newTotal"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="format-number($totalSoFar, $NumberFormat)"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="NonCash">
		<xsl:copy>
			<xsl:copy-of select="@*|node()[not(name(.)='Contribution')]"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="NonCash/Contribution">
		<xsl:copy>
			<xsl:copy-of select="@*|node()[not(name(.)='Event')]"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="NonCash/Contribution/Event">
		<xsl:variable name="start">0</xsl:variable>
		<xsl:variable name="incomplete">Incomplete Entry</xsl:variable>
		<xsl:variable name="costBasis" select="./@evtBasis"/>
		<xsl:variable name="sumEntryFMV">
			<xsl:call-template name="GetEvtFMV">
				<xsl:with-param name="nodes" select="./Entry"/>
				<xsl:with-param name="totalSoFar" select="$start"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:choose>
			<!-- 
					     added on 24 August 2006, Deduction Pro 2006 
					     over 500 cases accounted here
					     Rashmi Kriplani,nexgenix
					     start
					-->
			<xsl:when
				test="$sumEntryFMV&gt;500 and @evtDoacq='Not Necessary' and @evtHowacq='Not Necessary' and @evtBasis='Not Necessary'">
				<Event evtVarDt="{@evtVarDt}" evtPubTrd="{@evtPubTrd}" contribDate="{@contribDate}"
					evtCat="{@evtCat}" evtDesc="{@evtDesc}" evtFMV="{$sumEntryFMV}"
					evtDoacq="{$incomplete}" evtHowacq="{$incomplete}" evtBasis="{$incomplete}"
					evtEvalmethod="{@evtEvalmethod}" OPEmiles="{@OPEmiles}" ZX="{@ZX}">
					<xsl:apply-templates select="Entry" mode="regular"/>
				</Event>
			</xsl:when>
			<xsl:when
				test="$sumEntryFMV&gt;500 and $sumEntryFMV&gt;$costBasis and @evtDoacq='Various' and @evtVarDt='L' and not(@evtHowacq='Inheritance')">
				<Event evtVarDt="{@evtVarDt}" evtPubTrd="{@evtPubTrd}" contribDate="{@contribDate}"
					evtCat="{@evtCat}" evtDesc="{@evtDesc}" evtFMV="{@evtBasis}"
					evtDoacq="{@evtDoacq}" evtHowacq="{@evtHowacq}" evtBasis="{@evtBasis}"
					evtEvalmethod="{@evtEvalmethod}" OPEmiles="{@OPEmiles}" ZX="{@ZX}">
					<xsl:apply-templates select="Entry" mode="regular"/>
				</Event>
			</xsl:when>
			<xsl:when test="@evtCat='Bulk Donation'">
				<Event evtVarDt="{@evtVarDt}" evtPubTrd="{@evtPubTrd}" contribDate="{@contribDate}"
					evtCat="{@evtCat}" evtDesc="{@evtDesc}" evtFMV="{@evtFMV}"
					evtDoacq="{@evtDoacq}" evtHowacq="{@evtHowacq}" evtBasis="{@evtBasis}"
					evtEvalmethod="{@evtEvalmethod}" OPEmiles="{@OPEmiles}" ZX="{@ZX}">
					<xsl:apply-templates select="Entry" mode="regular"/>
				</Event>
			</xsl:when>
			<!-- 
					     end
					-->
			<xsl:otherwise>
				<Event evtVarDt="{@evtVarDt}" evtPubTrd="{@evtPubTrd}" contribDate="{@contribDate}"
					evtCat="{@evtCat}" evtDesc="{@evtDesc}" evtFMV="{$sumEntryFMV}"
					evtDoacq="{@evtDoacq}" evtHowacq="{@evtHowacq}" evtBasis="{@evtBasis}"
					evtEvalmethod="{@evtEvalmethod}" OPEmiles="{@OPEmiles}" ZX="{@ZX}">
					<xsl:apply-templates select="Entry" mode="regular"/>
				</Event>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="NonCash/Contribution/Event/Entry" mode="regular">
		<xsl:variable name="userData" select="."/>
		<xsl:variable name="newCatList">
			<xsl:call-template name="GetCatList">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="newCategory">
			<xsl:call-template name="GetCategory">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<!-- added 21 apr start-->
		<xsl:variable name="newSubCategory">
			<xsl:call-template name="GetSubCategory">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="newSubSubCategory">
			<xsl:call-template name="GetSubSubCategory">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<!-- added 21 apr end-->
		<xsl:variable name="newDescription">
			<xsl:call-template name="GetDescription">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="newQuality">
			<xsl:call-template name="GetQuality">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="newFMV">
			<xsl:call-template name="GetFMV">
				<xsl:with-param name="origData" select="$userData"/>
				<!-- 
					     added on 24 August 2006, Deduction Pro 2006 
					     trimmed out the left & rightspaces
					     Rashmi Kriplani,nexgenix
					     start
					-->
				<xsl:with-param name="category" select="normalize-space($newCategory)"/>
				<xsl:with-param name="subCategory" select="normalize-space($newSubCategory)"/>
				<xsl:with-param name="subSubCategory" select="normalize-space($newSubSubCategory)"/>
				<xsl:with-param name="description" select="normalize-space($newDescription)"/>
				<!-- 
					     end
					-->
				<xsl:with-param name="quality" select="$newQuality"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="newAmount">
			<xsl:call-template name="GetAmount">
				<xsl:with-param name="userQuantity" select="@quantity"/>
				<xsl:with-param name="userCategory" select="@category"/>
				<xsl:with-param name="subSubCategory" select="normalize-space($newSubSubCategory)"/>
				<xsl:with-param name="userFMV" select="$newFMV"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="ckCategory" select="$userData/@category"/>
		<xsl:variable name="empty"/>
		<xsl:choose>
			<!-- 
					     added on 24 August 2006, Deduction Pro 2006 
					     exceptions to the generic code accounted here
					     Rashmi Kriplani,nexgenix
					     start
					-->
			<xsl:when
				test="$ckCategory='Tools' or $ckCategory='Baby/Toddler Gear' or $ckCategory='Lawn/Garden' or $ckCategory='Music/Movies' or $ckCategory='Toys/Games'">
				<Entry category="{normalize-space($newCatList)}" subCategory="{$empty}"
					subSubCategory="{$empty}" description="{normalize-space($newDescription)}"
					quality="{$newQuality}" quantity="{@quantity}" fmv="{$newAmount}"
					amount="{$newAmount}" doacq="{@doacq}" howacq="{@howacq}" basis="{@basis}"
					evalMethod="{@evalMethod}" defaultContribAmt="{@defaultContribAmt}"
					pubTraded="{@pubTraded}" override="{@override}" ZX="{@ZX}"/>
			</xsl:when>

			<xsl:when
				test="$ckCategory='Other' or $ckCategory='Art/Collectibles' or @subCategory='Other'">
				<Entry category="{normalize-space($newCategory)}"
					subCategory="{normalize-space($newSubCategory)}"
					subSubCategory="{normalize-space($newSubSubCategory)}"
					description="{normalize-space($newDescription)}" quality="{$newQuality}"
					quantity="{@quantity}" fmv="{$newFMV}" amount="{$newFMV}" doacq="{@doacq}"
					howacq="{@howacq}" basis="{@basis}" evalMethod="{@evalMethod}"
					defaultContribAmt="{@defaultContribAmt}" pubTraded="{@pubTraded}"
					override="{@override}" ZX="{@ZX}"/>
			</xsl:when>

			<xsl:when test="$ckCategory='Bulk Donation'">
				<Entry category="{normalize-space($newCategory)}"
					subCategory="{normalize-space($newSubCategory)}"
					subSubCategory="{normalize-space($newSubSubCategory)}"
					description="{normalize-space($newDescription)}" quality="{$newQuality}"
					quantity="{@quantity}" fmv="{@amount}" amount="{@amount}" doacq="{@doacq}"
					howacq="{@howacq}" basis="{@basis}" evalMethod="{@evalMethod}"
					defaultContribAmt="{@defaultContribAmt}" pubTraded="{@pubTraded}"
					override="{@override}" ZX="{@ZX}"/>
			</xsl:when>


			<!-- xsl:when test="$ckCategory='Other-Unlisted Item'">
				<Entry category="{$newOther}" subCategory="{$empty}" subSubCategory="{$empty}"  description="{normalize-space($newDescription)}" quality="{$newQuality}" quantity="1" fmv="{$newAmount}" amount="{$newAmount}" doacq="{@doacq}" howacq="{@howacq}" basis="{@basis}" evalMethod="{$otherEvalMethod}" defaultContribAmt="{@defaultContribAmt}" pubTraded="{@pubTraded}" override="{@override}" ZX="{@ZX}"/>
			</xsl:when>
			<xsl:when test="$ckCategory='Other-Mixed Bag of Clothing'">
				<Entry category="{$newOther}" subCategory="{$empty}" subSubCategory="{$empty}"  description="{normalize-space($newDescription)}" quality="{$newQuality}" quantity="1" fmv="{$newAmount}" amount="{$newAmount}" doacq="{@doacq}" howacq="{@howacq}" basis="{@basis}" evalMethod="{$otherEvalMethod}" defaultContribAmt="{@defaultContribAmt}" pubTraded="{@pubTraded}" override="{@override}" ZX="{@ZX}"/>
			</xsl:when -->
			<!-- 
					     end
					-->
			<xsl:otherwise>
				<Entry category="{normalize-space($newCategory)}"
					subCategory="{normalize-space($newSubCategory)}"
					subSubCategory="{normalize-space($newSubSubCategory)}"
					description="{normalize-space($newDescription)}" quality="{$newQuality}"
					quantity="{@quantity}" fmv="{$newAmount}" amount="{$newAmount}" doacq="{@doacq}"
					howacq="{@howacq}" basis="{@basis}" evalMethod="{@evalMethod}"
					defaultContribAmt="{@defaultContribAmt}" pubTraded="{@pubTraded}"
					override="{@override}" ZX="{@ZX}"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="OPE">
		<xsl:copy>
			<xsl:copy-of select="@*|node()[not(name(.)='Contribution')]"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="OPE/Contribution">
		<xsl:copy>
			<xsl:copy-of select="@*|node()[not(name(.)='Event') and not(name(.)='RecurringEvent')]"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="OPE/Contribution/Event">
		<xsl:copy>
			<xsl:copy-of select="@*|node()[not(name(.)='Entry')]"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="OPE/Contribution/Event/Entry">
		<xsl:variable name="userData" select="."/>
		<xsl:variable name="newMileageAmount">
			<xsl:call-template name="GetMileageAmount">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<Entry override="{@override}" ZX="{@ZX}" expenses="{@expenses}"
			amount="{format-number($newMileageAmount, $NumberFormat)}" miles="{@miles}"
			opeType="Mileage" description="{@description}"/>
	</xsl:template>
	<xsl:template match="OPE/Contribution/RecurringEvent">
		<xsl:variable name="userData" select="."/>
		<xsl:variable name="newMileageAmount">
			<xsl:call-template name="GetTotalMileageAmount">
				<xsl:with-param name="origData" select="$userData"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="tempExpenses" select="@expenses"/>
		<xsl:variable name="tempTotalMiles" select="@totalMiles"/>
		<xsl:variable name="tempMiles" select="@miles"/>
		<xsl:variable name="frequencyCount" select="($tempTotalMiles div $tempMiles)"/>
		<xsl:variable name="newTotalRecuringAmount"
			select="$tempExpenses*$frequencyCount+ $newMileageAmount"/>

		<xsl:if test="$newMileageAmount=0">
			<RecurringEvent ZX="{@ZX}" totalAmount="{@totalAmount}" expenses="{@expenses}"
				amount="{format-number($newMileageAmount, $NumberFormat)}"
				totalMiles="{@totalMiles}" miles="{@miles}" opeType="Mileage"
				description="{@description}" frequency="{@frequency}" endDate="{@endDate}"
				startDate="{@startDate}"/>
		</xsl:if>
		<xsl:if test="$newMileageAmount!=0">
			<RecurringEvent ZX="{@ZX}"
				totalAmount="{format-number($newTotalRecuringAmount, $NumberFormat)}"
				expenses="{@expenses}" amount="{format-number($newMileageAmount, $NumberFormat)}"
				totalMiles="{@totalMiles}" miles="{@miles}" opeType="Mileage"
				description="{@description}" frequency="{@frequency}" endDate="{@endDate}"
				startDate="{@startDate}"/>
		</xsl:if>

	</xsl:template>
	<xsl:template match="UsrAcc/Year">
		<xsl:copy>
			<xsl:copy-of select="@*|node()[not(name(.)='OPE' or name(.)='NonCash')]"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="UsrAcc">
		<xsl:copy>
			<xsl:copy-of select="@*|node()[not (name(.)='Year')]"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>