Link to home
Start Free TrialLog in
Avatar of ISBTECH
ISBTECHFlag for United States of America

asked on

junk characters showing up in a text file created by an XSLT app

Good Morning experts,

I'm new to XSLT and working on fixing an issue with an existing application writen by ex employee that is no longer availiable to comunicate with.  The program works correctly with one execption.  It accesses data and creates an export text file for upload to an old loan servicing system which requires a text file in either .csv or .dat format.  The data is correctly appended together in the correct format and the file extention works fine but whenever I open the file in the upload interface it shows three junk characters at the start of the file.  The same characters every time, a lower case i with two dots rather than one, then two > chacaters close together then an upside down ? then the expected data. These do not show up when I open the file in excel or notpad + or notepad, or wordpad etc.  These same items appear weather I create the text file as .dat or .csv.  If I open them in any text editor and then save the file they still appear in the upload interface but if I open the text file in excel and save it they go away.  Any ideas anyone?
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

well, show us the XSLT I would suggest,
it could be an encoding issue,
it could be some binary junk
Excell and Wordpad are taught to ignore some of the things they don't recognize,
that is why the rubbish does not show up there,
it doesn't mean it isn't there anymore
Avatar of ISBTECH

ASKER

Ok here you go.

<?xml version="1.0" encoding="utf-8"?>
<!--Version - 3-5-09-->
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ms="urn:schemas-microsoft-com:xslt"
                xmlns:ISS="urn:my-scripts"
                exclude-result-prefixes="ms ISS">
  <xsl:output method="xml"/>

  <xsl:template name="ProcessML">
    <xsl:text>627,A,MR,</xsl:text>
    <xsl:value-of select="$customloanmain/loanservicingnumber"/>
    <xsl:if test ="string-length(//product_main/productcode) &gt; 0">
      <xsl:text>{0}</xsl:text>
      <xsl:value-of select="substring(//product_main/productcode, 1, 3)"/>
    </xsl:if>
    <xsl:if test ="string-length($cifentity[entityid=$b1eid]/taxidnumber) &gt; 0">
      <xsl:text>{300}</xsl:text>
      <xsl:value-of select="concat(substring($cifentity[entityid=$b1eid]/taxidnumber, 1, 3),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 5, 2),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 8, 4))"/>
    </xsl:if>
    <xsl:if test ="string-length(//product_main/productcode) &gt; 0">
      <xsl:text>{281}</xsl:text>
      <xsl:value-of select="substring(//product_main/productcode, 1, 3)"/>
    </xsl:if>
    <xsl:text>{89}</xsl:text>
    <xsl:value-of select="substring(concat($cifentity[entityid=$b1eid]/lastname,
                         ' ', $cifentity[entityid=$b1eid]/firstname), 1, 15)"/>
    
    <xsl:text>{7}083</xsl:text>
     
    <xsl:text>{43}</xsl:text>
    <xsl:value-of select="format-number($loanmain/amortizingnumberofpayments, '###')"/>
    <xsl:text>{9}</xsl:text>
    <xsl:value-of select="format-number($loanmain/numberofpayments, '###')"/>
    <xsl:text>{10}</xsl:text>
    <xsl:choose>
      <xsl:when test="$biweeklyflag">
        <xsl:text>X</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>1</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:text>{11}</xsl:text>
    <xsl:value-of select="format-number($loanmain/loanrate * 1000, '#####')"/>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:choose>
        <xsl:when test="./subjectpropertyflag = 1">
          <xsl:text>{12}</xsl:text>
          <xsl:value-of select="format-number(../cif_property[propertyid=$prid]/presentvalue, '#########')"/>
          <xsl:choose>
            <xsl:when test="not($refinanceflag)">
              <xsl:text>{13}</xsl:text>
              <xsl:value-of select="format-number(../cif_property[propertyid=$prid]/salesprice, '#########')"/>
            </xsl:when>
          </xsl:choose>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:text>{14}</xsl:text>
    <xsl:value-of select="format-number($loanmain/loanamount, '#########')"/>
    <xsl:text>{17}</xsl:text>
    <xsl:value-of select="ISS:FormatDate($loanmain/actualclosingdate)"/>
    <xsl:text>{19}</xsl:text>
    <xsl:value-of select="ISS:FormatDate($loanmain/dateoffirstpayment)"/>
    <xsl:choose>
      <xsl:when test="$loanmain/proposedtotal">
        <xsl:variable name="proposedpipmt" select="$loanmain/proposedpipayment"/>
        <xsl:variable name="proposedretaxes">
          <xsl:choose>
            <xsl:when test="//loan_huditem[hudnumber='1003']/escrowswaived='1' or
									//loan_huditem[hudnumber='1004']/escrowswaived='1' or
									$loanmain/escrowswaived='1'">
              <xsl:text>0.00</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$loanmain/proposedrealestatetaxes"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:variable name="proposedhazins">
          <xsl:choose>
            <xsl:when test="//loan_huditem[hudnumber='1001']/escrowswaived='1' or $loanmain/escrowswaived='1'">
              <xsl:text>0.00</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$loanmain/proposedhazardinsurance"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:variable name="proposedmi">
          <xsl:choose>
            <xsl:when test="//loan_huditem[hudnumber='1002']/escrowswaived='1' or $loanmain/escrowswaived='1'">
              <xsl:text>0.00</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$loanmain/proposedmortgageinsurance"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:variable name="proposedassdues">
          <xsl:choose>
            <xsl:when test="//loan_huditem[hudnumber='1005']/escrowswaived='1' or $loanmain/escrowswaived='1'">
              <xsl:text>0.00</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$loanmain/proposedassociationdues"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:variable name="proposedother">
          <xsl:choose>
            <xsl:when test="$loanmain/escrowswaived='1'">
              <xsl:text>0.00</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$loanmain/proposedothertotal" />
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:text>{21}</xsl:text>
        <xsl:value-of select="format-number((number($proposedpipmt) +
                      											 number($proposedretaxes) +
                      											 number($proposedhazins) +
                      											 number($proposedmi) +
                      											 number($proposedassdues) +
                      											 number($proposedother)) * 100, '#########')"/>
        <xsl:text>{22}</xsl:text>
        <xsl:value-of select="format-number(number($proposedpipmt) * 100, '#########')"/>
        <xsl:if test ="(number($proposedretaxes) +
                      											 number($proposedhazins) +
                      											 number($proposedmi) +
                      											 number($proposedassdues) +
                      											 number($proposedother)) &gt; 0">
          <xsl:text>{23}</xsl:text>
          <xsl:value-of select="format-number((number($proposedretaxes) +
                      											 number($proposedhazins) +
                      											 number($proposedmi) +
                      											 number($proposedassdues) +
                      											 number($proposedother)) * 100, '#########')"/>
        </xsl:if>
        <xsl:if test ="$proposedretaxes &gt; 0">
          <xsl:text>{26}</xsl:text>
          <xsl:value-of select="format-number(number($proposedretaxes) * 100, '#########')"/>
        </xsl:if>  
        <xsl:if test="$fhaflag and ($proposedmi &gt; 0)" >
          <xsl:text>{29}</xsl:text>
          <xsl:value-of select="format-number(number($proposedmi) * 100, '#########')"/>
        </xsl:if>
        <xsl:if test ="$proposedhazins &gt; 0">
          <xsl:text>{28}</xsl:text>
          <xsl:value-of select="format-number(number($proposedhazins) * 100, '#########')"/>
        </xsl:if>
      </xsl:when>
    </xsl:choose>
    <xsl:if test="$loanmain/latechargeflag = 1">
      <xsl:choose>
        <xsl:when test="$loanmain/latechargepercent">
          <xsl:text>{62}</xsl:text>
          <xsl:value-of select="format-number($loanmain/latechargepercent, '00')"/>
        </xsl:when>
      </xsl:choose>
    </xsl:if>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
      <xsl:choose>
        <xsl:when test="./subjectpropertyflag = 1">
          <xsl:text>{80}</xsl:text>
          <xsl:value-of select="format-number(number(../cif_property[propertyid=$prid]/fipsstatecode), '000')"/>
          <xsl:text>{5003}</xsl:text>
          <xsl:value-of select="format-number(number(../cif_property[propertyid=$prid]/fipscountycode), '000')"/>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:if test ="string-length($cifentity[entityid=$b1eid]/taxidnumber) &gt; 0">
      <xsl:text>{90}</xsl:text>
      <xsl:value-of select="concat(substring($cifentity[entityid=$b1eid]/taxidnumber, 1, 3),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 5, 2),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 8, 4))"/>
    </xsl:if>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
      <xsl:choose>
        <xsl:when test="./subjectpropertyflag = 1">
          <xsl:text>{114}</xsl:text>
          <xsl:choose>
            <xsl:when test="$propediid = '01'">01</xsl:when>
            <xsl:when test="$propediid = '02'">71</xsl:when>
            <xsl:when test="$propediid = '03'">66</xsl:when>
            <xsl:when test="$propediid = '04'">18</xsl:when>
            <xsl:when test="$propediid = '05'">16</xsl:when>
            <xsl:when test="$propediid = '06'">12</xsl:when>
            <xsl:when test="$propediid = '07'">85</xsl:when>
            <xsl:when test="$propediid = '08'">15</xsl:when>
            <xsl:when test="$propediid = '09'">19</xsl:when>
            <xsl:when test="$propediid = '10'">11</xsl:when>
            <xsl:when test="$propediid = '11'">11</xsl:when>
            <xsl:when test="$propediid = '13'">06</xsl:when>
            <xsl:when test="$propediid = '14'">11</xsl:when>
            <xsl:when test="$propediid = '15'">23</xsl:when>
            <xsl:when test="$propediid = '16'">17</xsl:when>
            <xsl:when test="$propediid = '17'">18</xsl:when>
            <xsl:when test="$propediid = '18'">51</xsl:when>
            <xsl:when test="$propediid = '19'">23</xsl:when>
            <xsl:otherwise>11</xsl:otherwise>
          </xsl:choose>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:text>{115}</xsl:text>
    <xsl:choose>
      <xsl:when test="$purchaseflag">01</xsl:when>
      <xsl:when test="$loanmain/purposeedicodeid = '03'">03</xsl:when>
      <xsl:when test="$loanmain/purposeedicodeid = '04'">11</xsl:when>
      <xsl:when test="$refinanceflag">02</xsl:when>
      <xsl:when test="$loanmain/purposeedicodeid = '12'">02</xsl:when>
      <xsl:when test="$loanmain/purposeedicodeid = '13'">11</xsl:when>
      <xsl:when test="$loanmain/purposeedicodeid = '15'">15</xsl:when>
      <xsl:when test="$loanmain/purposeedicodeid = '18'">11</xsl:when>
      <xsl:when test="$loanmain/purposeedicodeid = '20'">05</xsl:when>
      <xsl:otherwise>01</xsl:otherwise>
    </xsl:choose>
    <xsl:text>{119}1</xsl:text>
    <xsl:text>{123}10</xsl:text>
    <xsl:if test="ISS:FormatDate($customloanmain/appraisaldate)">
      <xsl:text>{143}</xsl:text>
      <xsl:value-of select="ISS:FormatDate($customloanmain/appraisaldate)"/>
    </xsl:if>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
      <xsl:choose>
        <xsl:when test="./subjectpropertyflag = 1">
          <xsl:text>{5004}</xsl:text>
          <xsl:value-of select="format-number(number(../cif_property[propertyid=$prid]/censustract*100), '000000')"/>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:text>{261}</xsl:text>
    <xsl:choose>
      <xsl:when test="$armflag">
        <xsl:text>1</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>0</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:text>{274}</xsl:text>
    <xsl:value-of select="ISS:FormatDate($loanmain/dateofmaturity)"/>
    <xsl:text>{265}</xsl:text>
    <xsl:value-of select="$loanmain/lienposition"/>
    <xsl:text>{319}</xsl:text>
    <xsl:value-of select="ISS:FormatDate($loanmain/dateoffirstpayment)"/>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
      <xsl:choose>
        <xsl:when test="./subjectpropertyflag = 1">
          <xsl:text>{5002}</xsl:text>
          <xsl:value-of select="format-number(number(../cif_property[propertyid=$prid]/msacode), '#####')"/>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:text>{320}</xsl:text>
    <xsl:value-of select="format-number($loanmain/loanrate * 1000, '#####')"/>
    <xsl:text>{5000}</xsl:text>
    <xsl:value-of select="ISS:FormatDate4($loanmain/applicationdate)"/>
    <xsl:text>{325}</xsl:text>
    <xsl:choose>
      <xsl:when test="$purchaseflag">Y</xsl:when>
      <xsl:otherwise>N</xsl:otherwise>
    </xsl:choose>
    <xsl:variable name ="dtid" select ="$loanmain/doctypeid"/>
    <xsl:if test ="$loanmain/totalincome &gt; 0">
    <xsl:text>{5005}</xsl:text>
    <xsl:value-of select="format-number($loanmain/totalincome, '#########')"/>
    </xsl:if>  
    <xsl:if test="not($fhaflag) and not($vaflag)">
      <xsl:text>{351}</xsl:text>
      <xsl:choose>
        <xsl:when test="$loanmain/proposedmortgageinsurance &gt; 0">
          <xsl:text>2</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>1</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
      <xsl:choose>
        <xsl:when test="./subjectpropertyflag = 1">
          <xsl:if test ="(../cif_property[propertyid=$prid]/yearbuilt) &gt; 0">
            <xsl:text>{5022}</xsl:text>
            <xsl:value-of select="format-number(number(../cif_property[propertyid=$prid]/yearbuilt), '####')"/>
          </xsl:if>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:text>{5006}1</xsl:text>
    <xsl:text>{358}*</xsl:text>
    <xsl:text>{364}N</xsl:text>
    <xsl:text>{5033}</xsl:text>
    <xsl:value-of select="format-number($loanmain/calculatedapr * 1000, '####')"/>
    <xsl:if test ="$loanmain/loanlocked = 1">
      <xsl:text>{5032}</xsl:text>
      <xsl:value-of select="ISS:FormatDate($loanmain/lockindate)"/>
    </xsl:if>
    <xsl:text>{380}</xsl:text>
    <xsl:variable name ="retaxes" select="(number(//loan_huditem[loanrecordid=$loanmain/loanrecordid][hudnumber=801]/amount) +
                                           number(//loan_huditem[loanrecordid=$loanmain/loanrecordid][hudnumber=802]/amount)) * 100"/>
    <xsl:choose>
      <xsl:when test ="$retaxes &gt; 0">
        <xsl:value-of select ="format-number((number(//loan_huditem[loanrecordid=$loanmain/loanrecordid][hudnumber=801]/amount) +
                                          number(//loan_huditem[loanrecordid=$loanmain/loanrecordid][hudnumber=802]/amount)) * 100, '#########')"/>
      </xsl:when>
      <xsl:otherwise>00</xsl:otherwise>
    </xsl:choose>
    <xsl:text>{345}N</xsl:text>
    <xsl:text>{5001}3</xsl:text>
    <xsl:text>{5008}2</xsl:text>
    <xsl:if test="$cifentity[entityid=$b1eid]/ethnicityhispanic > '0'" >
      <xsl:text>{5009}</xsl:text>
      <xsl:value-of select="$cifentity[entityid=$b1eid]/ethnicityhispanic"/>
    </xsl:if>
    <xsl:variable name="v1" select="ISS:resetcounter()"/>
    <xsl:if test="$cifentity[entityid=$b1eid]/raceasian = '1'" >
      <xsl:text>{</xsl:text>
      <xsl:value-of select="5009 + ISS:counter()"/>
      <xsl:text>}2</xsl:text>
    </xsl:if>
    <xsl:if test="$cifentity[entityid=$b1eid]/raceblack = '1'" >
      <xsl:text>{</xsl:text>
      <xsl:value-of select="5009 + ISS:counter()"/>
      <xsl:text>}3</xsl:text>
    </xsl:if>
    <xsl:if test="$cifentity[entityid=$b1eid]/racenative = '1'" >
      <xsl:text>{</xsl:text>
      <xsl:value-of select="5009 + ISS:counter()"/>
      <xsl:text>}1</xsl:text>
    </xsl:if>
    <xsl:if test="$cifentity[entityid=$b1eid]/racepacificislander = '1'" >
      <xsl:text>{</xsl:text>
      <xsl:value-of select="5009 + ISS:counter()"/>
      <xsl:text>}4</xsl:text>
    </xsl:if>
    <xsl:if test="$cifentity[entityid=$b1eid]/racewhite = '1'" >
      <xsl:text>{</xsl:text>
      <xsl:value-of select="5009 + ISS:counter()"/>
      <xsl:text>}5</xsl:text>
    </xsl:if>
    <xsl:if test="ISS:counter() = '1'" >
      <xsl:text>(5010)6</xsl:text>
    </xsl:if>
    <xsl:text>{5015}</xsl:text>
    <xsl:if test ="string-length($cifentity[entityid=$b1eid]/sex) &gt; 0">
    <xsl:value-of select="substring($cifentity[entityid=$b1eid]/sex, 1, 1)"/>
    </xsl:if>
    <xsl:if test ="string-length($cifentity[entityid=$b1eid]/age) &gt; 0">
    <xsl:text>{5016}</xsl:text>
    <xsl:value-of select="format-number(number($cifentity[entityid=$b1eid]/age), '##')"/>
    </xsl:if>
    <xsl:if test ="string-length($cifentity[entityid=$b1eid]/maritalstatus) &gt; 0">
      <xsl:text>{5017}</xsl:text>
      <xsl:value-of select="substring($cifentity[entityid=$b1eid]/maritalstatus, 1, 1)"/>
    </xsl:if>
    <xsl:if test="$refinanceflag" >
      <xsl:text>{5019}</xsl:text>
      <xsl:value-of select="format-number($loanmain/refinanceamount * 100, '#########')"/>
    </xsl:if>
    <xsl:text>{5020}</xsl:text>
    <xsl:value-of select="format-number($loanmain/totalloanamount * 100, '#########')"/>
    <xsl:if test="string-length($cifentity[entityid=$b2eid]/taxidnumber) &gt; 0">
      <xsl:if test="$cifentity[entityid=$b2eid]/ethnicityhispanic > '0'" >
        <xsl:text>{5023}</xsl:text>
        <xsl:value-of select="$cifentity[entityid=$b2eid]/ethnicityhispanic"/>
      </xsl:if>
      <xsl:variable name="v2" select="ISS:resetcounter()"/>
      <xsl:if test="$cifentity[entityid=$b2eid]/raceasian = '1'" >
        <xsl:text>{</xsl:text>
        <xsl:value-of select="5023 + ISS:counter()"/>
        <xsl:text>}2</xsl:text>
      </xsl:if>
      <xsl:if test="$cifentity[entityid=$b2eid]/raceblack = '1'" >
        <xsl:text>{</xsl:text>
        <xsl:value-of select="5023 + ISS:counter()"/>
        <xsl:text>}3</xsl:text>
      </xsl:if>
      <xsl:if test="$cifentity[entityid=$b2eid]/racenative = '1'" >
        <xsl:text>{</xsl:text>
        <xsl:value-of select="5023 + ISS:counter()"/>
        <xsl:text>}1</xsl:text>
      </xsl:if>
      <xsl:if test="$cifentity[entityid=$b2eid]/racepacificislander = '1'" >
        <xsl:text>{</xsl:text>
        <xsl:value-of select="5023 + ISS:counter()"/>
        <xsl:text>}4</xsl:text>
      </xsl:if>
      <xsl:if test="$cifentity[entityid=$b2eid]/racewhite = '1'" >
        <xsl:text>{</xsl:text>
        <xsl:value-of select="5023 + ISS:counter()"/>
        <xsl:text>}5</xsl:text>
      </xsl:if>
      <xsl:if test="ISS:counter() = '1'" >
        <xsl:text>{5024}6</xsl:text>
      </xsl:if>
      <xsl:text>{5029}</xsl:text>
      <xsl:value-of select="substring($cifentity[entityid=$b2eid]/sex, 1, 1)"/>
      <xsl:text>{5030}</xsl:text>
      <xsl:value-of select="format-number(number($cifentity[entityid=$b2eid]/age), '##')"/>
      <xsl:text>{5031}</xsl:text>
      <xsl:value-of select="substring($cifentity[entityid=$b2eid]/maritalstatus, 1, 1)"/>
    </xsl:if>
    <xsl:text>{091}F</xsl:text>
    <xsl:text>{290}01</xsl:text>
    <xsl:text>{292}000</xsl:text>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
      <xsl:choose>
        <xsl:when test="./subjectpropertyflag = 1">
          <xsl:choose>
            <xsl:when test="substring($spaddress/censustractlevel, 1, 3)='Low'">
              <xsl:text>{450}1</xsl:text>
            </xsl:when>
            <xsl:when test="substring($spaddress/censustractlevel, 1, 3)='Mod'">
              <xsl:text>{450}2</xsl:text>
            </xsl:when>
            <xsl:when test="substring($spaddress/censustractlevel, 1, 3)='Mid'">
              <xsl:text>{450}3</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>{450}4</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:for-each select="//loan_entity">
      <xsl:variable name="catid" select="./entitycategoryid" />
      <xsl:if test="$catid = '1-32'">
        <!-- *** WARNING *** ISB - Hardcoded Correspondent Lender Category -->
        <xsl:variable name ="entid" select="./entityid"/>
        <xsl:text>{461}</xsl:text>
        <xsl:value-of select ="substring(//cif_entity[entityid=$entid]/shortalias, 1, 3)"/>
      </xsl:if>
    </xsl:for-each>
      <xsl:if test ="$dtid = '16' or $dtid = '17' or $dtid = '18' or $dtid = '21'">
      <!-- *** WARNING *** - ISB Hardcoded Doc Types-->
      <xsl:text>{466}NIV</xsl:text>
    </xsl:if>
    <xsl:text>{455}N</xsl:text>
    <xsl:text>{415}</xsl:text>
    <xsl:value-of select ="//cif_employment[entityid=$b1eid][currentemployment=1]/employername"/>
    <xsl:if test ="string-length(//cif_employment[entityid=$b1eid][currentemployment=1]/title) &gt; 0">
      <xsl:text>{416}</xsl:text>
      <xsl:value-of select ="//cif_employment[entityid=$b1eid][currentemployment=1]/title"/>
    </xsl:if>
    <xsl:if test="$armflag" >
      <xsl:text>{607}</xsl:text>
      <xsl:value-of select="format-number($loanmain/loanrate * 1000, '#####')"/>
      <xsl:text>{608}</xsl:text>
      <xsl:value-of select="format-number($loanmain/nopymtssubsrateadj, '##')"/>
      <xsl:text>{609}</xsl:text>
      <xsl:value-of select="ISS:FormatDate($loanmain/dateof1stratechange)"/>
      <xsl:text>{610}</xsl:text>
      <xsl:value-of select="ISS:FormatDate($loanmain/actualclosingdate)"/>
      <xsl:text>{611}</xsl:text>
      <xsl:value-of select="format-number($loanmain/margin * 1000, '#0000')"/>
      <xsl:text>{612}075</xsl:text>
      <xsl:text>{613}</xsl:text>
      <xsl:value-of select="format-number($loanmain/floorratevalue * 1000, '#0000')"/>
      <xsl:text>{614}</xsl:text>
      <xsl:value-of select="format-number($loanmain/firstrateadjvalue * 1000, '#0000')"/>
      <xsl:text>{615}</xsl:text>
      <xsl:value-of select="format-number($loanmain/ceilingratevalue * 1000, '#0000')"/>
      <xsl:text>{616}</xsl:text>
      <xsl:value-of select="format-number($loanmain/firstrateadjvalue * 1000, '#0000')"/>
      <xsl:text>{617}</xsl:text>
      <xsl:value-of select="format-number($loanmain/indexvalue * 1000, '#0000')"/>
      <xsl:text>{627}</xsl:text>
      <xsl:variable name ="yr1" select ="format-number($loanmain/nopymtsfirstpymtadj div 12, '00')"/>
      <xsl:variable name ="yr2" select ="format-number($loanmain/nopymtssubspymtadj div 12, '00')"/>
      <xsl:value-of select="concat($yr1, $yr2)"/>
      <xsl:text>{620}</xsl:text>
      <xsl:value-of select="format-number($loanmain/proposedpipayment*100, '#########')"/>
      <xsl:text>{621}</xsl:text>
      <xsl:value-of select="ISS:FormatDate($loanmain/dateoffirstpayment)"/>
      <xsl:text>{622}</xsl:text>
      <xsl:value-of select="ISS:FormatDate($loanmain/dateof1stpaymentchange)"/>
      <xsl:text>{623}</xsl:text>
      <xsl:value-of select="ISS:FormatDate($loanmain/dateoffirstpayment)"/>
      <xsl:text>{624}</xsl:text>
      <xsl:value-of select="format-number($loanmain/numberofpayments, '###')"/>
      <xsl:text>{626}702</xsl:text>
      <xsl:text>{630}</xsl:text>
      <xsl:value-of select="format-number($loanmain/proposedtotal*100, '#########')"/>
      <xsl:text>{636}0</xsl:text>
      <xsl:text>{640}Y</xsl:text>
      <xsl:text>{641}Y</xsl:text>
      <xsl:text>{642}</xsl:text>
      <xsl:value-of select="format-number($loanmain/indexvalue * 1000, '#0000')"/>
      <xsl:text>{654}2</xsl:text>
      <xsl:text>{656}</xsl:text>
      <xsl:value-of select="format-number($loanmain/numberofpayments, '###')"/>
      <xsl:text>{658}020</xsl:text>
      <xsl:text>{659}020</xsl:text>
      <xsl:text>{690}1</xsl:text>
    </xsl:if>
    <xsl:text>{305}09</xsl:text>
    <xsl:for-each select="//loan_collateral">
      <xsl:variable name="prid" select="./propertyid" />
      <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
      <xsl:text>{1090}</xsl:text>
      <xsl:value-of select="substring(concat($cifentity[entityid=$b1eid]/firstname,
                                           ' ',
                                           $cifentity[entityid=$b1eid]/lastname), 1, 40)"/>
      <xsl:choose>
          <xsl:when test="./subjectpropertyflag = 1">
          <xsl:text>{1093}</xsl:text>
          <xsl:value-of select="substring($spaddress/addressline1, 1, 40)"/>
          <xsl:text>{1095}</xsl:text>
          <xsl:value-of select="substring($spaddress/city, 1, 25)"/>
          <xsl:text>{1096}</xsl:text>
          <xsl:value-of select="substring($spaddress/state, 1, 2)"/>
          <xsl:text>{1097}</xsl:text>
          <xsl:value-of select="concat(substring($spaddress/zipcode, 1, 5),
                                       substring($spaddress/zipcode, 7, 4))"/>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <xsl:text>{1010}</xsl:text>
    <xsl:value-of select="substring($cifentity[entityid=$b1eid]/lastname, 1, 20)"/>
    <!-- <xsl:text>{1011}</xsl:text> -->
    <!-- <xsl:value-of select="substring($cifentity[entityid=$b1eid]/firstname, 1, 20)"/> -->
    <xsl:if test ="string-length($cifentity[entityid=$b1eid]/taxidnumber) &gt; 0">
      <xsl:text>{1670}</xsl:text>
      <xsl:value-of select="concat(substring($cifentity[entityid=$b1eid]/taxidnumber, 1, 3),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 5, 2),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 8, 4))"/>
    </xsl:if>
    <xsl:text>{301}01</xsl:text>
    <xsl:text>{1010}</xsl:text>
    <xsl:value-of select="substring(concat($cifentity[entityid=$b1eid]/firstname,
                                           ' ',
                                           $cifentity[entityid=$b1eid]/lastname), 1, 40)"/>
    <xsl:if test="$b2eid">
      <xsl:text>{1011}</xsl:text>
      <xsl:value-of select="substring(concat($cifentity[entityid=$b2eid]/firstname,
                                           ' ',
                                           $cifentity[entityid=$b2eid]/lastname), 1, 40)"/>
      <xsl:if test="$b3eid">
        <xsl:text>{1012}</xsl:text>
        <xsl:value-of select="substring(concat($cifentity[entityid=$b3eid]/firstname,
                                           ' ',
                                           $cifentity[entityid=$b3eid]/lastname), 1, 40)"/>
      </xsl:if>
    </xsl:if>
    <xsl:if test ="string-length($b1arec/addressline1) &gt; 0">
      <xsl:text>{1013}</xsl:text>
      <xsl:value-of select="substring($b1arec/addressline1, 1, 40)"/>
    </xsl:if>
    <xsl:if test ="string-length($b1arec/addressline2) &gt; 0">
      <xsl:text>{1014}</xsl:text>
      <xsl:value-of select="substring($b1arec/addressline2, 1 ,40)"/>
    </xsl:if>
    <xsl:text>{1015}</xsl:text>
    <xsl:value-of select="substring($b1arec/city, 1, 25)"/>
    <xsl:text>{1016}</xsl:text>
    <xsl:value-of select="substring($b1arec/state, 1, 2)"/>
    <xsl:text>{1017}</xsl:text>
    <xsl:value-of select="concat(substring($b1arec/zipcode, 1, 5),
                                       substring($b1arec/zipcode, 7, 4))"/>
    <xsl:for-each select="//cif_entityphone[entityid=$b1eid]">
      <xsl:variable name="phoneid" select="./phoneid"/>
      <xsl:if test="./phonetypeid = '1'">
        <xsl:text>{1021}</xsl:text>
        <xsl:value-of select ="concat(substring(//common_phone[phoneid=$phoneid]/phonenumber, 2, 3),
                                      substring(//common_phone[phoneid=$phoneid]/phonenumber, 7, 3),
                                      substring(//common_phone[phoneid=$phoneid]/phonenumber, 11, 4))"/>
      </xsl:if>
      <xsl:if test="./phonetypeid = '2'">
        <xsl:text>{1022}</xsl:text>
        <xsl:value-of select ="concat(substring(//common_phone[phoneid=$phoneid]/phonenumber, 2, 3),
                                      substring(//common_phone[phoneid=$phoneid]/phonenumber, 7, 3),
                                      substring(//common_phone[phoneid=$phoneid]/phonenumber, 11, 4))"/>
      </xsl:if>
    </xsl:for-each>
    <xsl:text>{1512}</xsl:text>
    <xsl:value-of select="substring($cifentity[entityid=$b1eid]/firstname, 1, 20)"/>
    <xsl:text>{1511}</xsl:text>
    <xsl:value-of select="substring($cifentity[entityid=$b1eid]/lastname, 1, 20)"/>
    <xsl:if test ="string-length($cifentity[entityid=$b1eid]/taxidnumber) &gt; 0">
      <xsl:text>{1510}</xsl:text>
      <xsl:value-of select="concat(substring($cifentity[entityid=$b1eid]/taxidnumber, 1, 3),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 5, 2),
                                   substring($cifentity[entityid=$b1eid]/taxidnumber, 8, 4))"/>
    </xsl:if>

    <xsl:if test="string-length($cifentity[entityid=$b2eid]/taxidnumber) &gt; 0">
      <xsl:value-of select="$newline"/>
      <xsl:text>627,A,NA,</xsl:text>
      <xsl:value-of select="concat($customloanmain/loanservicingnumber,100)"/>

      <xsl:text>{1240}</xsl:text>
      <xsl:value-of select="substring(concat($cifentity[entityid=$b2eid]/firstname,
                                           ' ',
                                           $cifentity[entityid=$b2eid]/lastname), 1, 40)"/>
      <xsl:text>{1243}</xsl:text>
      <xsl:value-of select="substring($b2arec/addressline1, 1, 40)"/>
   <!--   <xsl:text>{1244}</xsl:text> -->
    <!-->  <xsl:value-of select="substring($b2arec/addressline2, 1 ,40)"/>  -->
      <xsl:text>{1245}</xsl:text>
      <xsl:value-of select="substring($b2arec/city, 1, 25)"/>
      <xsl:text>{1246}</xsl:text>
      <xsl:value-of select="substring($b2arec/state, 1, 2)"/>
      <xsl:text>{1247}</xsl:text>
      <xsl:value-of select="concat(substring($b2arec/zipcode, 1, 5),
                                       substring($b2arec/zipcode, 7, 4))"/>

      <xsl:for-each select="//cif_entityphone[entityid=$b2eid]">
        <xsl:variable name="phoneid" select="./phoneid"/>
        <xsl:if test="./phonetypeid = '1'">
          <xsl:text>{1251}</xsl:text>
          <xsl:value-of select ="concat(substring(//common_phone[phoneid=$phoneid]/phonenumber, 2, 3),
                                        substring(//common_phone[phoneid=$phoneid]/phonenumber, 7, 3),
                                        substring(//common_phone[phoneid=$phoneid]/phonenumber, 11, 4))"/>
        </xsl:if>
      </xsl:for-each>
      <xsl:text>{1262}4</xsl:text>
      <xsl:text>{1253}</xsl:text>
      <xsl:value-of select="concat(substring($cifentity[entityid=$b2eid]/taxidnumber, 1, 3),
                                 substring($cifentity[entityid=$b2eid]/taxidnumber, 5, 2),
                                 substring($cifentity[entityid=$b2eid]/taxidnumber, 8, 4))"/>
      <xsl:for-each select="//cif_entityphone[entityid=$b2eid]">
        <xsl:variable name="phoneid" select="./phoneid"/>
        <xsl:if test="./phonetypeid = '2'">
          <xsl:text>{1252}</xsl:text>
          <xsl:value-of select ="concat(substring(//common_phone[phoneid=$phoneid]/phonenumber, 2, 3),
                                        substring(//common_phone[phoneid=$phoneid]/phonenumber, 7, 3),
                                        substring(//common_phone[phoneid=$phoneid]/phonenumber, 11, 4))"/>
        </xsl:if>
      </xsl:for-each>
      <xsl:text>{1255}</xsl:text>
      <xsl:value-of select="substring($cifentity[entityid=$b2eid]/lastname, 1, 15)"/>
      <xsl:text>{1256}101</xsl:text>
      <xsl:text>{1257}100</xsl:text>
      <xsl:text>{1254}</xsl:text>
      <xsl:value-of select="concat(substring($cifentity[entityid=$b2eid]/taxidnumber, 1, 3),
                                 substring($cifentity[entityid=$b2eid]/taxidnumber, 5, 2),
                                 substring($cifentity[entityid=$b2eid]/taxidnumber, 8, 4))"/>
      <xsl:text>{1271}</xsl:text>
      <xsl:value-of select="substring($cifentity[entityid=$b2eid]/lastname, 1, 20)"/>
      <xsl:text>{1272}</xsl:text>
      <xsl:value-of select="substring($cifentity[entityid=$b2eid]/firstname, 1, 20)"/>
      <xsl:text>{1270}</xsl:text>
      <xsl:value-of select="concat(substring($cifentity[entityid=$b2eid]/taxidnumber, 1, 3),
                                 substring($cifentity[entityid=$b2eid]/taxidnumber, 5, 2),
                                 substring($cifentity[entityid=$b2eid]/taxidnumber, 8, 4))"/>
    </xsl:if>
    <xsl:value-of select="$newline"/>
    <xsl:if test="//product_main/productcode != 93">
      <xsl:text>627,A,TL,</xsl:text>
      <xsl:value-of select="$customloanmain/loanservicingnumber"/>
      <xsl:text>,001{910}1</xsl:text>
      <xsl:for-each select="//loan_collateral">
        <xsl:variable name="prid" select="./propertyid" />
        <xsl:variable name="propediid" select="../cif_property[propertyid=$prid]/propertytypeedicodeid" />
        <xsl:choose>
          <xsl:when test="./subjectpropertyflag = 1">
            <xsl:text>{911}</xsl:text>
            <xsl:value-of select="../cif_property[propertyid=$prid]/lot"/>
            <xsl:text>{912}</xsl:text>
            <xsl:value-of select="../cif_property[propertyid=$prid]/block"/>
            <xsl:if test ="string-length(../cif_property[propertyid=$prid]/unitno) &gt; 0">
              <xsl:text>{913}</xsl:text>
              <xsl:value-of select="../cif_property[propertyid=$prid]/unitno"/>
            </xsl:if>
            <xsl:text>{915}</xsl:text>
            <xsl:value-of select="substring($spaddress/addressline1, 1, 30)"/>
            <xsl:text>{916}</xsl:text>
            <xsl:value-of select="substring(concat($spaddress/city,
                                                 ' ',
                                                 $spaddress/state,
                                                 ' ',
                                                 substring($spaddress/zipcode, 1, 5),
                                                 substring($spaddress/zipcode, 7, 4)), 1, 30)"/>
          </xsl:when>
        </xsl:choose>
      </xsl:for-each>
      <xsl:variable name ="qtrlytaxes" select = "format-number((number(//loan_huditem[loanrecordid=$loanmain/loanrecordid][hudnumber=1003]/amount) +
                                                              number(//loan_huditem[loanrecordid=$loanmain/loanrecordid][hudnumber=1004]/amount)) * 100 div 4, '#########')"/>
      <!-- First Quarter Taxes -->
      <xsl:value-of select="$newline"/>
      <xsl:text>627,A,TA,</xsl:text>
      <xsl:value-of select="$customloanmain/loanservicingnumber"/>
      <xsl:text>,001,02,01</xsl:text>
      <xsl:if test ="string-length($customloanmain/firstquarterpayee) &gt; 0">
        <xsl:text>{920}</xsl:text>
        <xsl:value-of select="substring($customloanmain/firstquarterpayee, 1, 4)"/>
        <xsl:text>{921}</xsl:text>
        <xsl:value-of select="substring($customloanmain/firstquarterpayee, string-length($customloanmain/firstquarterpayee), 1)"/>
      </xsl:if>
      <xsl:if test="ISS:FormatDate($loanmain/dateofnote)">
        <xsl:choose>
          <xsl:when test="substring(ISS:FormatDate($loanmain/dateofnote),1,2) = '12'">
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))+1"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('0125', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('0201', format-number($yr+1, '00'))"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('0125', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('0201', format-number($yr+1, '00'))"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>
      <!-- Second Quarter Taxes -->
      <xsl:value-of select="$newline"/>
      <xsl:text>627,A,TA,</xsl:text>
      <xsl:value-of select="$customloanmain/loanservicingnumber"/>
      <xsl:text>,001,05,01</xsl:text>
      <xsl:if test ="string-length($customloanmain/secondquarterpayee) &gt; 0">
        <xsl:text>{920}</xsl:text>
        <xsl:value-of select="substring($customloanmain/secondquarterpayee, 1, 4)"/>
        <xsl:text>{921}</xsl:text>
        <xsl:value-of select="substring($customloanmain/secondquarterpayee, string-length($customloanmain/secondquarterpayee), 1)"/>
      </xsl:if>
      <xsl:if test="ISS:FormatDate($loanmain/dateofnote)">
        <xsl:choose>
          <xsl:when test="substring(ISS:FormatDate($loanmain/dateofnote),1,2) = '01' or
                        substring(ISS:FormatDate($loanmain/dateofnote),1,2) = '02'">
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))-1"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('0425', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('0501', format-number($yr+1, '00'))"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('0425', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('0501', format-number($yr+1, '00'))"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>
      <!-- Third Quarter Taxes -->
      <xsl:value-of select="$newline"/>
      <xsl:text>627,A,TA,</xsl:text>
      <xsl:value-of select="$customloanmain/loanservicingnumber"/>
      <xsl:text>,001,08,01</xsl:text>
      <xsl:if test ="string-length($customloanmain/thirdquarterpayee) &gt; 0">
        <xsl:text>{920}</xsl:text>
        <xsl:value-of select="substring($customloanmain/thirdquarterpayee, 1, 4)"/>
        <xsl:text>{921}</xsl:text>
        <xsl:value-of select="substring($customloanmain/thirdquarterpayee, string-length($customloanmain/thirdquarterpayee), 1)"/>
      </xsl:if>
      <xsl:if test="ISS:FormatDate($loanmain/dateofnote)">
        <xsl:choose>
          <xsl:when test="substring(ISS:FormatDate($loanmain/dateofnote),1,2) &gt; '01' and
                        substring(ISS:FormatDate($loanmain/dateofnote),1,2) &lt; '06'">
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))-1"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('0725', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('0801', format-number($yr+1, '00'))"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('0725', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('0801', format-number($yr+1, '00'))"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>
      <!-- Fourth Quarter Taxes -->
      <xsl:value-of select="$newline"/>
      <xsl:text>627,A,TA,</xsl:text>
      <xsl:value-of select="$customloanmain/loanservicingnumber"/>
      <xsl:text>,001,11,01</xsl:text>
      <xsl:if test ="string-length($customloanmain/fourthquarterpayee) &gt; 0">
        <xsl:text>{920}</xsl:text>
        <xsl:value-of select="substring($customloanmain/fourthquarterpayee, 1, 4)"/>
        <xsl:text>{921}</xsl:text>
        <xsl:value-of select="substring($customloanmain/fourthquarterpayee, string-length($customloanmain/fourthquarterpayee), 1)"/>
      </xsl:if>
      <xsl:if test="ISS:FormatDate($loanmain/dateofnote)">
        <xsl:choose>
          <xsl:when test="substring(ISS:FormatDate($loanmain/dateofnote),1,2) &gt; '01' and
                        substring(ISS:FormatDate($loanmain/dateofnote),1,2) &lt; '09'">
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))-1"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('1025', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('1101', format-number($yr+1, '00'))"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:variable name="yr" select="number(substring(ISS:FormatDate($loanmain/dateofnote), 5, 2))"></xsl:variable>
            <xsl:text>{924}</xsl:text>
            <xsl:value-of select="concat('1025', format-number($yr, '00'))"/>
            <xsl:text>{925}</xsl:text>
            <xsl:value-of select="$qtrlytaxes"/>
            <xsl:text>{927}</xsl:text>
            <xsl:value-of select="concat('1101', format-number($yr+1, '00'))"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:if>
    </xsl:if>  
  </xsl:template>
</xsl:stylesheet>

Open in new window

Avatar of ISBTECH

ASKER

Actually it looks like the funtion references this file first and this file then calles the code I put in above.
<!--<?xml version="1.0" encoding="utf-8"?> Version - 3-5-09-->
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ms="urn:schemas-microsoft-com:xslt"
                xmlns:ISS="urn:my-scripts"
                exclude-result-prefixes="ms ISS">
  <xsl:output method="text" indent="yes" cdata-section-elements="ImageLocation"/>
  <ms:script language="C#" implements-prefix="ISS">
    <ms:using namespace="System.Collections.Generic"/>
    <ms:using namespace="System.Text.RegularExpressions"/>
    <![CDATA[
  // functions and variable to implement a simple counter
	private int pcounter = 0;
  
  // function to reset the counter to zero
	public void resetcounter()
  {
    pcounter = 0;
  }
  
  // function that returns an incremented counter on each call
	public int counter()
  {
    return ++pcounter;
  }
  
  // Formatting Functions
  // Formats money for display
	public string FormatMoney(string pNode)
  {
    if (String.IsNullOrEmpty(pNode) || pNode.Equals("NaN"))
      return "0.00";
    else
      return string.Format("{0:F2}", Convert.ToDecimal(pNode));
  }
	
	public string FormatDate(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
			return Convert.ToDateTime(pDate).ToString("MMddyy");
	}
	
	public string FormatDate4(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
			return Convert.ToDateTime(pDate).ToString("MMddyyyy");
	}
	
	public string TodaysDate()
	{
		return string.Format("{0:d}", DateTime.Today);
	}
	
	public string FormatMonth(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
      switch (Convert.ToDateTime(pDate).Month) {
      case 1  : return "January";
                break;
      case 2  : return "February";
                break;
      case 3  : return "March";
                break;
      case 4  : return "April";
                break;
      case 5  : return "May";
                break;
      case 6  : return "June";
                break;
      case 7  : return "July";
                break;
      case 8  : return "August";
                break;
      case 9  : return "September";
                break;
      case 10 : return "October";
                break;
      case 11 : return "November";
                break;
      case 12 : return "December";
                break;
      default : return "";
                break;
      }
	}
	
	public string FormatYear(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
			return string.Format("{0}", Convert.ToDateTime(pDate).Year);
	}
  
  // Takes a day of the months and adds suffix
  public string TextDayOfMonth(string pDay)
  {
    switch (pDay) {
    case "1"  :
    case "21" :
    case "31" : return pDay + "st";
                break;
    case "2"  :
    case "22" : return pDay + "nd";
                break;
    case "3"  :
    case "23" : return pDay + "rd";
                break;
    case ""   : return "";
                break;
    default   : return pDay + "th";
                break;
    }
  }
  
  // formats a zip code based on override flag and length
	public string FormatZipCode(string pZip, string pOvr)
  {
    bool anOvr = false;
    if (!String.IsNullOrEmpty(pOvr))
      anOvr = pOvr.Equals("1");
    if (String.IsNullOrEmpty(pZip))
      return "";
    else
    {
      if (anOvr)
        return pZip;
      else
      {
        if (pZip.Length == 9)
          return pZip.Substring(0, 5) + "-" + pZip.Substring(5, 4);
        else if (pZip.Length == 6)
          return pZip.Substring(0, 5);
        else
          return pZip;
      }
    }
  }
  
  // formats a social security number
	public string FormatSSN(string pSSN)
  {
     if (String.IsNullOrEmpty(pSSN))
      return "";
    else
    {
      if (pSSN.Length == 9)
        return pSSN.Substring(0, 3) + "-" + pSSN.Substring(3, 2) + "-" + pSSN.Substring(5, 4);
      else
        return pSSN;
    }
  }
  
  // formats a phone number based on override and length
	public string FormatPhoneNumber(string pPhone, string pOvr)
  {
    bool anOvr = false;
    if (!String.IsNullOrEmpty(pOvr))
      anOvr = pOvr.Equals("1");
    if (String.IsNullOrEmpty(pPhone))
      return "";
    else
    {
      if (anOvr)
        return pPhone;
      else
      {
        if (pPhone.Length == 10)
          return "(" + pPhone.Substring(0, 3) + ") " + pPhone.Substring(3, 3) + "-" + pPhone.Substring(6, 4);
        else if (pPhone.Length == 13)
          return pPhone.Substring(0, 5) + " " + pPhone.Substring(5, 7);
        else if (pPhone.Length == 7)
          return pPhone.Substring(0, 3) + "-" + pPhone.Substring(3, 4);
        else
          return pPhone;
      }
    }
  }
	
  public string StringToXML(string data)
  {
    string rval = data.Replace("&gt;", ">");
    return rval.Replace("&lt;", "<");
  }
	
  // process list functions
  private Dictionary<string, List<string>> pProcessedKeys = new Dictionary<string, List<string>>();
  
  public void ResetAllProcessedKeys()
  {
    pProcessedKeys.Clear();
  }
  
  public void ResetProcessedKeyList(string name)
  {
    if (pProcessedKeys.ContainsKey(name))
      pProcessedKeys.Remove(name);
  }
  
  public bool HasKeyBeenProcessed(string name, string rid)
  {
    bool rval = false;
    List<string> lst;
    if (pProcessedKeys.TryGetValue(name, out lst))
      rval = lst.Contains(rid);
    return rval;
  }
  
  public void AddProcessedKey(string name, string rid)
  {
    string val = rid;
    if (!pProcessedKeys.ContainsKey(name)) {
      List<string> lst = new List<string>();
      lst.Add(val);
      pProcessedKeys.Add(name, lst);
    } 
    else
    {
      List<string> lst;
      pProcessedKeys.TryGetValue(name, out lst);
      if (!lst.Contains(val))
        lst.Add(val);
    }
  }
	
	public string RelpaceAmScheduleTokens(string pXmlstring)
	{
		Regex aRegex = new Regex("Z[1-9A-Z]Z", RegexOptions.Compiled);
		Dictionary<string, string> aTokenList = new Dictionary<string, string>();
		aTokenList.Add("Z1Z", "Payment");
		aTokenList.Add("Z2Z", "InterestAmount");
		aTokenList.Add("Z3Z", "Amount");
		aTokenList.Add("Z4Z", "ScheduleMonthAndYear");
		aTokenList.Add("Z5Z", "PrincipalBalanceAmount");
		aTokenList.Add("Z6Z", "PrincipalAmount");
		aTokenList.Add("Z7Z", "SchedulePaymentSequenceNumber");
		aTokenList.Add("Z8Z", "InsuranceAmount");
		aTokenList.Add("Z9Z", "TaxAmount");
		aTokenList.Add("ZAZ", "OtherAmount");
		
		string aRetval = aRegex.Replace(pXmlstring, delegate(Match pMatch)
			{
				string aValue;
				aTokenList.TryGetValue(pMatch.Groups[0].Value, out aValue);
				return aValue;
			});
			
		return aRetval;
	}
	
	public Object GetValueFromXMLString(string pXML, string pXPath)
	{
		Object aRetVal;
		XmlDocument aDoc = new XmlDocument();
		aDoc.LoadXml(pXML);
		XPathNavigator aNav = aDoc.CreateNavigator();
		XPathExpression aQuery = aNav.Compile(pXPath);
		aRetVal = aNav.Evaluate(aQuery);
		return aRetVal;
	}

	public string PreserveFormatting(string pData)
	{
		StringBuilder aString = new StringBuilder();
		if (pData.Length > 0)
		{
			aString.Append("<![CDATA[<script>");
			foreach (char aChar in pData.ToCharArray())
			{
				if (aChar != '\n')
					aString.Append(aChar);
				else
					aString.Append("<printline/>");
			}
			aString.Append("<printline/>");
			aString.Append("</script>");
			// need to do this for the xslt parser - otherwise it thinks this is the end of the outer enclosing cdata section
			aString.Append("]");
			aString.Append("]>");
		}
		return aString.ToString();
	}
	
	public string BeautifyReportingModel(string pData)
	{
		StringBuilder aString = new StringBuilder();
		bool aStartFlag = true;
		bool aMajorFlag = false;
		int i = 0;
		
		Char []aCA = pData.ToCharArray();
		
		for (i = 0; i < pData.Length; i++)
		{
			if (aStartFlag)
				{
					aString.Append(aCA[i]);
					aStartFlag = false;
					if (Char.IsUpper(aCA[i]) || Char.IsDigit(aCA[i]) || Char.IsPunctuation(aCA[i]))
						aMajorFlag = true;
				}
				else if ((Char.IsUpper(aCA[i]) || Char.IsDigit(aCA[i]) || Char.IsPunctuation(aCA[i])) && aMajorFlag)
				{
					if (i < (pData.Length - 1) && !(Char.IsUpper(aCA[i + 1]) || Char.IsDigit(aCA[i + 1]) || Char.IsPunctuation(aCA[i + 1])))
					{
						aString.Append(" ");
						aString.Append(aCA[i]);
					}
					else
						aString.Append(aCA[i]);
				}
				else
				{
					if (Char.IsUpper(aCA[i]) || Char.IsDigit(aCA[i]) || Char.IsPunctuation(aCA[i]))
					{
						aString.Append(" ");
						aString.Append(aCA[i]);
						aMajorFlag = true;
					}
					else
					{
						aString.Append(aCA[i]);
						aMajorFlag = false;
					}
				}
			}
	
		return aString.ToString();
	}
	
	private string tempString;
	
	public string SetTempString(string pString)
	{
		tempString = pString;
		return tempString;
	}
	
	public string GetTempString()
	{
		return tempString;
	}
	
	public bool FileExists(string pFilename)
	{
		return System.IO.File.Exists(pFilename);
	}
	
	private double mAccumulator;
	
	public void ResetAccumulator()
	{
		mAccumulator = 0.0;
	}
	
	public string AddToAccumulator(string pValue)
	{
		if (String.IsNullOrEmpty(pValue) || pValue.Equals("NaN"))
			return string.Format("{0:F2}", mAccumulator);
		else
		{
			mAccumulator = mAccumulator + Convert.ToDouble(pValue);
			return string.Format("{0:F2}", mAccumulator);
		}
	}
	
	public string GetAccumulator()
	{
		return string.Format("{0:F2}", mAccumulator);
	}
	
  ]]>
  </ms:script>

  <xsl:variable name="newline">
    <xsl:text>
</xsl:text>
  </xsl:variable>
  <xsl:variable name="loanmain" select="//loan_main" />
  <xsl:variable name="customloanmain" select="//custom_loanmain" />
  <xsl:variable name="loanclosing" select="//loan_closing" />
  <xsl:variable name="cifentity" select="//cif_entity" />
  <xsl:variable name="lcg" select="//loan_customergroup"/>
  <xsl:variable name="b1eid" select="$lcg[customernumber='1']/entityid" />
  <xsl:variable name="b2eid" select="$lcg[customernumber='2']/entityid" />
  <xsl:variable name="b3eid" select="$lcg[customernumber='3']/entityid" />
  <xsl:variable name="cifp" select="//cif_property"/>
  <xsl:variable name="cpj" select="//cif_propertyjoin[entityid=$lcg/entityid]"/>
  <xsl:variable name="comma" select="//common_address"/>
  <xsl:variable name="pid1" select="$cpj[entityid=$b1eid]/propertyid"/>
  <xsl:variable name="aid1" select="$cifp[propertyid=$pid1 and primaryaddress=1]/addressid"/>
  <xsl:variable name="b1arec" select="$comma[addressid=$aid1]"/>
  <xsl:variable name="pid2" select="$cpj[entityid=$b2eid]/propertyid"/>
  <xsl:variable name="aid2" select="$cifp[propertyid=$pid2 and primaryaddress=1]/addressid"/>
  <xsl:variable name="b2arec" select="$comma[addressid=$aid2]"/>
  <xsl:variable name="subjproperty" select="//cif_property[propertyid=//loan_collateral[subjectpropertyflag='1']/propertyid]" />
  <xsl:variable name="spaddress" select="$comma[addressid=$subjproperty/addressid]" />

  <xsl:variable name="constructionflag" select="$loanmain/purposeedicodeid='03' or $loanmain/purposeedicodeid='04' or $loanmain/purposeedicodeid='18' or $loanmain/purposeedicodeid='13'" />
  <xsl:variable name="constructiononlyflag" select="$loanmain/purposeedicodeid='04' or $loanmain/purposeedicodeid='18'" />
  <xsl:variable name="purchaseflag" select="$loanmain/purposeedicodeid = '01'or
                                            $loanmain/purposeedicodeid = '02'or
                                            $loanmain/purposeedicodeid = '06'or
                                            $loanmain/purposeedicodeid = '07'or
                                            $loanmain/purposeedicodeid = '08'or
                                            $loanmain/purposeedicodeid = '09'or
                                            $loanmain/purposeedicodeid = '10'or
                                            $loanmain/purposeedicodeid = '11'or
                                            $loanmain/purposeedicodeid = '14'or
                                            $loanmain/purposeedicodeid = '16'or
                                            $loanmain/purposeedicodeid = '17'or
                                            $loanmain/purposeedicodeid = '19'" />
  <xsl:variable name="refinanceflag" select="$loanmain/purposeedicodeid='05'" />
  <xsl:variable name="armflag" select="$loanmain/amortizationedicodeid = '01' or $loanmain/amortizationedicodeid = '08'" />
  <xsl:variable name="balloonflag" select="$loanmain/amortizationedicodeid = '02' or $loanmain/amortizationedicodeid = '07'" />
  <xsl:variable name="biweeklyflag" select="$loanmain/amortizationedicodeid = '23'" />
  <xsl:variable name="fhaflag" select="$loanmain/calculationtype = '2' or
								$loanmain/calculationtype = '6' or
								$loanmain/calculationtype = '9' or
								$loanmain/calculationtype = '15' or
								$loanmain/urlaloantypeid = '2'" />
  <xsl:variable name="vaflag" select="$loanmain/calculationtype = '3' or
								$loanmain/calculationtype = '7' or
								$loanmain/calculationtype = '10' or
								$loanmain/calculationtype = '16' or
								$loanmain/urlaloantypeid = '3'" />
  <xsl:variable name="businesschannel" select="$loanmain/channeltypeid"/>
  <xsl:variable name="helocflag" select="//product_main/helocflag = '1'"/>
  <xsl:variable name="portfolioARM" select="$armflag and //product_main/loantypecode = 'P'"/>
  <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
  <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
 <!-- <xsl:variable name="exptype" select ="translate(substring($customloanmain/LoanServicingNumber, 1, 2), $lowercase, $uppercase)"/> -->
  <xsl:variable name="exptype" select ="substring($customloanmain/LoanServicingNumber, 1, 2)"/>

  <!--Main Entry Point-->
  <xsl:template match="loandata">
      <xsl:choose>
      <xsl:when test ="translate(substring($customloanmain/loanservicingnumber, 1, 2), $lowercase, $uppercase) = 'IL'">
        <xsl:call-template name="ProcessIL"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="ProcessML"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:include href="ISS2OSI-ProcessML.xslt"/>
  <xsl:include href="ISS2OSI-ProcessIL.xslt"/> 

</xsl:stylesheet>

Open in new window

For a start you should set the output method to text if you are not making XML
  <xsl:output method="xml"/>
to become
   <xsl:output method="text"/>

There is another one in the including file
  <xsl:output method="text" indent="yes" cdata-section-elements="ImageLocation"/>
which is wrong, indent and cdata-section-elements are xml only, so the should be removed

Make both simply
  <xsl:output method="text"/>

the two output methods conflict by the way because you use include instead of import
(and the one in the included file wins because it comes latest)
Move these two lines to the top of the XSLT
  <xsl:include href="ISS2OSI-ProcessML.xslt"/>
  <xsl:include href="ISS2OSI-ProcessIL.xslt"/>
as a first child of xsl:stylesheet
and make the includes imports
like this
  <xsl:import href="ISS2OSI-ProcessML.xslt"/>
  <xsl:import href="ISS2OSI-ProcessIL.xslt"/>
that pushes the precedence of the second stylesheet back

This will likely remove the Byte Order Mark (that is what you see, it does not make sense in non XML actualy)
If the BOM is not gone, you need to change the .Net program you are doing this with

http://en.wikipedia.org/wiki/Byte_order_mark
about BOM

if you force the result stream of the XSLT to be UTF-8 encoded you will not see a BOM
Avatar of ISBTECH

ASKER

Ok I've made the changes you've suggested and the BOM is still there.  I've attached the current code to make sure I did it correctly. You mention forcing UTF-8 encoding in the above message is there something else I need to do to do that in addition to the changes you've already suggested?
<!--<?xml version="1.0" encoding="utf-8"?> Version - 3-5-09-->
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ms="urn:schemas-microsoft-com:xslt"
                xmlns:ISS="urn:my-scripts"
				exclude-result-prefixes="ms ISS">
<xsl:import href="ISS2OSI-ProcessML.xslt"/>
<xsl:import href="ISS2OSI-ProcessIL.xslt"/>
  <xsl:output method="text"/>
    <ms:script language="C#" implements-prefix="ISS">
    <ms:using namespace="System.Collections.Generic"/>
    <ms:using namespace="System.Text.RegularExpressions"/>
 
    <![CDATA[
  // functions and variable to implement a simple counter
	private int pcounter = 0;
  
  // function to reset the counter to zero
	public void resetcounter()
  {
    pcounter = 0;
  }
  
  // function that returns an incremented counter on each call
	public int counter()
  {
    return ++pcounter;
  }
  
  // Formatting Functions
  // Formats money for display
	public string FormatMoney(string pNode)
  {
    if (String.IsNullOrEmpty(pNode) || pNode.Equals("NaN"))
      return "0.00";
    else
      return string.Format("{0:F2}", Convert.ToDecimal(pNode));
  }
	
	public string FormatDate(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
			return Convert.ToDateTime(pDate).ToString("MMddyy");
	}
	
	public string FormatDate4(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
			return Convert.ToDateTime(pDate).ToString("MMddyyyy");
	}
	
	public string TodaysDate()
	{
		return string.Format("{0:d}", DateTime.Today);
	}
	
	public string FormatMonth(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
      switch (Convert.ToDateTime(pDate).Month) {
      case 1  : return "January";
                break;
      case 2  : return "February";
                break;
      case 3  : return "March";
                break;
      case 4  : return "April";
                break;
      case 5  : return "May";
                break;
      case 6  : return "June";
                break;
      case 7  : return "July";
                break;
      case 8  : return "August";
                break;
      case 9  : return "September";
                break;
      case 10 : return "October";
                break;
      case 11 : return "November";
                break;
      case 12 : return "December";
                break;
      default : return "";
                break;
      }
	}
	
	public string FormatYear(string pDate)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
			return string.Format("{0}", Convert.ToDateTime(pDate).Year);
	}
  
  // Takes a day of the months and adds suffix
  public string TextDayOfMonth(string pDay)
  {
    switch (pDay) {
    case "1"  :
    case "21" :
    case "31" : return pDay + "st";
                break;
    case "2"  :
    case "22" : return pDay + "nd";
                break;
    case "3"  :
    case "23" : return pDay + "rd";
                break;
    case ""   : return "";
                break;
    default   : return pDay + "th";
                break;
    }
  }
  
  // formats a zip code based on override flag and length
	public string FormatZipCode(string pZip, string pOvr)
  {
    bool anOvr = false;
    if (!String.IsNullOrEmpty(pOvr))
      anOvr = pOvr.Equals("1");
    if (String.IsNullOrEmpty(pZip))
      return "";
    else
    {
      if (anOvr)
        return pZip;
      else
      {
        if (pZip.Length == 9)
          return pZip.Substring(0, 5) + "-" + pZip.Substring(5, 4);
        else if (pZip.Length == 6)
          return pZip.Substring(0, 5);
        else
          return pZip;
      }
    }
  }
  
  // formats a social security number
	public string FormatSSN(string pSSN)
  {
     if (String.IsNullOrEmpty(pSSN))
      return "";
    else
    {
      if (pSSN.Length == 9)
        return pSSN.Substring(0, 3) + "-" + pSSN.Substring(3, 2) + "-" + pSSN.Substring(5, 4);
      else
        return pSSN;
    }
  }
  
  // formats a phone number based on override and length
	public string FormatPhoneNumber(string pPhone, string pOvr)
  {
    bool anOvr = false;
    if (!String.IsNullOrEmpty(pOvr))
      anOvr = pOvr.Equals("1");
    if (String.IsNullOrEmpty(pPhone))
      return "";
    else
    {
      if (anOvr)
        return pPhone;
      else
      {
        if (pPhone.Length == 10)
          return "(" + pPhone.Substring(0, 3) + ") " + pPhone.Substring(3, 3) + "-" + pPhone.Substring(6, 4);
        else if (pPhone.Length == 13)
          return pPhone.Substring(0, 5) + " " + pPhone.Substring(5, 7);
        else if (pPhone.Length == 7)
          return pPhone.Substring(0, 3) + "-" + pPhone.Substring(3, 4);
        else
          return pPhone;
      }
    }
  }
	
  public string StringToXML(string data)
  {
    string rval = data.Replace("&gt;", ">");
    return rval.Replace("&lt;", "<");
  }
	
  // process list functions
  private Dictionary<string, List<string>> pProcessedKeys = new Dictionary<string, List<string>>();
  
  public void ResetAllProcessedKeys()
  {
    pProcessedKeys.Clear();
  }
  
  public void ResetProcessedKeyList(string name)
  {
    if (pProcessedKeys.ContainsKey(name))
      pProcessedKeys.Remove(name);
  }
  
  public bool HasKeyBeenProcessed(string name, string rid)
  {
    bool rval = false;
    List<string> lst;
    if (pProcessedKeys.TryGetValue(name, out lst))
      rval = lst.Contains(rid);
    return rval;
  }
  
  public void AddProcessedKey(string name, string rid)
  {
    string val = rid;
    if (!pProcessedKeys.ContainsKey(name)) {
      List<string> lst = new List<string>();
      lst.Add(val);
      pProcessedKeys.Add(name, lst);
    } 
    else
    {
      List<string> lst;
      pProcessedKeys.TryGetValue(name, out lst);
      if (!lst.Contains(val))
        lst.Add(val);
    }
  }
	
	public string RelpaceAmScheduleTokens(string pXmlstring)
	{
		Regex aRegex = new Regex("Z[1-9A-Z]Z", RegexOptions.Compiled);
		Dictionary<string, string> aTokenList = new Dictionary<string, string>();
		aTokenList.Add("Z1Z", "Payment");
		aTokenList.Add("Z2Z", "InterestAmount");
		aTokenList.Add("Z3Z", "Amount");
		aTokenList.Add("Z4Z", "ScheduleMonthAndYear");
		aTokenList.Add("Z5Z", "PrincipalBalanceAmount");
		aTokenList.Add("Z6Z", "PrincipalAmount");
		aTokenList.Add("Z7Z", "SchedulePaymentSequenceNumber");
		aTokenList.Add("Z8Z", "InsuranceAmount");
		aTokenList.Add("Z9Z", "TaxAmount");
		aTokenList.Add("ZAZ", "OtherAmount");
		
		string aRetval = aRegex.Replace(pXmlstring, delegate(Match pMatch)
			{
				string aValue;
				aTokenList.TryGetValue(pMatch.Groups[0].Value, out aValue);
				return aValue;
			});
			
		return aRetval;
	}
	
	public Object GetValueFromXMLString(string pXML, string pXPath)
	{
		Object aRetVal;
		XmlDocument aDoc = new XmlDocument();
		aDoc.LoadXml(pXML);
		XPathNavigator aNav = aDoc.CreateNavigator();
		XPathExpression aQuery = aNav.Compile(pXPath);
		aRetVal = aNav.Evaluate(aQuery);
		return aRetVal;
	}

	public string PreserveFormatting(string pData)
	{
		StringBuilder aString = new StringBuilder();
		if (pData.Length > 0)
		{
			aString.Append("<![CDATA[<script>");
			foreach (char aChar in pData.ToCharArray())
			{
				if (aChar != '\n')
					aString.Append(aChar);
				else
					aString.Append("<printline/>");
			}
			aString.Append("<printline/>");
			aString.Append("</script>");
			// need to do this for the xslt parser - otherwise it thinks this is the end of the outer enclosing cdata section
			aString.Append("]");
			aString.Append("]>");
		}
		return aString.ToString();
	}
	
	public string BeautifyReportingModel(string pData)
	{
		StringBuilder aString = new StringBuilder();
		bool aStartFlag = true;
		bool aMajorFlag = false;
		int i = 0;
		
		Char []aCA = pData.ToCharArray();
		
		for (i = 0; i < pData.Length; i++)
		{
			if (aStartFlag)
				{
					aString.Append(aCA[i]);
					aStartFlag = false;
					if (Char.IsUpper(aCA[i]) || Char.IsDigit(aCA[i]) || Char.IsPunctuation(aCA[i]))
						aMajorFlag = true;
				}
				else if ((Char.IsUpper(aCA[i]) || Char.IsDigit(aCA[i]) || Char.IsPunctuation(aCA[i])) && aMajorFlag)
				{
					if (i < (pData.Length - 1) && !(Char.IsUpper(aCA[i + 1]) || Char.IsDigit(aCA[i + 1]) || Char.IsPunctuation(aCA[i + 1])))
					{
						aString.Append(" ");
						aString.Append(aCA[i]);
					}
					else
						aString.Append(aCA[i]);
				}
				else
				{
					if (Char.IsUpper(aCA[i]) || Char.IsDigit(aCA[i]) || Char.IsPunctuation(aCA[i]))
					{
						aString.Append(" ");
						aString.Append(aCA[i]);
						aMajorFlag = true;
					}
					else
					{
						aString.Append(aCA[i]);
						aMajorFlag = false;
					}
				}
			}
	
		return aString.ToString();
	}
	
	private string tempString;
	
	public string SetTempString(string pString)
	{
		tempString = pString;
		return tempString;
	}
	
	public string GetTempString()
	{
		return tempString;
	}
	
	public bool FileExists(string pFilename)
	{
		return System.IO.File.Exists(pFilename);
	}
	
	private double mAccumulator;
	
	public void ResetAccumulator()
	{
		mAccumulator = 0.0;
	}
	
	public string AddToAccumulator(string pValue)
	{
		if (String.IsNullOrEmpty(pValue) || pValue.Equals("NaN"))
			return string.Format("{0:F2}", mAccumulator);
		else
		{
			mAccumulator = mAccumulator + Convert.ToDouble(pValue);
			return string.Format("{0:F2}", mAccumulator);
		}
	}
	
	public string GetAccumulator()
	{
		return string.Format("{0:F2}", mAccumulator);
	}
	
  ]]>
  </ms:script>

  <xsl:variable name="newline">
    <xsl:text>
</xsl:text>
  </xsl:variable>
  <xsl:variable name="loanmain" select="//loan_main" />
  <xsl:variable name="customloanmain" select="//custom_loanmain" />
  <xsl:variable name="loanclosing" select="//loan_closing" />
  <xsl:variable name="cifentity" select="//cif_entity" />
  <xsl:variable name="lcg" select="//loan_customergroup"/>
  <xsl:variable name="b1eid" select="$lcg[customernumber='1']/entityid" />
  <xsl:variable name="b2eid" select="$lcg[customernumber='2']/entityid" />
  <xsl:variable name="b3eid" select="$lcg[customernumber='3']/entityid" />
  <xsl:variable name="cifp" select="//cif_property"/>
  <xsl:variable name="cpj" select="//cif_propertyjoin[entityid=$lcg/entityid]"/>
  <xsl:variable name="comma" select="//common_address"/>
  <xsl:variable name="pid1" select="$cpj[entityid=$b1eid]/propertyid"/>
  <xsl:variable name="aid1" select="$cifp[propertyid=$pid1 and primaryaddress=1]/addressid"/>
  <xsl:variable name="b1arec" select="$comma[addressid=$aid1]"/>
  <xsl:variable name="pid2" select="$cpj[entityid=$b2eid]/propertyid"/>
  <xsl:variable name="aid2" select="$cifp[propertyid=$pid2 and primaryaddress=1]/addressid"/>
  <xsl:variable name="b2arec" select="$comma[addressid=$aid2]"/>
  <xsl:variable name="subjproperty" select="//cif_property[propertyid=//loan_collateral[subjectpropertyflag='1']/propertyid]" />
  <xsl:variable name="spaddress" select="$comma[addressid=$subjproperty/addressid]" />

  <xsl:variable name="constructionflag" select="$loanmain/purposeedicodeid='03' or $loanmain/purposeedicodeid='04' or $loanmain/purposeedicodeid='18' or $loanmain/purposeedicodeid='13'" />
  <xsl:variable name="constructiononlyflag" select="$loanmain/purposeedicodeid='04' or $loanmain/purposeedicodeid='18'" />
  <xsl:variable name="purchaseflag" select="$loanmain/purposeedicodeid = '01'or
                                            $loanmain/purposeedicodeid = '02'or
                                            $loanmain/purposeedicodeid = '06'or
                                            $loanmain/purposeedicodeid = '07'or
                                            $loanmain/purposeedicodeid = '08'or
                                            $loanmain/purposeedicodeid = '09'or
                                            $loanmain/purposeedicodeid = '10'or
                                            $loanmain/purposeedicodeid = '11'or
                                            $loanmain/purposeedicodeid = '14'or
                                            $loanmain/purposeedicodeid = '16'or
                                            $loanmain/purposeedicodeid = '17'or
                                            $loanmain/purposeedicodeid = '19'" />
  <xsl:variable name="refinanceflag" select="$loanmain/purposeedicodeid='05'" />
  <xsl:variable name="armflag" select="$loanmain/amortizationedicodeid = '01' or $loanmain/amortizationedicodeid = '08'" />
  <xsl:variable name="balloonflag" select="$loanmain/amortizationedicodeid = '02' or $loanmain/amortizationedicodeid = '07'" />
  <xsl:variable name="biweeklyflag" select="$loanmain/amortizationedicodeid = '23'" />
  <xsl:variable name="fhaflag" select="$loanmain/calculationtype = '2' or
								$loanmain/calculationtype = '6' or
								$loanmain/calculationtype = '9' or
								$loanmain/calculationtype = '15' or
								$loanmain/urlaloantypeid = '2'" />
  <xsl:variable name="vaflag" select="$loanmain/calculationtype = '3' or
								$loanmain/calculationtype = '7' or
								$loanmain/calculationtype = '10' or
								$loanmain/calculationtype = '16' or
								$loanmain/urlaloantypeid = '3'" />
  <xsl:variable name="businesschannel" select="$loanmain/channeltypeid"/>
  <xsl:variable name="helocflag" select="//product_main/helocflag = '1'"/>
  <xsl:variable name="portfolioARM" select="$armflag and //product_main/loantypecode = 'P'"/>
  <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
  <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
 <!-- <xsl:variable name="exptype" select ="translate(substring($customloanmain/LoanServicingNumber, 1, 2), $lowercase, $uppercase)"/> -->
  <xsl:variable name="exptype" select ="substring($customloanmain/LoanServicingNumber, 1, 2)"/>

  <!--Main Entry Point-->
  <xsl:template match="loandata">
      <xsl:choose>
      <xsl:when test ="translate(substring($customloanmain/loanservicingnumber, 1, 2), $lowercase, $uppercase) = 'IL'">
        <xsl:call-template name="ProcessIL"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="ProcessML"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  

</xsl:stylesheet>

Open in new window

XSLT is fine now,

so, how do you do the transform in the dot net code?
I am not a C# nor VB.net programmer, but I know it is important whether you take a stream instead of a string and all that...
I hope it rings a bell for you
Can you show me the .net code?
Avatar of ISBTECH

ASKER

Well unfortunately that part is a bit complicated I am a system analyst for a legacy system that is written in C but uses a language called "Scheme" for the user configurable toolset.  The vendor is moving to a new .net model for the next release so all new programing needs to be handled in a way that supports both the old method and the new.  So I write scheme code to create a screen in the application that the user can interact with, that screen has a control that kicks off the xslt code written by the guy that is no longer here and then when we move to the new product we cut out the scheme functions and just use the xslt...  The relevant sections of the scheme code are in the first code snippet, the second is another referenced xslt file that comes from the vendor rather than the custom stuff I attached before.  Effectively I'm calling the Destiny2Epic.xslt to format the data correctly so the ISS2OSI.xslt to can then use it.  I'm NOT versed in XML or XSLT at all but have been thrown into this suddenly when he left.
(exportOSIdata
    (lambda (ctl dlg)
      (let* ((rval	0)
             (statwin	(gNewStatusWindow StatusWindow iWind "Exporting" "Formatting Data to OSI...")))
        (mGenerateDataFile)
        (gDispose statwin)
        rval)))

   (mGenerateDataFile
    (lambda()
      (let* ((rval		0))

        (mWriteTraceLog "start dumping data")
        ; create data transformation class object
        (cond ((is-null? iDataTransformClass)
               (set! iDataTransformClass (gNewDataTransform DataTransform))))

        (gSetDeleteTempFiles iDataTransformClass "Y")
	; feed it the data to perform the dump
	; how to connect to database - this is not using Dynace so its a different thing here
	(gSetDataSourceConnectionString iDataTransformClass (Getenv "OSIConnectionString"))
	; name of file containing tables to dump
        (gSetDataSourceFileName iDataTransformClass "businesstransforms\\DestinyDataModel.xml")
        ; dump data for this loan
	(gSetTransformLoanRecordID iDataTransformClass iLDID iLRID)
	; where to save the result (may not be necessary)
	(gDataResultFileName iDataTransformClass "")
	; dump the data
	(set! iDataDumpFile (gDumpDataSet iDataTransformClass))
	; next transform it into the correct format for CSi to use
	; checking to see if the data dump succeeded - returns xml with a success response in it, else an error message
        (mWriteTraceLog "stop dumping data")					
	(cond ((list? (regexp-match "name=\"GenerateDataSet\" result=\"Success\"" iDataDumpFile))
               ; confusing but - get the file name from the XML
               (set! iDataDumpFile (mGetFileNameFromXML iDataDumpFile))
	       (mCleanDataDumpFile)
               (mTransformData))
;               (mAppendCLSData iDataXMLFile))
              (else
               (Msg (string-append "mGenerateDataFile: " iDataDumpFile))))
        rval)))

   (mTransformData
    (lambda()
      (let* ((rval	0))
        (mWriteTraceLog "start transforming to epic")
        ; 2 step transform
	; first convert it to Epic format
	(gSetTransformFileName iDataTransformClass "businesstransforms\\Destiny2Epic.xslt")
        (gSetTransformResultFileName iDataTransformClass "")
        (gSetXMLStartElementName iDataTransformClass "loandata")
        (gDataResultFileName iDataTransformClass iDataDumpFile)
        (set! iDataXMLFile (gTransformDataFile iDataTransformClass 0 ""))
        (mWriteTraceLog "stop transforming to epic")
        (cond ((list? (regexp-match "name=\"TransformData\" result=\"Success\"" iDataXMLFile))
               (mWriteTraceLog "start transforming to OSI")
               (set! iDataXMLFile (mGetFileNameFromXML iDataXMLFile))
               ; second convert it to CSi format
               (gDataResultFileName iDataTransformClass iDataXMLFile)
               (gSetTransformFileName iDataTransformClass "businesstransforms\\ISS2OSI.xslt")
               (gSetTransformResultFileName iDataTransformClass (string-append (Getenv "OSIExportPath") (gFldGetString (GetUserStatement) "LoginName") ".csv"))
               (gSetRenameFilesFlag iDataTransformClass 1)
;              (gSetXMLStartElementName iDataTransformClass "TransactionValues")
               (set! iDataXMLFile (gTransformNonXML iDataTransformClass))
               (cond ((list? (regexp-match "name=\"TransformData\" result=\"Success\"" iDataXMLFile))
                      (set! iDataXMLFile (mGetFileNameFromXML iDataXMLFile))
;                      (mAppendCLSData iDataXMLFile)
                      (set! rval 0))
                     (else
                      (set! rval 1)
                      (Msg (string-append "mTransformData: " iDataXMLFile)))))
              (else
               (set! rval 1)
               (Msg (string-append "mTransformData: " iDataXMLFile))))
        (mWriteTraceLog "stop transforming to OSI")
        (gRemoveTempFiles iDataTransformClass)
        rval)))

Open in new window

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ms="urn:schemas-microsoft-com:xslt"
                xmlns:ISS="urn:my-scripts"
                exclude-result-prefixes="ms ISS">
	<xsl:output method="xml" indent="yes"/>
	<ms:script language="C#" implements-prefix="ISS">
		<ms:using namespace="System.Collections.Generic"/>

	<![CDATA[
	public double CalculateMonthlyIncome(int period, double amount, double weeklyHours, string incType)
  {
    double rval = 0.0;
    if (period == 2080 && (incType == "Base Income" || incType == "Overtime"))
      rval = Math.Round(amount * weeklyHours * 52.0 / 12.0, 2);
    else
      rval = Math.Round(amount * (double) period / 12.0, 2);
    
    return rval;
  }
  
  private Dictionary<string, List<string>> pProcessedKeys = new Dictionary<string, List<string>>();
  
  public void ResetAllProcessedKeys()
  {
    pProcessedKeys.Clear();
  }
  
  public void ResetProcessedKeyList(string name)
  {
    if (pProcessedKeys.ContainsKey(name))
      pProcessedKeys.Remove(name);
  }
  
  public bool HasKeyBeenProcessed(string name, string ldid, string rid)
  {
    bool rval = false;
    List<string> lst;
    if (pProcessedKeys.TryGetValue(name, out lst))
      rval = lst.Contains(ldid + "-" + rid);
    return rval;
  }
  
  public void AddProcessedKey(string name, string ldid, string rid)
  {
    string val = ldid + "-" + rid;
    if (!pProcessedKeys.ContainsKey(name)) {
      List<string> lst = new List<string>();
      lst.Add(val);
      pProcessedKeys.Add(name, lst);
    } 
    else
    {
      List<string> lst;
      pProcessedKeys.TryGetValue(name, out lst);
      if (!lst.Contains(val))
        lst.Add(val);
    }
  }
  
  private Dictionary<string, double> pAccumulatorDictionary = new Dictionary<string, double>();

  public void ResetAccumulators()
  {
      pAccumulatorDictionary.Clear();
  }

  public void ResetAccumulator(string name)
  {
      if (pAccumulatorDictionary.ContainsKey(name))
          pAccumulatorDictionary.Remove(name);
  }

  public void AddValueToAccumulation(string name, double val)
  {
      if (!pAccumulatorDictionary.ContainsKey(name))
          pAccumulatorDictionary.Add(name, val);
      else
      {
          double acc;

          if (pAccumulatorDictionary.TryGetValue(name, out acc)) {
              acc += val;
              pAccumulatorDictionary.Remove(name);
              pAccumulatorDictionary.Add(name, acc);
          }
      }
  }

  public double GetAccumulatedValue(string name)
  {
      double rval = 0.00;

      if (!pAccumulatorDictionary.TryGetValue(name, out rval))
          rval = 0.00;
      return rval;
  }
  
 	public string AddYearsToFormatDate(string pDate, int years)
	{
		if (pDate.Contains("1800-01-01"))
			return "";
		else if (pDate == "")
		  return "";
		else
			return Convert.ToDateTime(pDate).AddYears(years).ToString("s");
	}
	
  ]]>
	</ms:script>

	<xsl:variable name="commercial" select="//setups_businesschannels[channeltype=2]"/>
	<xsl:variable name="consumer" select="//setups_businesschannels[channeltype=3]"/>

	<!--Main Entry Point-->
	<xsl:template match="loandata">
		<loandata>
			<xsl:call-template name="LoanInformation" />
			<xsl:call-template name="LoanFees" />
			<xsl:call-template name="CustomersOnLoan" />
			<xsl:call-template name="CustomersPhoneNumbers" />
			<xsl:call-template name="CustomersPropertyAndAssets" />
			<xsl:call-template name="CustomersDebtsOnLoan" />
			<xsl:call-template name="CustomersEmploymentOnLoan" />
			<xsl:call-template name="EntitiesAndContactsOnLoan" />
		</loandata>
	</xsl:template>

	<xsl:include href="D2ELoanInformation.xslt"/>

	<xsl:include href="D2ELoanFees.xslt"/>

	<xsl:include href="D2ECustomersOnLoan.xslt"/>

	<xsl:include href="D2ECustomersPropertyAndAssets.xslt"/>

	<xsl:include href="D2ECustomersDebtsOnLoan.xslt"/>

	<xsl:include href="D2ECustomersEmploymentOnLoan.xslt"/>

	<xsl:include href="D2EEntitiesAndContactsOnLoan.xslt"/>

	<!-- ******** Generic Functions Commonly Used in the Mapping Process ******** -->

	<xsl:template name="FormatDate">
		<xsl:param name="date"/>
		<xsl:choose>
			<xsl:when test="string-length($date) = 8">
				<xsl:value-of select="concat(substring($date, 1, 4), '-', substring($date, 5, 2), '-', substring($date, 7, 2))"/>
			</xsl:when>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="MapYorNto0or1">
		<xsl:param name="YorN"/>
		<xsl:choose>
			<xsl:when test="$YorN = 'Y'">1</xsl:when>
			<xsl:otherwise>0</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="MapPhoneTypeToPhoneTypeID">
		<xsl:param name="phrec"/>
		<xsl:choose>
			<xsl:when test="$phrec/phonetype = 'Home'">1</xsl:when>
			<xsl:when test="$phrec/phonetype = 'Business'">2</xsl:when>
			<xsl:when test="$phrec/phonetype = 'Business 2'">3</xsl:when>
			<xsl:when test="$phrec/phonetype = 'Mobile'">4</xsl:when>
			<xsl:when test="$phrec/phonetype = 'Fax'">5</xsl:when>
			<xsl:when test="$phrec/phonetype = 'Pager'">6</xsl:when>
			<xsl:when test="$phrec/phonetype = 'Other 1'">7</xsl:when>
			<xsl:when test="$phrec/phonetype = 'Other 2'">8</xsl:when>
			<xsl:otherwise>1</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="MapToCommonPhone">
		<xsl:param name="pid"/>
		<xsl:param name="phrec"/>
		<common_phone>
			<phoneid>
				<xsl:value-of select="$pid"/>
			</phoneid>
			<extension>
				<xsl:value-of select="$phrec/extension"/>
			</extension>
			<phonenumber>
				<xsl:value-of select="$phrec/phonenumber"/>
			</phonenumber>
			<phoneoverride>
				<xsl:value-of select="$phrec/overridephone"/>
			</phoneoverride>
		</common_phone>
	</xsl:template>

	<xsl:template name="MapToCommonAddress">
		<xsl:param name="aid"/>
		<xsl:param name="adrec"/>
		<common_address>
			<addressid>
				<xsl:value-of select="$aid"/>
			</addressid>
			<addressline1>
				<xsl:value-of select="$adrec/addressline1"/>
			</addressline1>
			<addressline2>
				<xsl:value-of select="$adrec/addressline2"/>
			</addressline2>
			<city>
				<xsl:value-of select="$adrec/city"/>
			</city>
			<country>
				<xsl:value-of select="$adrec/country"/>
			</country>
			<county>
				<xsl:value-of select="$adrec/county"/>
			</county>
			<lpcounty>
				<xsl:value-of select="$adrec/lpcounty"/>
			</lpcounty>
			<state>
				<xsl:value-of select="$adrec/state"/>
			</state>
			<zipcode>
				<xsl:value-of select="$adrec/zipcode"/>
			</zipcode>
			<zipcodeoverride>
				<xsl:value-of select="$adrec/zipcodeoverride"/>
			</zipcodeoverride>
		</common_address>
	</xsl:template>

	<xsl:template name="MapToCIF_Entity">
		<xsl:param name="grec"/>
		<xsl:param name="crec"/>
		<xsl:param name="lcrec"/>
		<xsl:param name="LenderIDbyState"/>
		<xsl:variable name="loanclsgen" select="//loan_closinggeneral"/>
		<cif_entity>
			<xsl:if test="name($crec)='customer_main'">
				<entityid>
					<xsl:value-of select="$crec/lenderdatabaseid"/>
					<xsl:text>-</xsl:text>
					<xsl:value-of select="$crec/customerrecordid"/>
				</entityid>
				<companyname>
					<xsl:value-of select="$crec/lastname"/>
				</companyname>
				<xsl:for-each select="//customer_calculations[epictable='cif_entity' and 
											lenderdatabaseid=$crec/lenderdatabaseid and 
											customerrecordid=$crec/customerrecordid]">
					<xsl:element name="{./epiccolumn}">
						<xsl:value-of select="./fieldvalue"/>
					</xsl:element>
				</xsl:for-each>
				<xsl:if test="$crec[typeid='6']">
					<trustdate>
						<xsl:value-of select="$loanclsgen/trustdate"/>
					</trustdate>
					<truststate>
						<xsl:value-of select="$loanclsgen/truststate"/>
					</truststate>
				</xsl:if>
				<authorizedsignerflag>
					<xsl:value-of select="$crec/authorizedsignerflag"/>
				</authorizedsignerflag>
			</xsl:if>
			<xsl:if test="name($crec)='rolodex_entity'">
				<entityid>
					<xsl:text>Entity[</xsl:text>
					<xsl:value-of select="$crec/lenderdatabaseid"/>
					<xsl:text>-</xsl:text>
					<xsl:value-of select="$crec/entityid"/>
					<xsl:text>]</xsl:text>
				</entityid>
				<availablebegintime>
					<xsl:value-of select="$crec/serviceravailabletime1"/>
				</availablebegintime>
				<availabledays>
					<xsl:value-of select="$crec/serviceravailabledays"/>
				</availabledays>
				<availableendtime>
					<xsl:value-of select="$crec/serviceravailabletime2"/>
				</availableendtime>
				<xsl:variable name="servrec" select="//rolodex_entityservicing[lenderdatabaseid=$crec/lenderdatabaseid and entityid=$crec/entityid]"/>
				<firstlienpercent>
					<xsl:value-of select="$servrec/firstlienpercent"/>
				</firstlienpercent>
				<mortgageservicing>
					<xsl:value-of select="$servrec/mortgageservicing"/>
				</mortgageservicing>
				<sellretainassign>
					<xsl:value-of select="$servrec/sellretainassign"/>
				</sellretainassign>
				<servicestatusa>
					<xsl:value-of select="$servrec/servicestatusa"/>
				</servicestatusa>
				<servicestatusb1>
					<xsl:value-of select="$servrec/servicestatusb1"/>
				</servicestatusb1>
				<servicestatusb2>
					<xsl:value-of select="$servrec/servicestatusb2"/>
				</servicestatusb2>
				<servicestatusb3>
					<xsl:value-of select="$servrec/servicestatusb3"/>
				</servicestatusb3>
				<servicingloanper1>
					<xsl:value-of select="$servrec/loanper1"/>
				</servicingloanper1>
				<servicingloanper2>
					<xsl:value-of select="$servrec/loanper2"/>
				</servicingloanper2>
				<servicingloanper3>
					<xsl:value-of select="$servrec/loanper3"/>
				</servicingloanper3>
				<servicingpreviouslyassigned>
					<xsl:value-of select="$servrec/previouslyassigned"/>
				</servicingpreviouslyassigned>
				<servicingthisestimate>
					<xsl:value-of select="$servrec/thisestimate"/>
				</servicingthisestimate>
				<servicingthisinfo>
					<xsl:value-of select="$servrec/thisinfo"/>
				</servicingthisinfo>
				<servicingwemayassign>
					<xsl:value-of select="$servrec/wemayassignnew"/>
				</servicingwemayassign>
				<servicingyear1>
					<xsl:value-of select="$servrec/year1"/>
				</servicingyear1>
				<servicingyear2>
					<xsl:value-of select="$servrec/year2"/>
				</servicingyear2>
				<servicingyear3>
					<xsl:value-of select="$servrec/year3"/>
				</servicingyear3>
				<docincludeinitialssec>1</docincludeinitialssec>
				<!-- Needed to drop initials line on docs -->
				<companyname>
					<xsl:value-of select="$crec/name"/>
				</companyname>
				<servicingwewillselltran>
					<xsl:value-of select="$servrec/assignselltransfernew"/>
				</servicingwewillselltran>
				<servicingwewillservice>
					<xsl:value-of select="$servrec/mortgageservicingnew"/>
				</servicingwewillservice>
				<waivejurytrialflag>
					<xsl:value-of select="$crec/waivejurytrialflag"/>
				</waivejurytrialflag>
			</xsl:if>
			<xsl:if test="name($crec)='rolodex_contacts'">
				<entityid>
					<xsl:text>Contact[</xsl:text>
					<xsl:value-of select="$crec/contactlenderdatabaseid"/>
					<xsl:text>-</xsl:text>
					<xsl:value-of select="$crec/contactid"/>
					<xsl:text>]</xsl:text>
				</entityid>
				<companyname>
					<xsl:value-of select="$crec/name"/>
				</companyname>
			</xsl:if>
			<xsl:if test="name($crec)='property_seller'">
				<entityid>
					<xsl:value-of select="$crec/sellerdatabaseid"/>
					<xsl:text>-</xsl:text>
					<xsl:value-of select="$crec/sellerrecordid"/>
				</entityid>
				<companyname>
					<xsl:value-of select="$crec/companyname"/>
				</companyname>
				<powerofattorney>
					<xsl:value-of select="$crec/powerofattorney"/>
				</powerofattorney>
			</xsl:if>
			<xsl:choose>
				<xsl:when test="$grec/associationid='3'">
					<!-- Notary Information -->
					<xsl:choose>
						<xsl:when test="string-length($lcrec/notaryfirstname) &gt; 0">
							<firstname>
								<xsl:value-of select="$lcrec/notaryfirstname"/>
							</firstname>
						</xsl:when>
						<xsl:otherwise>
							<firstname>
								<xsl:value-of select="$crec/firstname"/>
							</firstname>
						</xsl:otherwise>
					</xsl:choose>
					<xsl:choose>
						<xsl:when test="string-length($lcrec/notarymiddlename) &gt; 0">
							<middlename>
								<xsl:value-of select="$lcrec/notarymiddlename"/>
							</middlename>
						</xsl:when>
						<xsl:otherwise>
							<middlename>
								<xsl:value-of select="$crec/middlename"/>
							</middlename>
						</xsl:otherwise>
					</xsl:choose>
					<xsl:choose>
						<xsl:when test="string-length($lcrec/notarylastname) &gt; 0">
							<lastname>
								<xsl:value-of select="$lcrec/notarylastname"/>
							</lastname>
						</xsl:when>
						<xsl:otherwise>
							<lastname>
								<xsl:value-of select="$crec/lastname"/>
							</lastname>
						</xsl:otherwise>
					</xsl:choose>
					<xsl:choose>
						<xsl:when test="string-length($lcrec/notarysuffixname) &gt; 0">
							<suffixname>
								<xsl:value-of select="$lcrec/notarysuffixname"/>
							</suffixname>
						</xsl:when>
						<xsl:otherwise>
							<suffixname>
								<xsl:value-of select="$crec/suffixname"/>
							</suffixname>
						</xsl:otherwise>
					</xsl:choose>
					<notarycommissionexpires>
						<xsl:value-of select="$lcrec/notarycommexp"/>
					</notarycommissionexpires>
				</xsl:when>
				<xsl:when test="name($crec)='rolodex_entity'">
					<xsl:variable name="servicercontact" select="//loan_channelcontacts[entitylenderdatabaseid=$crec/lenderdatabaseid and
                                                          entityid=$crec/entityid and
                                                          associationid=34]"/>
					<xsl:variable name="buildercontact" select="//loan_channelcontacts[entitylenderdatabaseid=$crec/lenderdatabaseid and
                                                          entityid=$crec/entityid and
                                                          associationid=14]"/>
					<xsl:choose>
						<xsl:when test="$servicercontact">
							<xsl:variable name="servicer" select="//rolodex_contacts[contactlenderdatabaseid=$servicercontact/contactlenderdatabaseid and
												contactid=$servicercontact/contactid]"/>
							<firstname>
								<xsl:value-of select="$servicer/firstname"/>
							</firstname>
							<lastname>
								<xsl:value-of select="$servicer/lastname"/>
							</lastname>
						</xsl:when>
						<xsl:when test="$buildercontact">
							<xsl:variable name="builder" select="//rolodex_contacts[contactlenderdatabaseid=$buildercontact/contactlenderdatabaseid]
														[contactid=$buildercontact/contactid]"/>
							<firstname>
								<xsl:value-of select="$builder/firstname"/>
							</firstname>
							<lastname>
								<xsl:value-of select="$builder/lastname"/>
							</lastname>
						</xsl:when>
						<xsl:otherwise>
							<firstname>
								<xsl:value-of select="$crec/firstname"/>
							</firstname>
							<middlename>
								<xsl:value-of select="$crec/middlename"/>
							</middlename>
							<lastname>
								<xsl:value-of select="$crec/lastname"/>
							</lastname>
							<suffixname>
								<xsl:value-of select="$crec/suffixname"/>
							</suffixname>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<firstname>
						<xsl:value-of select="$crec/firstname"/>
					</firstname>
					<middlename>
						<xsl:value-of select="$crec/middlename"/>
					</middlename>
					<lastname>
						<xsl:value-of select="$crec/lastname"/>
					</lastname>
					<suffixname>
						<xsl:value-of select="$crec/suffixname"/>
					</suffixname>
				</xsl:otherwise>
			</xsl:choose>
			<citizenship>
				<xsl:value-of select="$crec/citizenship"/>
			</citizenship>
			<entitydescid>
				<!-- *** Rolodex from Destiny *** -->
			</entitydescid>
			<entitystatusid>
				<xsl:value-of select="$crec/statusid"/>
			</entitystatusid>
			<xsl:choose>
				<xsl:when test="name($crec)='rolodex_entity'">
					<entitytypeid>
					<xsl:choose>
						<xsl:when test="$crec/businesstype = 'Corporation'">8</xsl:when>
						<xsl:when test="$crec/businesstype = 'Partnership'">3</xsl:when>
						<xsl:when test="$crec/businesstype = 'Sole Proprietership'">2</xsl:when>
						<xsl:when test="$crec/businesstype = 'LLC'">6</xsl:when>
					</xsl:choose>
					</entitytypeid>
				</xsl:when>
				<xsl:otherwise>
					<entitytypeid>
						<xsl:value-of select="$crec/typeid"/>
					</entitytypeid>
				</xsl:otherwise>
			</xsl:choose>
			<!--<defaultchannelid>
				--><!-- *** Security_Users from Destiny *** --><!--
			</defaultchannelid>
			<defaultcreditserverid>
				--><!-- *** Security_Users from Destiny *** --><!--
			</defaultcreditserverid>
			<defaultfloodserverid>
				--><!-- *** Security_Users from Destiny *** --><!--
			</defaultfloodserverid>
			<defaultloanstatusid>
				--><!-- *** Security_Users from Destiny *** --><!--
			</defaultloanstatusid>
			<defaultregionid>
				--><!-- *** N/A from Destiny *** --><!--
			</defaultregionid>
			<hmdapurchasertypeid>
				--><!-- *** Rolodex from Destiny *** --><!--
			</hmdapurchasertypeid>
			<hmdaregulatoryagencyid>
				--><!-- *** review *** --><!--
			</hmdaregulatoryagencyid>-->
			<xsl:if test="$grec/joinedlenderid &gt; 0 and $grec/joinedcustomerid &gt; 0">
				<joinedentityid>
					<xsl:value-of select="$grec/joinedlenderid"/>
					<xsl:text>-</xsl:text>
					<xsl:value-of select="$grec/joinedcustomerid"/>
				</joinedentityid>
			</xsl:if>
			<!--<lastcreditserverid>
				--><!-- *** review *** --><!--
			</lastcreditserverid>
			<loanapprovaldeliveryid>
				--><!-- *** review *** --><!--
			</loanapprovaldeliveryid>
			<lockconfdeliveryid>
				--><!-- *** review *** --><!--
			</lockconfdeliveryid>-->
			<maritalstatus>
				<xsl:choose>
					<xsl:when test="$crec/maritalstatus='Single'">Unmarried</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$crec/maritalstatus"/>
					</xsl:otherwise>
				</xsl:choose>
			</maritalstatus>
			<merstypeid>
				<!-- *** review *** -->
			</merstypeid>
			<micodeid>
				<xsl:value-of select="$crec/micode"/>
			</micodeid>
			<!--<prevapplieddataaddrid>
				--><!-- *** review *** --><!--
			</prevapplieddataaddrid>
			<prevreceivedaddrid>
				--><!-- *** review *** --><!--
			</prevreceivedaddrid>
			<ratesheetdeliveryid>
				--><!-- *** review *** --><!--
			</ratesheetdeliveryid>-->
			<xsl:variable name="vetrelative" select="//customer_vadetail[customerrecordid=$crec/customerrecordid and
													lenderdatabaseid=$crec/lenderdatabaseid]/relativenotlivingwithveteran"/>
			<relativeaddressid>
				<xsl:if test="string-length($vetrelative) &gt; 0">
					<xsl:text>GENERATE[VeteranRelativeAddress-</xsl:text>
					<xsl:value-of select="$crec/lenderdatabaseid"/>
					<xsl:text>-</xsl:text>
					<xsl:value-of select="$crec/customerrecordid"/>
					<xsl:text>]</xsl:text>
				</xsl:if>
			</relativeaddressid>
			<relativephoneid>
				<xsl:if test="string-length($vetrelative) &gt; 0">
					<xsl:text>GENERATE[VeteranRelativePhone-</xsl:text>
					<xsl:value-of select="$crec/lenderdatabaseid"/>
					<xsl:text>-</xsl:text>
					<xsl:value-of select="$crec/customerrecordid"/>
					<xsl:text>]</xsl:text>
				</xsl:if>
			</relativephoneid>
			<!--<accountcreation>
				--><!-- *** review *** --><!--
			</accountcreation>
			<accountingrating>
				--><!-- *** review *** --><!--
			</accountingrating>
			<accountlockedout>
				--><!-- *** review *** --><!--
			</accountlockedout>
			<activationtoduty>
				--><!-- *** review *** --><!--
			</activationtoduty>-->
			<activefollowseparation>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="//customer_vadetail[customerrecordid=$crec/customerrecordid and
													lenderdatabaseid=$crec/lenderdatabaseid]/activefollowingseparation"/>
				</xsl:call-template>
			</activefollowseparation>
			<age>
				<xsl:value-of select="$crec/age"/>
			</age>
			<!--<agreementdate>
				--><!-- *** review *** --><!--
			</agreementdate>-->
			<alsoknownas>
				<xsl:value-of select="$crec/alsoknownas"/>
			</alsoknownas>
			<!--<appliedforeligibility>
				--><!-- *** review *** --><!--
			</appliedforeligibility>
			<approvalcode>
				--><!-- *** review *** --><!--
			</approvalcode>-->
			<arson>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/arson"/>
				</xsl:call-template>
			</arson>
			<!--<assetsadequacyrating>
				--><!-- *** review *** --><!--
			</assetsadequacyrating>
			<assetwisepassword>
				--><!-- *** review *** --><!--
			</assetwisepassword>
			<assetwiseuseridnum>
				--><!-- *** review *** --><!--
			</assetwiseuseridnum>
			<assignselltransfer>
				--><!-- *** review *** --><!--
			</assignselltransfer>
			<authorizationdate>
				--><!-- *** review *** --><!--
			</authorizationdate>
			<autorireduction>
				--><!-- *** review *** --><!--
			</autorireduction>
			<bestcontactmethod>
				--><!-- *** review *** --><!--
			</bestcontactmethod>
			<bestcontactphone>
				--><!-- *** review *** --><!--
			</bestcontactphone>
			<bestcontacttime>
				--><!-- *** review *** --><!--
			</bestcontacttime>-->
			<birthday>
				<xsl:value-of select="$crec/birthday"/>
			</birthday>
			<caivrsnumber>
				<xsl:value-of select="$crec/caivrsnumber"/>
			</caivrsnumber>
			<chumsidnum>
				<xsl:value-of select="$crec/chumsid"/>
			</chumsidnum>
			<comaker>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/comaker"/>
				</xsl:call-template>
			</comaker>
			<commenttxt>
				<xsl:value-of select="$crec/commentid"/>
			</commenttxt>
			<complianceeasepassword>
				<xsl:value-of select="$crec/complianceeasepassword"/>
			</complianceeasepassword>
			<complianceeaseuseridnum>
				<xsl:value-of select="$crec/complianceeaseuserid"/>
			</complianceeaseuseridnum>
			<correspondviaemail>
				<xsl:value-of select="$crec/correspondviaemail"/>
			</correspondviaemail>
			<!--<costcenter>
				--><!-- *** review *** --><!--
			</costcenter>
			<creditapprovalcompletiondays>
				--><!-- *** review *** --><!--
			</creditapprovalcompletiondays>-->
			<creditcharacterrating>
				<xsl:value-of select="$crec/creditcharacterrating"/>
			</creditcharacterrating>
			<creditreferencenumber>
				<xsl:value-of select="$crec/creditreferencenumber"/>
			</creditreferencenumber>
			<currentotherfinancing>
				<xsl:value-of select="$crec/currentotherfinancing"/>
			</currentotherfinancing>
			<currentpipayment>
				<xsl:value-of select="$crec/currentpipayment"/>
			</currentpipayment>
			<!--<dateofbankruptcy>
				--><!-- *** review *** --><!--
			</dateofbankruptcy>
			<dateofdischarge>
				--><!-- *** review *** --><!--
			</dateofdischarge>
			<dateoffinancials>
				--><!-- *** review *** --><!--
			</dateoffinancials>-->
			<dateofforeclosure>
				<xsl:value-of select="$crec/dateofforeclosure"/>
			</dateofforeclosure>
			<declaredbankrupt>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/declaredbankrupt"/>
				</xsl:call-template>
			</declaredbankrupt>
			<denumber>
				<xsl:value-of select="$crec/hud_number"/>
			</denumber>
			<dependents>
				<xsl:value-of select="$crec/dependents"/>
			</dependents>
			<!--<directendorsement>
				--><!-- *** review *** --><!--
			</directendorsement>
			<disalloweditflag>
				--><!-- *** review *** --><!--
			</disalloweditflag>
			<docmagicidnum>
				--><!-- *** review *** --><!--
			</docmagicidnum>-->
			<docmagicpwd>
				<xsl:value-of select="$crec/docmagicpwd"/>
			</docmagicpwd>
			<doesnotwishtofurnish>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/doesnotwishtofurnish"/>
				</xsl:call-template>
			</doesnotwishtofurnish>
			<!--<ediapplicationcode>
				--><!-- *** review *** --><!--
			</ediapplicationcode>
			<ediassociatedaccountnumber>
				--><!-- *** review *** --><!--
			</ediassociatedaccountnumber>
			<ediinterchangeidnum>
				--><!-- *** review *** --><!--
			</ediinterchangeidnum>
			<edivendoridnumber>
				--><!-- *** review *** --><!--
			</edivendoridnumber>
			<eligibilityenclosed>
				--><!-- *** review *** --><!--
			</eligibilityenclosed>
			<eligibilityloststolen>
				--><!-- *** review *** --><!--
			</eligibilityloststolen>-->
			<emailaddress>
				<xsl:choose>
					<xsl:when test="name($crec)='customer_main'">
						<xsl:value-of select="$crec/email"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$crec/emailaddress"/>
					</xsl:otherwise>
				</xsl:choose>
			</emailaddress>
			<emailhost>
				<xsl:value-of select="$crec/emailhost"/>
			</emailhost>
			<!--<entityisacompany>
				--><!-- *** review *** --><!--
			</entityisacompany>
			<entityorder>
				--><!-- *** review *** --><!--
			</entityorder>
			<eoiamount>
				--><!-- *** review *** --><!--
			</eoiamount>
			<eoiapprovaldate>
				--><!-- *** review *** --><!--
			</eoiapprovaldate>
			<eoiexpirationdate>
				--><!-- *** review *** --><!--
			</eoiexpirationdate>-->
			<ethnicityhispanic>
				<xsl:value-of select="$crec/ethnicityhispanic"/>
			</ethnicityhispanic>
			<!--<exemptfromfundingfee>
				--><!-- *** review *** --><!--
			</exemptfromfundingfee>-->
			<federallyregulatedflag>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/federallyregulatedflag"/>
				</xsl:call-template>
			</federallyregulatedflag>
			<!--<fhaapplicationdate>
				--><!-- *** review *** --><!--
			</fhaapplicationdate>
			<fhaapproval>
				--><!-- *** review *** --><!--
			</fhaapproval>
			<fhaapprovaldate>
				--><!-- *** review *** --><!--
			</fhaapprovaldate>
			<fhaexpirationdate>
				--><!-- *** review *** --><!--
			</fhaexpirationdate>-->
			<fhalenderidnum>
				<xsl:choose>
					<xsl:when test ="$LenderIDbyState">
						<xsl:value-of select="$LenderIDbyState"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$crec/fhalenderid"/>
					</xsl:otherwise>
				</xsl:choose>
			</fhalenderidnum>
			<fhalicensenumber>
				<xsl:value-of select="$crec/fhalicensenumber"/>
			</fhalicensenumber>
			<fhasponsoridnum>
				<xsl:value-of select="$crec/fhasponsorid"/>
			</fhasponsoridnum>
			<!--<fhlmcapproval>
				--><!-- *** review *** --><!--
			</fhlmcapproval>
			<fidelitybankcode>
				--><!-- *** review *** --><!--
			</fidelitybankcode>
			<financialrating>
				--><!-- *** review *** --><!--
			</financialrating>-->
			<firstpioverrideflag>
				<xsl:value-of select="$crec/firstpioverrideflag"/>
			</firstpioverrideflag>
			<!--<fnmaapproval>
				--><!-- *** review *** --><!--
			</fnmaapproval>
			<gnmaapproval>
				--><!-- *** review *** --><!--
			</gnmaapproval>-->
			<gsadate>
				<xsl:value-of select="$crec/gsa_date"/>
			</gsadate>
			<gsapagenumber>
				<xsl:value-of select="$crec/gsa_pagenumber"/>
			</gsapagenumber>
			<!--<guardiancustno>
				--><!-- *** review *** --><!--
			</guardiancustno>-->
			<guardianpassword>
				<xsl:value-of select="$crec/guardianpassword"/>
			</guardianpassword>
			<!--<guardiansiteidnum>
				--><!-- *** review *** --><!--
			</guardiansiteidnum>
			<guardianuseridnum>
				--><!-- *** review *** --><!--
			</guardianuseridnum>-->
			<hasindebtedness>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="//customer_vadetail[customerrecordid=$crec/customerrecordid and
													lenderdatabaseid=$crec/lenderdatabaseid]/hasindebtedness"/>
				</xsl:call-template>
			</hasindebtedness>
			<!--<hmdareferencenumber>
				--><!-- *** review *** --><!--
			</hmdareferencenumber>
			<hmdarespondentidnum>
				--><!-- *** review *** --><!--
			</hmdarespondentidnum>
			<hmdataxidnumber>
				--><!-- *** review *** --><!--
			</hmdataxidnumber>
			<hmdatransmittercontrolcode>
				--><!-- *** review *** --><!--
			</hmdatransmittercontrolcode>
			<hudapproval>
				--><!-- *** review *** --><!--
			</hudapproval>-->
			<idexpires>
				<xsl:value-of select="$crec/idexpires"/>
			</idexpires>
			<idissued>
				<xsl:value-of select="$crec/idissued"/>
			</idissued>
			<idissuedby>
				<xsl:value-of select="$crec/idissuedby"/>
			</idissuedby>
			<idnumber>
				<xsl:value-of select="$crec/idnumber"/>
			</idnumber>
			<!--<idsdocsidnum>
				--><!-- *** review *** --><!--
			</idsdocsidnum>-->
			<idtype>
				<xsl:value-of select="$crec/idtype"/>
			</idtype>
			<!--<impoundsglaccount>
				--><!-- *** review *** --><!--
			</impoundsglaccount>-->
			<inactiveflag>
				<xsl:value-of select="$crec/inactiveflag"/>
			</inactiveflag>
			<incomeadequacyrating>
				<xsl:value-of select="$crec/incomeadequacyrating"/>
			</incomeadequacyrating>
			<incomestabilityrating>
				<xsl:value-of select="$crec/incomestabilityratinf"/>
			</incomestabilityrating>
			<inetauthorizecredit>
				<xsl:value-of select="$crec/inetauthorizecredit"/>
			</inetauthorizecredit>
			<!--<interestincomeglaccount>
				--><!-- *** review *** --><!--
			</interestincomeglaccount>-->
			<interviewtype>
				<xsl:value-of select="$crec/interviewtype"/>
			</interviewtype>
			<!--<laserprocapacitylink>
				--><!-- *** review *** --><!--
			</laserprocapacitylink>-->
			<lastpwchange>
				<xsl:value-of select="$crec/lastpwchange"/>
			</lastpwchange>
			<ldpgsadate>
				<xsl:value-of select="$crec/ldp_gsa_date"/>
			</ldpgsadate>
			<ldpgsadate2>
				<xsl:value-of select="$crec/ldp_gsa_date2"/>
			</ldpgsadate2>
			<ldpgsapagenumber>
				<xsl:value-of select="$crec/ldp_gsa_pagenumber"/>
			</ldpgsapagenumber>
			<ldpgsapagenumber2>
				<xsl:value-of select="$crec/ldp_gsa_pagenumber2"/>
			</ldpgsapagenumber2>
			<!--<leadreturndays>
				--><!-- *** review *** --><!--
			</leadreturndays>
			<leadreturnhours>
				--><!-- *** review *** --><!--
			</leadreturnhours>
			<leadreturnminutes>
				--><!-- *** review *** --><!--
			</leadreturnminutes>-->
			<leaduser>
				<xsl:value-of select="$crec/leaduser"/>
			</leaduser>
			<legalentity>
				<xsl:value-of select="$crec/legalentity"/>
			</legalentity>
			<licensedunderlawsofstate>
			<xsl:choose>
				<xsl:when test="name($crec)='rolodex_entity'">
					<xsl:value-of select="$crec/licensedunderlawsofstate"/>
				</xsl:when>
				<xsl:when test="name($crec)='customer_main'">
					<xsl:value-of select="$crec/statebusinessregistered"/>
				</xsl:when>
			</xsl:choose>
			</licensedunderlawsofstate>
			<licensedunderwhatlaw>
				<xsl:value-of select="$crec/licensedunderwhatlaw"/>
			</licensedunderwhatlaw>
			<!--<loansheldglaccount>
				--><!-- *** review *** --><!--
			</loansheldglaccount>-->
			<longalias>
				<xsl:value-of select="$crec/alias1"/>
			</longalias>
			<!--<lpcompany>
				--><!-- *** review *** --><!--
			</lpcompany>
			<lpcreditreferencenumber>
				--><!-- *** review *** --><!--
			</lpcreditreferencenumber>
			<lpfhlmcfield1>
				--><!-- *** review *** --><!--
			</lpfhlmcfield1>
			<lpfhlmcfield2>
				--><!-- *** review *** --><!--
			</lpfhlmcfield2>-->
			<lppassword>
				<xsl:value-of select="$crec/lppassword"/>
			</lppassword>
			<!--<lpuseridnum>
				--><!-- *** review *** --><!--
			</lpuseridnum>
			<masterapprovaldate>
				--><!-- *** review *** --><!--
			</masterapprovaldate>
			<masterexpirationdate>
				--><!-- *** review *** --><!--
			</masterexpirationdate>-->
			<masterlicensenumber>
				<xsl:value-of select="$crec/licensenumber"/>
			</masterlicensenumber>
			<!--<memberofnationalguard>
				--><!-- *** review *** --><!--
			</memberofnationalguard>
			<memberofreserves>
				--><!-- *** review *** --><!--
			</memberofreserves>
			<mersidnumber>
				--><!-- *** review *** --><!--
			</mersidnumber>
			<miscfeesglaccount>
				--><!-- *** review *** --><!--
			</miscfeesglaccount>
			<mobilizationactiveduty>
				--><!-- *** review *** --><!--
			</mobilizationactiveduty>
			<naicnum>
				--><!-- *** review *** --><!--
			</naicnum>
			<notaryfees>
				--><!-- *** review *** --><!--
			</notaryfees>-->
			<numberfamilymembers>
				<xsl:value-of select="$crec/numberfamilymembers"/>
			</numberfamilymembers>
			<numberofdependents>
				<xsl:value-of select="$crec/numberofdependents"/>
			</numberofdependents>
			<obligatedonanyloan>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/obligatedonanyloan"/>
				</xsl:call-template>
			</obligatedonanyloan>
			<obligatedtopayalimony>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/obligatedtopayalimony"/>
				</xsl:call-template>
			</obligatedtopayalimony>
			<onactivemilitaryduty>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="//customer_vadetail[customerrecordid=$crec/customerrecordid and
													lenderdatabaseid=$crec/lenderdatabaseid]/onactivemilitaryduty"/>
				</xsl:call-template>
			</onactivemilitaryduty>
			<!--<onlinedocidnum>
				--><!-- *** review *** --><!--
			</onlinedocidnum>
			<onlinedocscustcode>
				--><!-- *** review *** --><!--
			</onlinedocscustcode>-->
			<onlinedocspassword>
				<xsl:value-of select="$crec/onlinedocspassword"/>
			</onlinedocspassword>
			<!--<optionalfootnoteflag>
				--><!-- *** review *** --><!--
			</optionalfootnoteflag>
			<otherpioverrideflag>
				--><!-- *** review *** --><!--
			</otherpioverrideflag>
			<otherrace>
				--><!-- *** review *** --><!--
			</otherrace>-->
			<outstandingjudgements>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/outstandingjudgements"/>
				</xsl:call-template>
			</outstandingjudgements>
			<!--<packagerecvdate>
				--><!-- *** review *** --><!--
			</packagerecvdate>-->
			<partytolawsuit>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/partytolawsuit"/>
				</xsl:call-template>
			</partytolawsuit>
			<!--<passwordexpiration>
				--><!-- *** review *** --><!--
			</passwordexpiration>
			<poadate>
				--><!-- *** review *** --><!--
			</poadate>
			<prefixname>
				--><!-- *** review *** --><!--
			</prefixname>-->
			<presentlydelinquent>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/presentlydelinquent"/>
				</xsl:call-template>
			</presentlydelinquent>
			<presentlydelinquenttxt>
				<!--<xsl:value-of select="//customer_calculationsxml[lenderdatabaseid=$crec/lenderdatabaseid and
											customerrecordid=$crec/customerrecordid and
											epictable='cif_entity' and epiccolumn='presentlydelinquenttxt']/fieldvalue"/>-->
				<xsl:for-each select="//variabletext[vartextid=$crec/presentlydelinquentid]">
					<xsl:sort select="vartextcount"/>
					<xsl:value-of select="./vartext"/>
				</xsl:for-each>
			</presentlydelinquenttxt>
			<!--<profilereferenceidnum>
				--><!-- *** review *** --><!--
			</profilereferenceidnum>
			<propertyacquiredthrugi>
				--><!-- *** review *** --><!--
			</propertyacquiredthrugi>-->
			<propertyforeclosed>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/propertyforeclosed"/>
				</xsl:call-template>
			</propertyforeclosed>
			<propertyforeclosedlast5yrs>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/propertyforeclosedlast5years"/>
				</xsl:call-template>
			</propertyforeclosedlast5yrs>
			<propertyforeclosedlast5yrstxt>
				<!--<xsl:value-of select="//customer_calculationsxml[lenderdatabaseid=$crec/lenderdatabaseid and
											customerrecordid=$crec/customerrecordid and
											epictable='cif_entity' and epiccolumn='propertyforeclosedlast5yrstxt']/fieldvalue"/>-->
				<xsl:for-each select="//variabletext[vartextid=$crec/propertyforeclosedlast5yrsid]">
					<xsl:sort select="vartextcount"/>
					<xsl:value-of select="./vartext"/>
				</xsl:for-each>
			</propertyforeclosedlast5yrstxt>
			<raceasian>
				<xsl:value-of select="$crec/raceasian"/>
			</raceasian>
			<raceblack>
				<xsl:value-of select="$crec/raceblack"/>
			</raceblack>
			<racenative>
				<xsl:value-of select="$crec/racenative"/>
			</racenative>
			<racepacificislander>
				<xsl:value-of select="$crec/racepacificislander"/>
			</racepacificislander>
			<racewhite>
				<xsl:value-of select="$crec/racewhite"/>
			</racewhite>
			<!--<receivedeligibility>
				--><!-- *** review *** --><!--
			</receivedeligibility>-->
			<!--$vetrelative variable defined above-->
			<relativenotlivingwithveteran>
				<xsl:value-of select="$vetrelative"/>
			</relativenotlivingwithveteran>
			<!--<releasedate>
				--><!-- *** review *** --><!--
			</releasedate>
			<retiredfromduty>
				--><!-- *** review *** --><!--
			</retiredfromduty>
			<sellerno>
				--><!-- *** review *** --><!--
			</sellerno>-->
			<sex>
				<xsl:value-of select="$crec/sex"/>
			</sex>
			<shortalias>
				<xsl:value-of select="$crec/alias2"/>
			</shortalias>
			<signaturedesc>
				<xsl:value-of select="$crec/signaturedescription"/>
			</signaturedesc>
			<!--<srpglaccount>
				--><!-- *** review *** --><!--
			</srpglaccount>-->
			<svcconnecteddisability>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="//customer_vadetail[customerrecordid=$crec/customerrecordid and
													lenderdatabaseid=$crec/lenderdatabaseid]/serviceconnecteddisabilities"/>
				</xsl:call-template>
			</svcconnecteddisability>
			<!--<systemuser>
				--><!-- *** review *** --><!--
			</systemuser>-->
			<taxidnumber>
				<xsl:value-of select="$crec/ssnumber"/>
			</taxidnumber>
			<totalassets>
				<xsl:value-of select="$crec/totalassets"/>
			</totalassets>
			<!--<totalbaseincome>
				--><!-- *** review *** --><!--
			</totalbaseincome>
			<totalbonusincome>
				--><!-- *** review *** --><!--
			</totalbonusincome>
			<totalcommisionincome>
				--><!-- *** review *** --><!--
			</totalcommisionincome>-->
			<totaldebts>
				<xsl:value-of select="$crec/totaldebts"/>
			</totaldebts>
			<!--<totaldividendincome>
				--><!-- *** review *** --><!--
			</totaldividendincome>-->
			<totalincome>
				<xsl:value-of select="$crec/totalincome"/>
			</totalincome>
			<totalliquidassets>
				<xsl:value-of select="$crec/totalliquidassets"/>
			</totalliquidassets>
			<totalnetrentalincome>
				<xsl:value-of select="$crec/totalnetrentalincome"/>
			</totalnetrentalincome>
			<!--<totalovertimeincome>
				--><!-- *** review *** --><!--
			</totalovertimeincome>-->
			<jobtitle>
				<xsl:value-of select="$crec/title"/>
			</jobtitle>
			<!--<vaapproval>
				--><!-- *** review *** --><!--
			</vaapproval>
			<vaapprovaldate>
				--><!-- *** review *** --><!--
			</vaapprovaldate>
			<vaautomatic>
				--><!-- *** review *** --><!--
			</vaautomatic>-->
			<vaclaimfoldernumber>
				<xsl:value-of select="//customer_vadetail[lenderdatabaseid=$crec/lenderdatabaseid and
											customerrecordid=$crec/customerrecordid]/vaclaimfoldernumber"/>
			</vaclaimfoldernumber>
			<!--<vaexpirationdate>
				--><!-- *** review *** --><!--
			</vaexpirationdate>-->
			<valicensenumber>
				<xsl:value-of select="$crec/valicensenumber"/>
			</valicensenumber>
			<!--<vanum>
				--><!-- *** review *** --><!--
			</vanum>-->
			<vesting>
				<xsl:value-of select="$crec/vesting"/>
			</vesting>
			<veteran>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$crec/veteran"/>
				</xsl:call-template>
			</veteran>
			<!--<vmppassword>
				--><!-- *** review *** --><!--
			</vmppassword>
			<vmpuseridnum>
				--><!-- *** review *** --><!--
			</vmpuseridnum>
			<volumethreshold>
				--><!-- *** review *** --><!--
			</volumethreshold>
			<watchliststatus>
				--><!-- *** review *** --><!--
			</watchliststatus>
			<wireabanumber>
				--><!-- *** review *** --><!--
			</wireabanumber>
			<wireaccountname>
				--><!-- *** review *** --><!--
			</wireaccountname>
			<wireaccountnumber>
				--><!-- *** review *** --><!--
			</wireaccountnumber>
			<wireadditionalinfo>
				--><!-- *** review *** --><!--
			</wireadditionalinfo>
			<wirerecvbankcity>
				--><!-- *** review *** --><!--
			</wirerecvbankcity>
			<wirerecvbankname>
				--><!-- *** review *** --><!--
			</wirerecvbankname>
			<whfeesglaccount>
				--><!-- *** review *** --><!--
			</whfeesglaccount>
			<whintaccrglaccount>
				--><!-- *** review *** --><!--
			</whintaccrglaccount>-->
			<yearsinprofession>
				<xsl:value-of select="$crec/yearsinprofession"/>
			</yearsinprofession>
			<yearsofschool>
				<xsl:value-of select="$crec/yearsofschool"/>
			</yearsofschool>
			<!--<yearsselfemployed>
				--><!-- *** review *** --><!--
			</yearsselfemployed>
			<yspglaccount>
				--><!-- *** review *** --><!--
			</yspglaccount>-->
			<trusteeflag>
				<xsl:value-of select="$crec/trusteeflag"/>
			</trusteeflag>
			<beneficiaryflag>
				<xsl:value-of select="$crec/beneficiaryflag"/>
			</beneficiaryflag>
			<settlorflag>
				<xsl:value-of select="$crec/settlorflag"/>
			</settlorflag>
			<resolutiononfileflag>
				<xsl:value-of select="$crec/resolutiononfileflag"/>
			</resolutiononfileflag>
			<cdmaturitydate>
				<xsl:value-of select="$crec/cdmaturitydate"/>
			</cdmaturitydate>
			<cdrate>
				<xsl:value-of select="$crec/cdrate"/>
			</cdrate>
			<typeofbusiness>
				<xsl:value-of select="$crec/typeofbusiness"/>
			</typeofbusiness>
			<licensedunderlawofcity>
				<xsl:value-of select="$crec/citybusinessregistered"/>
			</licensedunderlawofcity>
			<datebusinessestablished>
				<xsl:value-of select="$crec/datebusinessestablished"/>
			</datebusinessestablished>
			<businessnonprofitflag>
				<xsl:value-of select="$crec/businessnonprofitflag"/>
			</businessnonprofitflag>
			<corporatesealflag>
				<xsl:value-of select="$crec/corporatesealflag"/>
			</corporatesealflag>
			<pllcflag>
				<xsl:value-of select="$crec/pllcflag"/>
			</pllcflag>
			<llcownershiptypeid>
				<xsl:value-of select="$crec/llcownershiptypeid"/>
			</llcownershiptypeid>
			<dateofresolution>
				<xsl:value-of select="$crec/dateofresolution"/>
			</dateofresolution>
			<dateofresolutionauthorization>
				<xsl:value-of select="$crec/dateofresolutionauthorization"/>
			</dateofresolutionauthorization>
			<unanimousconsentflag>
				<xsl:value-of select="$crec/unanimousconsentflag"/>
			</unanimousconsentflag>
			<contguarantyonfileflag>
				<xsl:value-of select="$crec/contguarantyonfileflag"/>
			</contguarantyonfileflag>
			<dateofguaranty>
				<xsl:value-of select="$crec/dateofguaranty"/>
			</dateofguaranty>
			<resolutioncertflag>
				<xsl:value-of select="$crec/resolutioncertflag"/>
			</resolutioncertflag>
			<kinecta_memberid><!--CUSTOM FIELD-->
				<xsl:value-of select="//custom_member[lenderdatabaseid=$crec/lenderdatabaseid and customerrecordid=$crec/customerrecordid]/memberid"/>
			</kinecta_memberid>
		</cif_entity>
	</xsl:template>

	<xsl:template name="MapToCIF_Property">
		<xsl:param name="pid"/>
		<xsl:param name="prec"/>
		<!-- Customer_Asset, Customer_CurrentAddress, Customer_MailingAddress & Customer_PreviousAddress -->
		<xsl:param name="atid"/>
		<!-- Address Type ID -->
		<xsl:param name="addrec"/>
		<!-- Customer_RealEstateOwned & Customer_Rent -->
		<xsl:param name="llid"/>
		<!-- Landlord Property ID (if rental) -->
		<xsl:param name="sprec"/>
		<!-- Property_Main and Property_VADetail -->
		<xsl:param name="primaryflag" />
		<xsl:param name="debitacct" />
		<xsl:variable name="loanclsgen" select="//loan_closinggeneral"/>
		<cif_property>
			<propertyid>
				<xsl:value-of select="$pid"/>
			</propertyid>
			<addressid>
				<xsl:value-of select="$pid"/>
			</addressid>
			<addresstypeid>
				<xsl:value-of select="$atid"/>
			</addresstypeid>
			<xsl:choose>
				<xsl:when test="$addrec">
					<xsl:choose>
						<xsl:when test="name($addrec) = 'customer_rent'">
							<holdername>
								<xsl:value-of select="$addrec/name"/>
							</holdername>
						</xsl:when>
						<xsl:otherwise>
							<holdername>
								<xsl:value-of select="$prec/name"/>
							</holdername>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>
					<holdername>
						<xsl:value-of select="$prec/name"/>
					</holdername>
				</xsl:otherwise>
			</xsl:choose>
			<!--<holdername>
				<xsl:value-of select="$prec/name"/>
			</holdername>-->
			<accountinname>
				<xsl:value-of select="$prec/accountinname"/>
			</accountinname>
			<accountnumber>
				<xsl:value-of select="$prec/accountnumber"/>
			</accountnumber>
			<assettype>
				<xsl:choose>
					<xsl:when test="$sprec and ($consumer or $commercial)">
						<xsl:value-of select="//product_propertytype[propertytypeid=$sprec/propertytypeid]/typedescription"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$prec/assettype"/>
					</xsl:otherwise>
				</xsl:choose>
			</assettype>
				<xsl:if test="$addrec">
					<xsl:if test="not(name($addrec) = 'customer_rent')">
						<holderaddressid>
							<xsl:value-of select="$pid"/>
						</holderaddressid>
					</xsl:if>
				</xsl:if>
			<edicodeid>
				<xsl:choose>
					<xsl:when test="$sprec and ($consumer or $commercial)">
						<xsl:value-of select="//edi_dataelements[editypeid=//setups_assettypes[assettype=//loan_collateralgroup[collateraldatabaseid=$sprec/lenderdatabaseid and collateralrecordid=$sprec/propertyrecordid]/assettype]/editype]/codeid"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="assettype" select="$prec/assettype"/>
						<xsl:variable name="editype" select="//setups_assettypes[assettype=$assettype]/editype" />
						<xsl:value-of select="//edi_dataelements[editypeid=$editype]/codeid" />
					</xsl:otherwise>
				</xsl:choose>
			</edicodeid>
      <xsl:if test="$prec/sendtoaus">
        <sendtoaus>
          <xsl:call-template name="MapYorNto0or1">
            <xsl:with-param name="YorN" select="$prec/sendtoaus"/>
          </xsl:call-template>
        </sendtoaus>
      </xsl:if>
			<liquid>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$prec/liquid"/>
				</xsl:call-template>
			</liquid>
			<numberofshares>
				<xsl:value-of select="$prec/numberofshares"/>
			</numberofshares>
			<sellerfundeddap>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$prec/sellerfunddap"/>
				</xsl:call-template>
			</sellerfundeddap>
			<verified>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$prec/verified"/>
				</xsl:call-template>
			</verified>
			<yearsataddress>
				<xsl:value-of select="$prec/yearsatresidence"/>
			</yearsataddress>
			<xsl:choose>
				<xsl:when test="$sprec">
          <buildingstatus>
            <xsl:value-of select="$sprec/buildingstatus"/>
          </buildingstatus>
					<presentvalue>
							<xsl:value-of select="$sprec/appraisedvalue"/>
					</presentvalue>
					<netrentalincome>
						<xsl:value-of select="$sprec/netrentalincome"/>
					</netrentalincome>
					<totalnetrentalincome>
						<xsl:value-of select="$sprec/totalnetrentalincome"/>
					</totalnetrentalincome>
				</xsl:when>
				<xsl:when test="$addrec and name($addrec) = 'customer_realestateowned'">
					<presentvalue>
						<xsl:value-of select="$addrec/presentvalue"/>
					</presentvalue>
				</xsl:when>
				<xsl:when test="not($addrec)">
					<presentvalue>
						<xsl:value-of select="$prec/balance"/>
					</presentvalue>
				</xsl:when>
				<xsl:otherwise>
					<presentvalue>
						<xsl:value-of select="$prec/balance"/>
					</presentvalue>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:if test="$sprec">
				<xsl:variable name ="clprop" select="//loan_closingproperty"/>
				<bedrooms>
					<xsl:value-of select="$sprec/bedrooms"/>
				</bedrooms>
				<floodserverid>
					<xsl:value-of select="$sprec/floodserverid"/>
				</floodserverid>
				<propertytypeid>
					<xsl:value-of select="$sprec/propertytypeid"/>
				</propertytypeid>
				<propertytypeedicodeid>
					<xsl:variable name="editype" select="//product_propertytype[propertytypeid=$sprec/propertytypeid]/editype" />
					<xsl:value-of select="//edi_dataelements[editypeid=$editype]/codeid" />
				</propertytypeedicodeid>
		        <propertytypedescription>
		          <xsl:variable name="editype" select="//product_propertytype[propertytypeid=$sprec/propertytypeid]/editype" />
		          <xsl:value-of select="//edi_dataelements[editypeid=$editype]/description" />
		        </propertytypedescription>
				<appraisaltype>
					<xsl:value-of select="$sprec/appraisaltype"/>
				</appraisaltype>
				<attachedproperty>
					<xsl:value-of select="$sprec/attachedproperty"/>
				</attachedproperty>
				<baths>
					<xsl:value-of select="$sprec/baths"/>
				</baths>
				<block>
					<xsl:value-of select="$sprec/block"/>
				</block>
				<builderwarranty>
					<xsl:value-of select="$sprec/builderwarranty"/>
				</builderwarranty>
				<buildingtype>
					<xsl:value-of select="$sprec/buildingtype"/>
				</buildingtype>
				<carpetequiped>
					<xsl:value-of select="$sprec/carpetequiped"/>
				</carpetequiped>
				<casenumberplanssubmitted>
					<xsl:value-of select="$sprec/casenumberplanssubmitted"/>
				</casenumberplanssubmitted>
				<cbradesignationdate>
					<xsl:value-of select="$sprec/cbradesignationdate"/>
				</cbradesignationdate>
				<classification>
					<xsl:value-of select="$sprec/classification"/>
				</classification>
				<classification2>
					<xsl:value-of select="$sprec/classification2"/>
				</classification2>
				<classification3>
					<xsl:value-of select="$sprec/classification3"/>
				</classification3>
				<classification4>
					<xsl:value-of select="$sprec/classification4"/>
				</classification4>
				<clotheswasherequiped>
					<xsl:value-of select="$sprec/clotheswasherequiped"/>
				</clotheswasherequiped>
				<coastalbarrierresource>
					<xsl:call-template name="MapYorNto0or1">
						<xsl:with-param name="YorN" select="$sprec/coastalbarrierresources"/>
					</xsl:call-template>
				</coastalbarrierresource>
				<currentoccupancy>
					<xsl:value-of select="$sprec/currentoccupancy"/>
				</currentoccupancy>
				<dateavailableforinspection>
					<xsl:value-of select="$sprec/dateavailableforinspection"/>
				</dateavailableforinspection>
				<dateconstructioncompleted>
					<xsl:value-of select="//loan_construction/constrcompletiondate"/>
					<!--<xsl:value-of select="$sprec/dateconstructioncompleteds"/>-->
				</dateconstructioncompleted>
				<dimensions>
					<xsl:value-of select="$sprec/dimensions"/>
				</dimensions>
				<dimensiontype>
					<xsl:value-of select="$sprec/dimensiontype"/>
				</dimensiontype>
				<dishwasherequiped>
					<xsl:value-of select="$sprec/dishwasherequiped"/>
				</dishwasherequiped>
				<dryerequiped>
					<xsl:value-of select="$sprec/dryerequiped"/>
				</dryerequiped>
				<economiclife>
					<xsl:value-of select="$sprec/economiclife"/>
				</economiclife>
				<edscmtyeligibilitylistdated>
					<xsl:value-of select="$sprec/edscmtyeligibilitylistdated"/>
				</edscmtyeligibilitylistdated>
				<edscmtyeligibility>
					<xsl:value-of select="$sprec/edscmtyeligibility"/>
				</edscmtyeligibility>
				<electricitytype>
					<xsl:value-of select="$sprec/electricitytype"/>
				</electricitytype>
				<energyimpamountspent>
					<xsl:value-of select="$sprec/energyimpamountspent"/>
				</energyimpamountspent>
				<energyimpfeatureadd>
					<xsl:value-of select="$sprec/energyimpfeatureaddition"/>
				</energyimpfeatureadd>
				<energyimpinsulation>
					<xsl:value-of select="$sprec/energyimpinsulation"/>
				</energyimpinsulation>
				<energyimpother>
					<xsl:value-of select="$sprec/energyimpother"/>
				</energyimpother>
				<energyimpsolarinstall>
					<xsl:value-of select="$sprec/energyimpsolarinstallation"/>
				</energyimpsolarinstall>
				<energyimpsysreplacemnt>
					<xsl:value-of select="$sprec/energyimpsystemreplacement"/>
				</energyimpsysreplacemnt>
				<factoryfabricated>
					<xsl:value-of select="$sprec/factoryfabricated"/>
				</factoryfabricated>
				<fipscountycode>
					<xsl:value-of select="$sprec/fips_county_code"/>
				</fipscountycode>
				<fipsstatecode>
					<xsl:value-of select="$sprec/fips_state_code"/>
				</fipsstatecode>
        <censustract>
          <xsl:value-of select="$sprec/census_tract"/>
        </censustract>
        <floodareaboundarytype>
					<xsl:value-of select="$sprec/floodareaboundarytype"/>
				</floodareaboundarytype>
				<floodcensustract>
					<xsl:value-of select="$sprec/floodcensustract"/>
				</floodcensustract>
				<floodcertdate>
					<xsl:value-of select="$sprec/floodcertdate"/>
				</floodcertdate>
				<floodcertnum>
					<xsl:value-of select="$sprec/floodcertnum"/>
				</floodcertnum>
				<floodcerttype>
					<xsl:value-of select="$sprec/floodcerttype"/>
				</floodcerttype>
				<floodcommentstxt>
					<xsl:value-of select="$sprec/floodcommentsid"/>
				</floodcommentstxt>
				<floodinsuranceannualpremium>
					<xsl:value-of select="$sprec/floodinsuranceannualpremium"/>
				</floodinsuranceannualpremium>
				<floodinsuranceisavail>
					<xsl:call-template name="MapYorNto0or1">
						<xsl:with-param name="YorN" select="$sprec/floodinsuranceisavailable"/>
					</xsl:call-template>
				</floodinsuranceisavail>
				<floodinsurancerequiredamount>
					<xsl:value-of select="$sprec/floodinsurancerequiredamount"/>
				</floodinsurancerequiredamount>
				<floodorderno>
					<xsl:value-of select="$sprec/floodorderno"/>
				</floodorderno>
				<floodprogram>
					<xsl:value-of select="$sprec/floodprogram"/>
				</floodprogram>
				<floodstatus>
					<xsl:value-of select="$sprec/floodstatus"/>
				</floodstatus>
				<fulllegaldesctxt>
					<!--<xsl:value-of select="$sprec/fulllegaldescription"/>-->
					<!--<xsl:value-of select="//loan_calculationsxml[epictable='cif_property' and epiccolumn='fulllegaldesctxt']/fieldvalue"/>-->
					<xsl:variable name="resetkeybefore" select="ISS:ResetProcessedKeyList('legaldescription')"/>
					<xsl:for-each select="//variabletext[vartextid=$sprec/fulllegaldescriptionid]">
						<xsl:sort select="vartextcount"/>
						<xsl:variable name="vtextid" select="./vartextid"/>
						<xsl:variable name="vtextcount" select="./vartextcount"/>
						<xsl:variable name="processed-key" select="ISS:HasKeyBeenProcessed('legaldescription', $vtextid, $vtextcount)"/>
						<xsl:if test="not($processed-key)">
							<xsl:variable name="vkey" select="ISS:AddProcessedKey('legaldescription', $vtextid, $vtextcount)"/>
							<xsl:value-of select="./vartext"/>	
						</xsl:if>
					</xsl:for-each>
					<xsl:variable name="resetkeyafter" select="ISS:ResetProcessedKeyList('legaldescription')"/>
				</fulllegaldesctxt>
				<garbagedisposalequiped>
					<xsl:value-of select="$sprec/garbagedisposalequiped"/>
				</garbagedisposalequiped>
				<gastype>
					<xsl:value-of select="$sprec/gastype"/>
				</gastype>
				<grosslivingarea>
					<xsl:value-of select="$sprec/grosslivingarea"/>
				</grosslivingarea>
				<hazardinsurancemasterpolicy>
					<xsl:value-of select="$sprec/hazardinsurancemasterpolicy"/>
				</hazardinsurancemasterpolicy>
				<xsl:variable name="lprec" select="//loan_processing"/>
				<xsl:variable name="lmrec" select="//loan_main"/>
				<hazardinsuranceamount>
					<xsl:value-of select="$lprec/hazardinsuranceamount"/>
				</hazardinsuranceamount>
				<hazardinsuranceavail>
					<xsl:value-of select="$lprec/hazardinsuranceavailable"/>
				</hazardinsuranceavail>
				<hazardinsurancecost>
					<xsl:value-of select="$lprec/hazardinsurancecost"/>
				</hazardinsurancecost>
				<hazardinsurancereq>
					<xsl:value-of select="$lprec/hazardinsurancerequired"/>
				</hazardinsurancereq>
				<hazardinsuranceterm>
					<xsl:value-of select="$lprec/hazardinsuranceterm"/>
				</hazardinsuranceterm>
				<!-- The following two dates need to be addressed -->
				<hazardinseffectivedate>
					<xsl:value-of select="$lmrec/actualclosingdate"/>
				</hazardinseffectivedate>
				<hazardinsenddate>
					<xsl:value-of select="ISS:AddYearsToFormatDate($lmrec/actualclosingdate, 1)"/>
				</hazardinsenddate>
				<highrisecondo>
					<xsl:value-of select="$sprec/highrisecondo"/>
				</highrisecondo>
				<hudcmtyeligibilitylistdated>
					<xsl:value-of select="$sprec/hudcmtyeligibilitylistdated"/>
				</hudcmtyeligibilitylistdated>
				<institutioncasenumber>
					<xsl:value-of select="$sprec/institutioncasenumber"/>
				</institutioncasenumber>
				<judicialdistrict>
					<xsl:value-of select="$sprec/judicialdistrict"/>
				</judicialdistrict>
				<leaseexpires>
					<xsl:value-of select="$sprec/leaseexpires"/>
				</leaseexpires>
				<leasetype>
					<xsl:value-of select="$sprec/leasetype"/>
				</leasetype>
				<legaldesc>
					<xsl:value-of select="$sprec/legaldescription"/>
				</legaldesc>
				<lenderrequiresfloodins>
					<xsl:call-template name="MapYorNto0or1">
						<xsl:with-param name="YorN" select="$sprec/lenderrequiresfloodinsurance"/>
					</xsl:call-template>
				</lenderrequiresfloodins>
				<limitationstxt>
					<xsl:value-of select="$sprec/limitationsid"/>
				</limitationstxt>
				<limitedreviewdesignation>
					<xsl:value-of select="$sprec/limitedreviewdesignation"/>
				</limitedreviewdesignation>
				<listprice>
					<xsl:value-of select="$sprec/listprice"/>
				</listprice>
				<locatedonfhbmmap>
					<xsl:value-of select="$sprec/locatedonfhbmmap"/>
				</locatedonfhbmmap>
				<locatedonfirmmap>
					<xsl:value-of select="$sprec/locatedonfirmmap"/>
				</locatedonfirmmap>
				<locatedonother>
					<xsl:value-of select="$sprec/locatedonother"/>
				</locatedonother>
				<locatedonothertext>
					<xsl:value-of select="$sprec/locatedonothertext"/>
				</locatedonothertext>
				<lomalomr>
					<xsl:call-template name="MapYorNto0or1">
						<xsl:with-param name="YorN" select="$sprec/loma_lomr"/>
					</xsl:call-template>
				</lomalomr>
				<lomalomrdate>
					<xsl:value-of select="$sprec/loma_lomr_date"/>
				</lomalomrdate>
				<lot>
					<xsl:value-of select="$sprec/lot"/>
				</lot>
				<lotdimensionsdesc>
					<xsl:value-of select="$sprec/lotdimensionsdescription"/>
				</lotdimensionsdesc>
				<manufacturedhomecategory>
					<xsl:value-of select="$sprec/manufacturedhomecategory"/>
				</manufacturedhomecategory>
				<mineralrights>
					<xsl:value-of select="$sprec/mineralrights"/>
				</mineralrights>
				<mineralrightsdesc>
					<xsl:value-of select="$sprec/mineralrightsdescription"/>
				</mineralrightsdesc>
				<msacode>
					<xsl:value-of select="$sprec/msa_code"/>
				</msacode>
				<municipality>
					<xsl:value-of select="$sprec/municipality"/>
				</municipality>
				<nfipcommunityname>
					<xsl:value-of select="$sprec/nfipcommunityname"/>
				</nfipcommunityname>
				<nfipcommunitynumber>
					<xsl:value-of select="$sprec/nfipcommunitynumber"/>
				</nfipcommunitynumber>
				<nfipcounties>
					<xsl:value-of select="$sprec/nfipcounties"/>
				</nfipcounties>
				<nfipfloodzone>
					<xsl:value-of select="$sprec/nfipfloodzone"/>
				</nfipfloodzone>
				<nfipmapnumber>
					<xsl:value-of select="$sprec/nfipmapnumber"/>
				</nfipmapnumber>
				<nfipparticipate>
					<xsl:value-of select="$sprec/nfipparticipate"/>
				</nfipparticipate>
				<nfipreviseddate>
					<xsl:value-of select="$sprec/nfipreviseddate"/>
				</nfipreviseddate>
				<nonfipmap>
					<xsl:value-of select="$sprec/nonfipmap"/>
				</nonfipmap>
				<numberofacres>
					<xsl:value-of select="$sprec/numberofacres"/>
				</numberofacres>
				<numberofbuildings>
					<xsl:value-of select="$sprec/numberofbuildings"/>
				</numberofbuildings>
				<numberofstories>
					<xsl:value-of select="$sprec/numberofstories"/>
				</numberofstories>
				<numberofunits>
					<xsl:value-of select="$sprec/numberofunits"/>
				</numberofunits>
				<numberofyearsowned>
					<xsl:value-of select="$sprec/numberofyearsowned"/>
				</numberofyearsowned>
				<occupantfirstname>
					<xsl:value-of select="$sprec/occupantfirstname"/>
				</occupantfirstname>
				<occupantlastname>
					<xsl:value-of select="$sprec/occupantlastname"/>
				</occupantlastname>
				<occupantmiddlename>
					<xsl:value-of select="$sprec/occupantmiddlename"/>
				</occupantmiddlename>
				<occupantsuffixname>
					<xsl:value-of select="$sprec/occupantsuffixname"/>
				</occupantsuffixname>
				<originatoridentnumber>
					<xsl:value-of select="$sprec/originatoridentnumber"/>
				</originatoridentnumber>
				<otherequiped>
					<xsl:value-of select="$sprec/otherequiped"/>
				</otherequiped>
				<otherequipeddesc>
					<xsl:value-of select="$sprec/otherequipeddescription"/>
				</otherequipeddesc>
				<otherpropertytype>
					<xsl:value-of select="$sprec/otherpropertytype"/>
				</otherpropertytype>
				<ovenequiped>
					<xsl:value-of select="$sprec/ovenequiped"/>
				</ovenequiped>
				<ownerofmortgage>
					<xsl:value-of select="$sprec/ownerofmortgage"/>
				</ownerofmortgage>
				<parcelidnum>
					<xsl:value-of select="$loanclsgen/parcelid"/>
				</parcelidnum>
				<percentrentalincome>
					<xsl:value-of select="$sprec/percentrentalincome"/>
				</percentrentalincome>
				<planstype>
					<xsl:value-of select="$sprec/planstype"/>
				</planstype>
				<propertydesignation>
					<xsl:value-of select="$sprec/propertydesignation"/>
				</propertydesignation>
				<propertyname>
					<xsl:value-of select="$sprec/propertyname"/>
				</propertyname>
				<propertyname2>
					<xsl:value-of select="$sprec/propertyname2"/>
				</propertyname2>
				<propertyreviewformnum>
					<xsl:value-of select="$sprec/propertyreviewformnum"/>
				</propertyreviewformnum>
				<propertyreviewlevel>
					<xsl:value-of select="$sprec/propertyreviewlevel"/>
				</propertyreviewlevel>
				<purchaselotseparately>
					<xsl:value-of select="$sprec/purchaselotseparately"/>
				</purchaselotseparately>
				<recordeddate>
					<xsl:value-of select="//loan_closingproperty/recordeddate"/>
				</recordeddate>
				<recordingdistrictname>
					<xsl:value-of select="$sprec/recordingdistrictname"/>
				</recordingdistrictname>
				<recordingdistricttype>
					<xsl:value-of select="$sprec/recordingdistricttype"/>
				</recordingdistricttype>
				<refrigeratorequiped>
					<xsl:value-of select="$sprec/refrigeratorequiped"/>
				</refrigeratorequiped>
				<rentalincome>
					<xsl:value-of select="$sprec/rentalincome"/>
				</rentalincome>
				<requiredimprovements>
					<xsl:value-of select="$sprec/requiredimprovements"/>
				</requiredimprovements>
				<ruralpropertyflag>
					<xsl:value-of select="$sprec/ruralpropertyflag"/>
				</ruralpropertyflag>
				<salesprice>
					<xsl:value-of select="$sprec/salesprice"/>
				</salesprice>
				<salecontractdate>
					<xsl:value-of select="$clprop/salescontractdate"/>
				</salecontractdate>
				<salecontractnumber>
					<xsl:value-of select="$clprop/contractnumber"/>
				</salecontractnumber>
				<section>
					<xsl:value-of select="$sprec/section"/>
				</section>
				<sewertype>
					<xsl:value-of select="$sprec/sewertype"/>
				</sewertype>
				<specialfloodhazardarea>
					<xsl:call-template name="MapYorNto0or1">
						<xsl:with-param name="YorN" select="$sprec/specialfloodhazardarea"/>
					</xsl:call-template>
				</specialfloodhazardarea>
				<sponsoridentnumber>
					<xsl:value-of select="$sprec/sponsoridentnumber"/>
				</sponsoridentnumber>
				<squarefootage>
					<xsl:value-of select="$sprec/squarefootage"/>
				</squarefootage>
				<streetaccesstype>
					<xsl:value-of select="$sprec/streetaccesstype"/>
				</streetaccesstype>
				<streetmaintype>
					<xsl:value-of select="$sprec/steetmaintype"/>
				</streetmaintype>
				<structuretype>
					<xsl:value-of select="$sprec/structuretype"/>
				</structuretype>
				<subdivision>
					<xsl:value-of select="$sprec/subdivision"/>
				</subdivision>
        <taxfolioidnumber>
					<xsl:value-of select="$clprop/taxfolioidnumber"/>
				</taxfolioidnumber>
				<timeamorpmavailable>
					<xsl:value-of select="$sprec/timeamorpmavailable"/>
				</timeamorpmavailable>
				<totalroomcount>
					<xsl:value-of select="$sprec/totalroomcount"/>
				</totalroomcount>
				<unitno>
					<xsl:value-of select="$sprec/unitno"/>
				</unitno>
				<ventfanequiped>
					<xsl:value-of select="$sprec/ventfanequiped"/>
				</ventfanequiped>
				<warrantable>
					<xsl:value-of select="$sprec/warrantable"/>
				</warrantable>
				<warrantyenclosed>
					<xsl:value-of select="$sprec/warrantyenclosed"/>
				</warrantyenclosed>
				<warrantyexpirationdate>
					<xsl:value-of select="$sprec/warrantyexpirationdate"/>
				</warrantyexpirationdate>
				<warrantyprogramname>
					<xsl:value-of select="$sprec/warrantyprogramname"/>
				</warrantyprogramname>
				<watertype>
					<xsl:value-of select="$sprec/watertype"/>
				</watertype>
				<yearbuilt>
					<xsl:value-of select="$sprec/yearbuilt"/>
				</yearbuilt>
        <censustractlevel>
          <xsl:value-of select="$sprec/censustractlevel"/>
        </censustractlevel>
				<xsl:choose>
					<xsl:when test="$consumer or $commercial">
						<yearlotacquired>
							<xsl:value-of select="$sprec/yearlotacquired"/>
						</yearlotacquired>
						<originalcost>
							<xsl:value-of select="$sprec/originalcost"/>
						</originalcost>
						<amountexistingliens>
							<xsl:value-of select="$sprec/amountexistingliens"/>
						</amountexistingliens>
						<valueoflot>
							<xsl:value-of select="$sprec/valueoflot"/>
						</valueoflot>
						<improvementcosts>
							<xsl:value-of select="$sprec/improvementcosts"/>
						</improvementcosts>
						<datelotacquired>
							<xsl:value-of select="$sprec/datelotacquired"/>
						</datelotacquired>
						<impmadeflag>
							<xsl:value-of select="$sprec/impmadeflag"/>
						</impmadeflag>
						<imptobemadeflag>
							<xsl:value-of select="$sprec/imptobemadeflag"/>
						</imptobemadeflag>
						<improvementdesc>
							<xsl:value-of select="$sprec/improvementdesc"/>
						</improvementdesc>
						<occupancytypeid>
							<xsl:value-of select="$sprec/occupancytypeid"/>
						</occupancytypeid>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="loanmainrec" select="//loan_main"/>
						<xsl:variable name="refinanceflag" select="//edi_dataelements[editypeid=//product_purposetype/editype]/codeid='05'" />
						<yearlotacquired>
							<xsl:choose>
								<xsl:when test="$refinanceflag">
									<xsl:value-of select="$loanmainrec/refiyearlotacquired"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="$loanmainrec/constyearlotacquired"/>
								</xsl:otherwise>
							</xsl:choose>
						</yearlotacquired>
						<originalcost>
							<xsl:value-of select="$loanmainrec/constoriginalcost"/>
						</originalcost>
						<amountexistingliens>
							<xsl:choose>
								<xsl:when test="$refinanceflag">
									<xsl:value-of select="$loanmainrec/refiamountexistingliens"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="$loanmainrec/constamountexistingliens"/>
								</xsl:otherwise>
							</xsl:choose>
						</amountexistingliens>
						<valueoflot>
							<xsl:value-of select="$loanmainrec/constvalueoflot"/>
						</valueoflot>
						<improvementcosts>
							<xsl:choose>
								<xsl:when test="$refinanceflag">
									<xsl:value-of select="$loanmainrec/reficostofimprovements"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="$loanmainrec/constcostofimprovements"/>
								</xsl:otherwise>
							</xsl:choose>
						</improvementcosts>
						<datelotacquired>
							<xsl:value-of select="//loan_processing/refidatelotacquired"/>
						</datelotacquired>
						<impmadeflag>
							<xsl:call-template name="MapYorNto0or1">
								<xsl:with-param name="YorN" select="$loanmainrec/refimade"/>
							</xsl:call-template>
						</impmadeflag>
						<imptobemadeflag>
							<xsl:call-template name="MapYorNto0or1">
								<xsl:with-param name="YorN" select="$loanmainrec/refitobemade"/>
							</xsl:call-template>
						</imptobemadeflag>
						<improvementdesc>
							<xsl:value-of select="$loanmainrec/refiyearimprovementdescription"/>
						</improvementdesc>
					</xsl:otherwise>
				</xsl:choose>
				<dcwarrantydeedflag>
					<xsl:value-of select="$sprec/dcwarrantydeedflag"/>
				</dcwarrantydeedflag>
				<dcquitclaimdeedflag>
					<xsl:value-of select="$sprec/dcquitclaimdeedflag"/>
				</dcquitclaimdeedflag>
				<dcotherdeedflag>
					<xsl:value-of select="$sprec/dcotherdeedflag"/>
				</dcotherdeedflag>
				<dcotherdeeddesc>
					<xsl:value-of select="$sprec/dcotherdeeddesc"/>
				</dcotherdeeddesc>
			</xsl:if>
			<xsl:if test="$addrec">
				<!-- Customer_RealEstateOwned Information -->
				<xsl:if test="name($addrec)='customer_realestateowned'">
					<xsl:variable name="resetkeybefore" select="ISS:ResetProcessedKeyList('reodebt')"/>
					<xsl:variable name="resetpmtaccumulatorbefore" select="ISS:ResetAccumulator('reototalpayment')"/>
					<xsl:variable name="resetbalaccumulatorbefore" select="ISS:ResetAccumulator('reototalbalance')"/>
					<xsl:for-each select="//customer_realestatedebt[addressldid=$addrec/addressldid][addressid=$addrec/addressid]">
						<xsl:variable name="debtldid" select="./debtldid"/>
						<xsl:variable name="debtid" select="./debtid"/>
						<xsl:variable name="processed-key" select="ISS:HasKeyBeenProcessed('reodebt', $debtldid, $debtid)"/>
						<xsl:if test="not($processed-key)">
							<xsl:variable name="debtkey" select="ISS:AddProcessedKey('reodebt', $debtldid, $debtid)"/>
							<xsl:variable name="debtrec" select="//customer_debt[debtldid=$debtldid][debtid=$debtid]"/>
							<xsl:variable name="reopmtaccumulator" select="ISS:AddValueToAccumulation('reototalpayment', $debtrec/payment * $debtrec/paymentperiod div 12.0)"/>
							<xsl:variable name="reobalaccumulator" select="ISS:AddValueToAccumulation('reototalbalance', $debtrec/balance)"/>
						</xsl:if>
					</xsl:for-each>
					<xsl:variable name="totalpayment" select="ISS:GetAccumulatedValue('reototalpayment')"/>
					<xsl:variable name="totalbalance" select="ISS:GetAccumulatedValue('reototalbalance')"/>
					<xsl:variable name="resetkeyafter" select="ISS:ResetProcessedKeyList('reodebt')"/>
					<xsl:variable name="resetpmtaccumulatorafter" select="ISS:ResetAccumulator('reototalpayment')"/>
					<xsl:variable name="resetbalaccumulatorafter" select="ISS:ResetAccumulator('reototalbalance')"/>
					<!--<presentvalue>
						<xsl:value-of select="$addrec/presentvalue"/>
					</presentvalue>-->
					<rentalincome>
						<xsl:value-of select="$addrec/rentalincome"/>
					</rentalincome>
					<netrentalincome>
						<xsl:value-of select="$addrec/netrentalincome"/>
					</netrentalincome>
					<monthlytitotal>
						<xsl:value-of select="$addrec/monthlyhazardinsurance + $addrec/monthlytaxes + $addrec/monthlyinsurance + $addrec/monthlyassociationdues + $addrec/monthlygroundrent + $addrec/monthlyfloodinsurance + $addrec/monthlyother"/>
					</monthlytitotal>
					<totalliens>
						<xsl:value-of select="$totalbalance"/>
					</totalliens>
					<totalpipayments>
						<xsl:value-of select="$totalpayment"/>
					</totalpipayments>
					<percentrentalincome>
						<xsl:value-of select="$addrec/percentrentalincome"/>
					</percentrentalincome>
					<propertystatus>
						<xsl:value-of select="$addrec/propertystatus"/>
					</propertystatus>
					<monthlyassociationdues>
						<xsl:value-of select="$addrec/monthlyassociationdues"/>
					</monthlyassociationdues>
					<monthlyfloodinsurance>
						<xsl:value-of select="$addrec/monthlyfloodinsurance"/>
					</monthlyfloodinsurance>
					<monthlygroundrent>
						<xsl:value-of select="$addrec/monthlygroundrent"/>
					</monthlygroundrent>
					<monthlyhazardinsurance>
						<xsl:value-of select="$addrec/monthlyhazardinsurance"/>
					</monthlyhazardinsurance>
					<monthlyinsurance>
						<xsl:value-of select="$addrec/monthlyinsurance"/>
					</monthlyinsurance>
					<monthlymaintenance>
						<xsl:value-of select="$addrec/monthlymaintenance"/>
					</monthlymaintenance>
					<monthlyother>
						<xsl:value-of select="$addrec/monthlyother"/>
					</monthlyother>
					<monthlyspecialassessments>
						<xsl:value-of select="$addrec/monthlyspecialassessments"/>
					</monthlyspecialassessments>
					<monthlytaxes>
						<xsl:value-of select="$addrec/monthlytaxes"/>
					</monthlytaxes>
					<monthlyutility>
						<xsl:value-of select="$addrec/monthlyutility"/>
					</monthlyutility>
					<originallyfhainsured>
						<xsl:call-template name="MapYorNto0or1">
							<xsl:with-param name="YorN" select="$addrec/originallyfhainsured"/>
						</xsl:call-template>
					</originallyfhainsured>
					<overridenetrent>
						<xsl:value-of select="$addrec/overridenetrent"/>
					</overridenetrent>
					<rentersinsurance>
						<xsl:value-of select="$addrec/rentersinsurance"/>
					</rentersinsurance>
					<yearlyrentincrease>
						<xsl:value-of select="$addrec/yearlyrentincrease"/>
					</yearlyrentincrease>
				</xsl:if>
				<!-- Customer_Rent Information -->
				<xsl:for-each select="$addrec">
					<xsl:if test="name(.)='customer_rent'">
            <monthlyrentamount>
              <xsl:value-of select="./rentamount"/>
            </monthlyrentamount>
            <monthlyother>
              <xsl:value-of select="./monthlyother"/>
            </monthlyother>
            <holderaddressid>
							<xsl:value-of select="$llid"/>
						</holderaddressid>
					</xsl:if>
				</xsl:for-each>
			</xsl:if>
			<xsl:if test="name($prec)='customer_currentaddress' or 
							name($prec)='customer_previousaddress'">
				<ownership>
					<xsl:value-of select="$prec/ownership"/>
				</ownership>
			</xsl:if>
			<xsl:choose>
				<!--Consumer busniess channel-->
				<xsl:when test="//setups_businesschannel/channeltype=3">
					<primaryaddress>
						<xsl:variable name="assettype" select="//setups_assettypes[assettype=$prec/assettype]/editype"/>
						<xsl:choose>
							<!--Watercraft - maybe a houseboat-->
							<xsl:when test="$assettype=569048">
								<xsl:value-of select="$prec/primaryaddress"/>
							</xsl:when>
							<xsl:otherwise>0</xsl:otherwise>
						</xsl:choose>
					</primaryaddress>
				</xsl:when>
				<xsl:otherwise>
					<primaryaddress>
						<xsl:choose>
							<xsl:when test="$primaryflag">1</xsl:when>
							<xsl:otherwise>0</xsl:otherwise>
						</xsl:choose>
					</primaryaddress>
				</xsl:otherwise>
			</xsl:choose>
			<primaryaddress>
				<xsl:choose>
					<xsl:when test="$primaryflag">1</xsl:when>
					<xsl:otherwise>0</xsl:otherwise>
				</xsl:choose>
			</primaryaddress>
			<!--<xsl:choose>-->
				<!--<xsl:when test="$consumer or $commercial">-->
					<xsl:if test="$prec/autodebitflag=1">
						<abaroutingnumber>
							<xsl:value-of select="$prec/routenumber"/>
						</abaroutingnumber>
					</xsl:if>
				<!--</xsl:when>
				<xsl:otherwise>
					<xsl:if test="$debitacct and $prec/accountnumber = $debitacct">
						<abaroutingnumber>
							<xsl:value-of select="//loan_fidelitymspinfo/routenumber"/>
						</abaroutingnumber>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>-->
			<giftsourceid>
				<xsl:value-of select="$prec/fhasource"/>
			</giftsourceid>
			<giftsourcedesc>
				<xsl:value-of select="$prec/sourcedesc"/>
			</giftsourcedesc>
			<giftsourceein>
				<xsl:value-of select="$prec/sourceein"/>
			</giftsourceein>
			<vehiclenottitledflag>
				<xsl:value-of select="$prec/vehiclenottitledflag"/>
			</vehiclenottitledflag>
			<personalwatercraftflag>
				<xsl:value-of select="$prec/personalwatercraftflag"/>
			</personalwatercraftflag>
			<lengthinfeet>
				<xsl:value-of select="$prec/lengthinfeet"/>
			</lengthinfeet>
			<trailerincludedflag>
				<xsl:value-of select="$prec/trailerincludedflag"/>
			</trailerincludedflag>
			<trailergrossweight>
				<xsl:value-of select="$prec/trailergrossweight"/>
			</trailergrossweight>
			<trailernumberofaxles>
				<xsl:value-of select="$prec/trailernumberofaxles"/>
			</trailernumberofaxles>
			<outboardmotorincflag>
				<xsl:value-of select="$prec/outboardmotorincflag"/>
			</outboardmotorincflag>
			<poaneededfortitleflag>
				<xsl:value-of select="$prec/poaneededfortitleflag"/>
			</poaneededfortitleflag>
			<collisioninsflag>
				<xsl:value-of select="$prec/collisioninsflag"/>
			</collisioninsflag>
			<liabilityinsflag>
				<xsl:value-of select="$prec/liabilityinsflag"/>
			</liabilityinsflag>
			<comprehensiveinsflag>
				<xsl:value-of select="$prec/comprehensiveinsflag"/>
			</comprehensiveinsflag>
			<fireinsflag>
				<xsl:value-of select="$prec/fireinsflag"/>
			</fireinsflag>
			<theftinsflag>
				<xsl:value-of select="$prec/theftinsflag"/>
			</theftinsflag>
			<riskhullinsflag>
				<xsl:value-of select="$prec/riskhullinsflag"/>
			</riskhullinsflag>
			<otherinsdesc>
				<xsl:value-of select="$prec/otherinsdesc"/>
			</otherinsdesc>
			<description>
				<xsl:value-of select="$prec/description"/>
			</description>
			<vin>
				<xsl:value-of select="$prec/vin"/>
			</vin>
			<make>
				<xsl:value-of select="$prec/make"/>
			</make>
			<model>
				<xsl:value-of select="$prec/model"/>
			</model>
			<bodystyle>
				<xsl:value-of select="$prec/bodystyle"/>
			</bodystyle>
			<manufactureyear>
				<xsl:value-of select="$prec/manufactureyear"/>
			</manufactureyear>
			<onleasedpropertyflag>
				<xsl:value-of select="$prec/onleasedpropertyflag"/>
			</onleasedpropertyflag>
			<locatedinstitutionflag>
				<xsl:value-of select="$prec/locatedinstitutionflag"/>
			</locatedinstitutionflag>
			<numberusdapaymentassigned>
				<xsl:value-of select="$prec/numberusdapaymentassigned"/>
			</numberusdapaymentassigned>
			<engineincludedflag>
				<xsl:value-of select="$prec/engineincludedflag"/>
			</engineincludedflag>
			<navequipincludedflag>
				<xsl:value-of select="$prec/navequipincludedflag"/>
			</navequipincludedflag>
			<lotsize>
				<xsl:value-of select="$prec/lotsize"/>
			</lotsize>
			<insurednotownerflag>
				<xsl:value-of select="$prec/insurednotownerflag"/>
			</insurednotownerflag>
			<verifieddate>
				<xsl:value-of select="$prec/verifieddate"/>
			</verifieddate>
			<environmentalagmtflag>
				<xsl:value-of select="$prec/environmentalagmtflag"/>
			</environmentalagmtflag>
			<leasesrentsassignflag>
				<xsl:value-of select="$prec/leasesrentsassignflag"/>
			</leasesrentsassignflag>
			<hullnumber>
				<xsl:value-of select="$prec/hullnumber"/>
			</hullnumber>
			<registrationnumber>
				<xsl:value-of select="$prec/registrationnumber"/>
			</registrationnumber>
			<serialnumber>
				<xsl:value-of select="$prec/serialnumber"/>
			</serialnumber>
			<primaryaddress>
				<xsl:value-of select="$prec/primaryaddress"/>
			</primaryaddress>
			<groundleaseflag>
				<xsl:value-of select="$prec/groundleaseflag"/>
			</groundleaseflag>
			<beneficiaryconsentflag>
				<xsl:value-of select="$prec/beneficiaryconsentflag"/>
			</beneficiaryconsentflag>
			<policyeffectivedate>
				<xsl:value-of select="$prec/policyeffectivedate"/>
			</policyeffectivedate>
			<policymaturitydate>
				<xsl:value-of select="$prec/policymaturitydate"/>
			</policymaturitydate>
			<facevalue>
				<xsl:value-of select="$prec/facevalue"/>
			</facevalue>
			<deductibleamount>
				<xsl:value-of select="$prec/deductibleamount"/>
			</deductibleamount>
			<medallionguaranteeflag>
				<xsl:value-of select="$prec/medallionguaranteeflag"/>
			</medallionguaranteeflag>
			<numberofshares>
				<xsl:value-of select="$prec/numberofshares"/>
			</numberofshares>
			<certificatenumber>
				<xsl:value-of select="$prec/certificatenumber"/>
			</certificatenumber>
			<stocktype>
				<xsl:value-of select="$prec/stocktype"/>
			</stocktype>
			<issuer>
				<xsl:value-of select="$prec/issuer"/>
			</issuer>
			<leasedpropertydays>
				<xsl:value-of select="$prec/leasedpropertydays"/>
			</leasedpropertydays>
		</cif_property>
	</xsl:template>

	<xsl:template name="MapToCIF_Employment">
		<xsl:param name="erec"/>
		<xsl:param name="employmentid"/>
		<xsl:param name="employeraddressid"/>
		<xsl:param name="employerphoneid"/>
		<cif_employment>
			<entityid>
				<xsl:value-of select="$erec/lenderdatabaseid"/>
				<xsl:text>-</xsl:text>
				<xsl:value-of select="$erec/customerrecordid"/>
			</entityid>
			<employmentid>
				<xsl:value-of select="$employmentid"/>
			</employmentid>
			<!-- Map to <totalotherincome> -->
			<xsl:for-each select="//customer_employment_calcs[epictable='cif_employment' and 
										lenderdatabaseid=$erec/lenderdatabaseid and 
										customerrecordid=$erec/customerrecordid and 
										employerid=$erec/employerid]">
				<xsl:element name="{./epiccolumn}">
					<xsl:value-of select="./fieldvalue"/>
				</xsl:element>
			</xsl:for-each>
			<employeraddressid>
				<xsl:value-of select="$employeraddressid"/>
			</employeraddressid>
			<employerphoneid>
				<xsl:value-of select="$employerphoneid"/>
			</employerphoneid>
			<begindate>
				<xsl:value-of select="$erec/begindate"/>
			</begindate>
			<currentemployment>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$erec/currentemployment"/>
				</xsl:call-template>
			</currentemployment>
			<employercontact>
				<xsl:value-of select="$erec/contact"/>
			</employercontact>
			<employername>
				<xsl:value-of select="$erec/name"/>
			</employername>
			<enddate>
				<xsl:value-of select="$erec/enddate"/>
			</enddate>
			<selfemployed>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$erec/selfemployed"/>
				</xsl:call-template>
			</selfemployed>
			<title>
				<xsl:value-of select="$erec/title"/>
			</title>
			<totalmonthlyincome>
				<xsl:value-of select="$erec/totalmonthlyincome"/>
			</totalmonthlyincome>
			<typeofbusiness>
				<xsl:value-of select="$erec/typeofbusiness"/>
			</typeofbusiness>
			<verified>
				<xsl:value-of select="$erec/verified"/>
			</verified>
			<yearsonjob>
				<xsl:value-of select="$erec/yearsonjob"/>
			</yearsonjob>
			<xsl:if test="$erec/selfemployed = 'Y'">
				<xsl:call-template name="SelfEmploymentInfo">
					<xsl:with-param name="erec" select="$erec" />
				</xsl:call-template>
			</xsl:if>
			<primaryemployment>
				<xsl:call-template name="MapYorNto0or1">
					<xsl:with-param name="YorN" select="$erec/primaryemployment"/>
				</xsl:call-template>
			</primaryemployment>
		</cif_employment>
	</xsl:template>

	<xsl:template name="SelfEmploymentInfo" >
		<xsl:param name="erec" />
		<xsl:variable name="crid" select="$erec/customerrecordid" />
		<xsl:variable name="eid" select="$erec/employerid" />
		<xsl:variable name="ldid" select="$erec/lenderdatabaseid" />
		<xsl:variable name="srec" select="//customer_selfemployment[lenderdatabaseid=$ldid and
									customerrecordid=$crid and
									employerid=$eid]" />
		<xsl:variable name="arec" select="//customer_selfemploymentagi[lenderdatabaseid=$ldid and
									customerrecordid=$crid and
									employerid=$eid]" />
		<xsl:variable name="crec" select="//customer_selfemploymentcf[lenderdatabaseid=$ldid and
									customerrecordid=$crid and
									employerid=$eid]" />
		<agi_a1_adjgrossinc_year1>
			<xsl:value-of select="$arec/agi_a1_adjgrossinc_year1"/>
		</agi_a1_adjgrossinc_year1>
		<agi_a1_adjgrossinc_year2>
			<xsl:value-of select="$arec/agi_a1_adjgrossinc_year2"/>
		</agi_a1_adjgrossinc_year2>
		<agi_a1_adjgrossinc_year3>
			<xsl:value-of select="$arec/agi_a1_adjgrossinc_year3"/>
		</agi_a1_adjgrossinc_year3>
		<agi_a10_iradistr_year1>
			<xsl:value-of select="$arec/agi_a10_iradistr_year1"/>
		</agi_a10_iradistr_year1>
		<agi_a10_iradistr_year2>
			<xsl:value-of select="$arec/agi_a10_iradistr_year2"/>
		</agi_a10_iradistr_year2>
		<agi_a10_iradistr_year3>
			<xsl:value-of select="$arec/agi_a10_iradistr_year3"/>
		</agi_a10_iradistr_year3>
		<agi_a11_pensions_year1>
			<xsl:value-of select="$arec/agi_a11_pensions_year1"/>
		</agi_a11_pensions_year1>
		<agi_a11_pensions_year2>
			<xsl:value-of select="$arec/agi_a11_pensions_year2"/>
		</agi_a11_pensions_year2>
		<agi_a11_pensions_year3>
			<xsl:value-of select="$arec/agi_a11_pensions_year3"/>
		</agi_a11_pensions_year3>
		<agi_a12_schede_year1>
			<xsl:value-of select="$arec/agi_a12_schede_year1"/>
		</agi_a12_schede_year1>
		<agi_a12_schede_year2>
			<xsl:value-of select="$arec/agi_a12_schede_year2"/>
		</agi_a12_schede_year2>
		<agi_a12_schede_year3>
			<xsl:value-of select="$arec/agi_a12_schede_year3"/>
		</agi_a12_schede_year3>
		<agi_a14_unemployment_year1>
			<xsl:value-of select="$arec/agi_a14_unemployment_year1"/>
		</agi_a14_unemployment_year1>
		<agi_a14_unemployment_year2>
			<xsl:value-of select="$arec/agi_a14_unemployment_year2"/>
		</agi_a14_unemployment_year2>
		<agi_a14_unemployment_year3>
			<xsl:value-of select="$arec/agi_a14_unemployment_year3"/>
		</agi_a14_unemployment_year3>
		<agi_a15_ss_year1>
			<xsl:value-of select="$arec/agi_a15_ss_year1"/>
		</agi_a15_ss_year1>
		<agi_a15_ss_year2>
			<xsl:value-of select="$arec/agi_a15_ss_year2"/>
		</agi_a15_ss_year2>
		<agi_a15_ss_year3>
			<xsl:value-of select="$arec/agi_a15_ss_year3"/>
		</agi_a15_ss_year3>
		<agi_a16_other1_year1>
			<xsl:value-of select="$arec/agi_a16_other1_year1"/>
		</agi_a16_other1_year1>
		<agi_a16_other1_year2>
			<xsl:value-of select="$arec/agi_a16_other1_year2"/>
		</agi_a16_other1_year2>
		<agi_a16_other1_year3>
			<xsl:value-of select="$arec/agi_a16_other1_year3"/>
		</agi_a16_other1_year3>
		<agi_a16_other2_year1>
			<xsl:value-of select="$arec/agi_a16_other2_year1"/>
		</agi_a16_other2_year1>
		<agi_a16_other2_year2>
			<xsl:value-of select="$arec/agi_a16_other2_year2"/>
		</agi_a16_other2_year2>
		<agi_a16_other2_year3>
			<xsl:value-of select="$arec/agi_a16_other2_year3"/>
		</agi_a16_other2_year3>
		<agi_a16_otherdescr1>
			<xsl:value-of select="$arec/agi_a16_otherdescr1"/>
		</agi_a16_otherdescr1>
		<agi_a16_otherdescr2>
			<xsl:value-of select="$arec/agi_a16_otherdescr2"/>
		</agi_a16_otherdescr2>
		<agi_a17_iradeduction_year1>
			<xsl:value-of select="$arec/agi_a17_iradeduction_year1"/>
		</agi_a17_iradeduction_year1>
		<agi_a17_iradeduction_year2>
			<xsl:value-of select="$arec/agi_a17_iradeduction_year2"/>
		</agi_a17_iradeduction_year2>
		<agi_a17_iradeduction_year3>
			<xsl:value-of select="$arec/agi_a17_iradeduction_year3"/>
		</agi_a17_iradeduction_year3>
		<agi_a18_halfsetax_year1>
			<xsl:value-of select="$arec/agi_a18_halfsetax_year1"/>
		</agi_a18_halfsetax_year1>
		<agi_a18_halfsetax_year2>
			<xsl:value-of select="$arec/agi_a18_halfsetax_year2"/>
		</agi_a18_halfsetax_year2>
		<agi_a18_halfsetax_year3>
			<xsl:value-of select="$arec/agi_a18_halfsetax_year3"/>
		</agi_a18_halfsetax_year3>
		<agi_a19_healthinsurance_year1>
			<xsl:value-of select="$arec/agi_a19_healthinsurance_year1"/>
		</agi_a19_healthinsurance_year1>
		<agi_a19_healthinsurance_year2>
			<xsl:value-of select="$arec/agi_a19_healthinsurance_year2"/>
		</agi_a19_healthinsurance_year2>
		<agi_a19_healthinsurance_year3>
			<xsl:value-of select="$arec/agi_a19_healthinsurance_year3"/>
		</agi_a19_healthinsurance_year3>
		<agi_a2_wages_year1>
			<xsl:value-of select="$arec/agi_a2_wages_year1"/>
		</agi_a2_wages_year1>
		<agi_a2_wages_year2>
			<xsl:value-of select="$arec/agi_a2_wages_year2"/>
		</agi_a2_wages_year2>
		<agi_a2_wages_year3>
			<xsl:value-of select="$arec/agi_a2_wages_year3"/>
		</agi_a2_wages_year3>
		<agi_a20_keogh_year1>
			<xsl:value-of select="$arec/agi_a20_keogh_year1"/>
		</agi_a20_keogh_year1>
		<agi_a20_keogh_year2>
			<xsl:value-of select="$arec/agi_a20_keogh_year2"/>
		</agi_a20_keogh_year2>
		<agi_a20_keogh_year3>
			<xsl:value-of select="$arec/agi_a20_keogh_year3"/>
		</agi_a20_keogh_year3>
		<agi_a21_earlywithdrawal_year1>
			<xsl:value-of select="$arec/agi_a21_earlywithdrawal_year1"/>
		</agi_a21_earlywithdrawal_year1>
		<agi_a21_earlywithdrawal_year2>
			<xsl:value-of select="$arec/agi_a21_earlywithdrawal_year2"/>
		</agi_a21_earlywithdrawal_year2>
		<agi_a21_earlywithdrawal_year3>
			<xsl:value-of select="$arec/agi_a21_earlywithdrawal_year3"/>
		</agi_a21_earlywithdrawal_year3>
		<agi_a22_alimonypaid_year1>
			<xsl:value-of select="$arec/agi_a22_alimonypaid_year1"/>
		</agi_a22_alimonypaid_year1>
		<agi_a22_alimonypaid_year2>
			<xsl:value-of select="$arec/agi_a22_alimonypaid_year2"/>
		</agi_a22_alimonypaid_year2>
		<agi_a22_alimonypaid_year3>
			<xsl:value-of select="$arec/agi_a22_alimonypaid_year3"/>
		</agi_a22_alimonypaid_year3>
		<agi_a23_form2106_year1>
			<xsl:value-of select="$arec/agi_a23_form2106_year1"/>
		</agi_a23_form2106_year1>
		<agi_a23_form2106_year2>
			<xsl:value-of select="$arec/agi_a23_form2106_year2"/>
		</agi_a23_form2106_year2>
		<agi_a23_form2106_year3>
			<xsl:value-of select="$arec/agi_a23_form2106_year3"/>
		</agi_a23_form2106_year3>
		<agi_a24_form4562_year1>
			<xsl:value-of select="$arec/agi_a24_form4562_year1"/>
		</agi_a24_form4562_year1>
		<agi_a24_form4562_year2>
			<xsl:value-of select="$arec/agi_a24_form4562_year2"/>
		</agi_a24_form4562_year2>
		<agi_a24_form4562_year3>
			<xsl:value-of select="$arec/agi_a24_form4562_year3"/>
		</agi_a24_form4562_year3>
		<agi_a3_taxint_year1>
			<xsl:value-of select="$arec/agi_a3_taxint_year1"/>
		</agi_a3_taxint_year1>
		<agi_a3_taxint_year2>
			<xsl:value-of select="$arec/agi_a3_taxint_year2"/>
		</agi_a3_taxint_year2>
		<agi_a3_taxint_year3>
			<xsl:value-of select="$arec/agi_a3_taxint_year3"/>
		</agi_a3_taxint_year3>
		<agi_a4_taxexemptint_year1>
			<xsl:value-of select="$arec/agi_a4_taxexemptint_year1"/>
		</agi_a4_taxexemptint_year1>
		<agi_a4_taxexemptint_year2>
			<xsl:value-of select="$arec/agi_a4_taxexemptint_year2"/>
		</agi_a4_taxexemptint_year2>
		<agi_a4_taxexemptint_year3>
			<xsl:value-of select="$arec/agi_a4_taxexemptint_year3"/>
		</agi_a4_taxexemptint_year3>
		<agi_a5_dividends_year1>
			<xsl:value-of select="$arec/agi_a5_dividends_year1"/>
		</agi_a5_dividends_year1>
		<agi_a5_dividends_year2>
			<xsl:value-of select="$arec/agi_a5_dividends_year2"/>
		</agi_a5_dividends_year2>
		<agi_a5_dividends_year3>
			<xsl:value-of select="$arec/agi_a5_dividends_year3"/>
		</agi_a5_dividends_year3>
		<agi_a6_refunds_year1>
			<xsl:value-of select="$arec/agi_a6_refunds_year1"/>
		</agi_a6_refunds_year1>
		<agi_a6_refunds_year2>
			<xsl:value-of select="$arec/agi_a6_refunds_year2"/>
		</agi_a6_refunds_year2>
		<agi_a6_refunds_year3>
			<xsl:value-of select="$arec/agi_a6_refunds_year3"/>
		</agi_a6_refunds_year3>
		<agi_a7_alimony_year1>
			<xsl:value-of select="$arec/agi_a7_alimony_year1"/>
		</agi_a7_alimony_year1>
		<agi_a7_alimony_year2>
			<xsl:value-of select="$arec/agi_a7_alimony_year2"/>
		</agi_a7_alimony_year2>
		<agi_a7_alimony_year3>
			<xsl:value-of select="$arec/agi_a7_alimony_year3"/>
		</agi_a7_alimony_year3>
		<cf_1_totalincome_year1>
			<xsl:value-of select="$crec/cf_1_totalincome_year1"/>
		</cf_1_totalincome_year1>
		<cf_1_totalincome_year2>
			<xsl:value-of select="$crec/cf_1_totalincome_year2"/>
		</cf_1_totalincome_year2>
		<cf_11_nrother_year1>
			<xsl:value-of select="$crec/cf_11_nrother_year1"/>
		</cf_11_nrother_year1>
		<cf_11_nrother_year2>
			<xsl:value-of select="$crec/cf_11_nrother_year2"/>
		</cf_11_nrother_year2>
		<cf_12_other_year1>
			<xsl:value-of select="$crec/cf_12_other_year1"/>
		</cf_12_other_year1>
		<cf_12_other_year2>
			<xsl:value-of select="$crec/cf_12_other_year2"/>
		</cf_12_other_year2>
		<cf_12_otherdescr>
			<xsl:value-of select="$crec/cf_12_otherdescr"/>
		</cf_12_otherdescr>
		<cf_14_depreciation_year1>
			<xsl:value-of select="$crec/cf_14_depreciation_year1"/>
		</cf_14_depreciation_year1>
		<cf_14_depreciation_year2>
			<xsl:value-of select="$crec/cf_14_depreciation_year2"/>
		</cf_14_depreciation_year2>
		<cf_24_propcapitalgains_year1>
			<xsl:value-of select="$crec/cf_24_propcapitalgains_year1"/>
		</cf_24_propcapitalgains_year1>
		<cf_24_propcapitalgains_year2>
			<xsl:value-of select="$crec/cf_24_propcapitalgains_year2"/>
		</cf_24_propcapitalgains_year2>
		<cf_25_principalrcvd_year1>
			<xsl:value-of select="$crec/cf_25_principalrcvd_year1"/>
		</cf_25_principalrcvd_year1>
		<cf_25_principalrcvd_year2>
			<xsl:value-of select="$crec/cf_25_principalrcvd_year2"/>
		</cf_25_principalrcvd_year2>
		<cf_6_schedd_year1>
			<xsl:value-of select="$crec/cf_6_schedd_year1"/>
		</cf_6_schedd_year1>
		<cf_6_schedd_year2>
			<xsl:value-of select="$crec/cf_6_schedd_year2"/>
		</cf_6_schedd_year2>
		<cf_7_pensioniradistrb_year1>
			<xsl:value-of select="$crec/cf_7_pensioniradistrb_year1"/>
		</cf_7_pensioniradistrb_year1>
		<cf_7_pensioniradistrb_year2>
			<xsl:value-of select="$crec/cf_7_pensioniradistrb_year2"/>
		</cf_7_pensioniradistrb_year2>
		<cf_8_schede_year1>
			<xsl:value-of select="$crec/cf_8_schede_year1"/>
		</cf_8_schede_year1>
		<cf_8_schede_year2>
			<xsl:value-of select="$crec/cf_8_schede_year2"/>
		</cf_8_schede_year2>
		<cf_c17_nrother_year1>
			<xsl:value-of select="$crec/cf_c17_nrother_year1"/>
		</cf_c17_nrother_year1>
		<cf_c17_nrother_year2>
			<xsl:value-of select="$crec/cf_c17_nrother_year2"/>
		</cf_c17_nrother_year2>
		<cf_c21_bususeofhome_year1>
			<xsl:value-of select="$crec/cf_c21_bususeofhome_year1"/>
		</cf_c21_bususeofhome_year1>
		<cf_c21_bususeofhome_year2>
			<xsl:value-of select="$crec/cf_c21_bususeofhome_year2"/>
		</cf_c21_bususeofhome_year2>
		<cf_c22_amortizationloss_year1>
			<xsl:value-of select="$crec/cf_c22_amortizationloss_year1"/>
		</cf_c22_amortizationloss_year1>
		<cf_c22_amortizationloss_year2>
			<xsl:value-of select="$crec/cf_c22_amortizationloss_year2"/>
		</cf_c22_amortizationloss_year2>
		<cf_e26_grossrentsrcvd_year1>
			<xsl:value-of select="$crec/cf_e26_grossrentsrcvd_year1"/>
		</cf_e26_grossrentsrcvd_year1>
		<cf_e26_grossrentsrcvd_year2>
			<xsl:value-of select="$crec/cf_e26_grossrentsrcvd_year2"/>
		</cf_e26_grossrentsrcvd_year2>
		<cf_e27_totalbeforedepr_year1>
			<xsl:value-of select="$crec/cf_e27_totalbeforedepr_year1"/>
		</cf_e27_totalbeforedepr_year1>
		<cf_e27_totalbeforedepr_year2>
			<xsl:value-of select="$crec/cf_e27_totalbeforedepr_year2"/>
		</cf_e27_totalbeforedepr_year2>
		<cf_e28_amortizationloss_year1>
			<xsl:value-of select="$crec/cf_e28_amortizationloss_year1"/>
		</cf_e28_amortizationloss_year1>
		<cf_e28_amortizationloss_year2>
			<xsl:value-of select="$crec/cf_e28_amortizationloss_year2"/>
		</cf_e28_amortizationloss_year2>
		<cf_e29_tandi_year1>
			<xsl:value-of select="$crec/cf_e29_tandi_year1"/>
		</cf_e29_tandi_year1>
		<cf_e29_tandi_year2>
			<xsl:value-of select="$crec/cf_e29_tandi_year2"/>
		</cf_e29_tandi_year2>
		<cf_f30_cccpayments_year1>
			<xsl:value-of select="$crec/cf_f30_cccpayments_year1"/>
		</cf_f30_cccpayments_year1>
		<cf_f30_cccpayments_year2>
			<xsl:value-of select="$crec/cf_f30_cccpayments_year2"/>
		</cf_f30_cccpayments_year2>
		<cf_f31_nrother_year1>
			<xsl:value-of select="$crec/cf_f31_nrother_year1"/>
		</cf_f31_nrother_year1>
		<cf_f31_nrother_year2>
			<xsl:value-of select="$crec/cf_f31_nrother_year2"/>
		</cf_f31_nrother_year2>
		<cf_f33_amortization_year1>
			<xsl:value-of select="$crec/cf_f33_amortization_year1"/>
		</cf_f33_amortization_year1>
		<cf_f33_amortization_year2>
			<xsl:value-of select="$crec/cf_f33_amortization_year2"/>
		</cf_f33_amortization_year2>
		<cf_f34_bususeofhome_year1>
			<xsl:value-of select="$crec/cf_f34_bususeofhome_year1"/>
		</cf_f34_bususeofhome_year1>
		<cf_f34_bususeofhome_year2>
			<xsl:value-of select="$crec/cf_f34_bususeofhome_year2"/>
		</cf_f34_bususeofhome_year2>
		<cf_k35_ordinaryinc_year1>
			<xsl:value-of select="$crec/cf_k35_ordinaryinc_year1"/>
		</cf_k35_ordinaryinc_year1>
		<cf_k35_ordinaryinc_year2>
			<xsl:value-of select="$crec/cf_k35_ordinaryinc_year2"/>
		</cf_k35_ordinaryinc_year2>
		<cf_k36_netincome_year1>
			<xsl:value-of select="$crec/cf_k36_netincome_year1"/>
		</cf_k36_netincome_year1>
		<cf_k36_netincome_year2>
			<xsl:value-of select="$crec/cf_k36_netincome_year2"/>
		</cf_k36_netincome_year2>
		<cf_k37_ptop_year1>
			<xsl:value-of select="$crec/cf_k37_ptop_year1"/>
		</cf_k37_ptop_year1>
		<cf_k37_ptop_year2>
			<xsl:value-of select="$crec/cf_k37_ptop_year2"/>
		</cf_k37_ptop_year2>
		<cf_p40_passthrough_year1>
			<xsl:value-of select="$crec/cf_p40_passthrough_year1"/>
		</cf_p40_passthrough_year1>
		<cf_p40_passthrough_year2>
			<xsl:value-of select="$crec/cf_p40_passthrough_year2"/>
		</cf_p40_passthrough_year2>
		<cf_p41_nrother_year1>
			<xsl:value-of select="$crec/cf_p41_nrother_year1"/>
		</cf_p41_nrother_year1>
		<cf_p41_nrother_year2>
			<xsl:value-of select="$crec/cf_p41_nrother_year2"/>
		</cf_p41_nrother_year2>
		<cf_p42_depreciation_year1>
			<xsl:value-of select="$crec/cf_p42_depreciation_year1"/>
		</cf_p42_depreciation_year1>
		<cf_p42_depreciation_year2>
			<xsl:value-of select="$crec/cf_p42_depreciation_year2"/>
		</cf_p42_depreciation_year2>
		<cf_p43_depletion_year1>
			<xsl:value-of select="$crec/cf_p43_depletion_year1"/>
		</cf_p43_depletion_year1>
		<cf_p43_depletion_year2>
			<xsl:value-of select="$crec/cf_p43_depletion_year2"/>
		</cf_p43_depletion_year2>
		<cf_p44_amortization_year1>
			<xsl:value-of select="$crec/cf_p44_amortization_year1"/>
		</cf_p44_amortization_year1>
		<cf_p44_amortization_year2>
			<xsl:value-of select="$crec/cf_p44_amortization_year2"/>
		</cf_p44_amortization_year2>
		<cf_p45_mortgage_year1>
			<xsl:value-of select="$crec/cf_p45_mortgage_year1"/>
		</cf_p45_mortgage_year1>
		<cf_p45_mortgage_year2>
			<xsl:value-of select="$crec/cf_p45_mortgage_year2"/>
		</cf_p45_mortgage_year2>
		<cf_p46_meals_year1>
			<xsl:value-of select="$crec/cf_p46_meals_year1"/>
		</cf_p46_meals_year1>
		<cf_p46_meals_year2>
			<xsl:value-of select="$crec/cf_p46_meals_year2"/>
		</cf_p46_meals_year2>
		<cf_rc59_nrgains_year1>
			<xsl:value-of select="$crec/cf_rc59_nrgains_year1"/>
		</cf_rc59_nrgains_year1>
		<cf_rc59_nrgains_year2>
			<xsl:value-of select="$crec/cf_rc59_nrgains_year2"/>
		</cf_rc59_nrgains_year2>
		<cf_rc60_nrother_year1>
			<xsl:value-of select="$crec/cf_rc60_nrother_year1"/>
		</cf_rc60_nrother_year1>
		<cf_rc60_nrother_year2>
			<xsl:value-of select="$crec/cf_rc60_nrother_year2"/>
		</cf_rc60_nrother_year2>
		<cf_rc63_amortization_year1>
			<xsl:value-of select="$crec/cf_rc63_amortization_year1"/>
		</cf_rc63_amortization_year1>
		<cf_rc63_amortization_year2>
			<xsl:value-of select="$crec/cf_rc63_amortization_year2"/>
		</cf_rc63_amortization_year2>
		<cf_rc64_netoploss_year1>
			<xsl:value-of select="$crec/cf_rc64_netoploss_year1"/>
		</cf_rc64_netoploss_year1>
		<cf_rc64_netoploss_year2>
			<xsl:value-of select="$crec/cf_rc64_netoploss_year2"/>
		</cf_rc64_netoploss_year2>
		<cf_rc66_meals_year1>
			<xsl:value-of select="$crec/cf_rc66_meals_year1"/>
		</cf_rc66_meals_year1>
		<cf_rc66_meals_year2>
			<xsl:value-of select="$crec/cf_rc66_meals_year2"/>
		</cf_rc66_meals_year2>
		<cf_sc49_nrother_year1>
			<xsl:value-of select="$crec/cf_sc49_nrother_year1"/>
		</cf_sc49_nrother_year1>
		<cf_sc49_nrother_year2>
			<xsl:value-of select="$crec/cf_sc49_nrother_year2"/>
		</cf_sc49_nrother_year2>
		<cf_sc52_amortization_year1>
			<xsl:value-of select="$crec/cf_sc52_amortization_year1"/>
		</cf_sc52_amortization_year1>
		<cf_sc52_amortization_year2>
			<xsl:value-of select="$crec/cf_sc52_amortization_year2"/>
		</cf_sc52_amortization_year2>
		<cf_sc54_meals_year1>
			<xsl:value-of select="$crec/cf_sc54_meals_year1"/>
		</cf_sc54_meals_year1>
		<cf_sc54_meals_year2>
			<xsl:value-of select="$crec/cf_sc54_meals_year2"/>
		</cf_sc54_meals_year2>
		<cf_sk38_ordinaryinc_year1>
			<xsl:value-of select="$crec/cf_sk38_ordinaryinc_year1"/>
		</cf_sk38_ordinaryinc_year1>
		<cf_sk38_ordinaryinc_year2>
			<xsl:value-of select="$crec/cf_sk38_ordinaryinc_year2"/>
		</cf_sk38_ordinaryinc_year2>
		<cf_sk39_netinc_year1>
			<xsl:value-of select="$crec/cf_sk39_netinc_year1"/>
		</cf_sk39_netinc_year1>
		<cf_sk39_netinc_year2>
			<xsl:value-of select="$crec/cf_sk39_netinc_year2"/>
		</cf_sk39_netinc_year2>
		<sa_year1>
			<xsl:value-of select="$srec/year1"/>
		</sa_year1>
		<sa_year2>
			<xsl:value-of select="$srec/year2"/>
		</sa_year2>
		<sa_year3>
			<xsl:value-of select="$srec/year3"/>
		</sa_year3>
		<sa_a1a_netprofitorloss_year1>
			<xsl:value-of select="$srec/a1a_netprofitorloss_year1"/>
		</sa_a1a_netprofitorloss_year1>
		<sa_a1a_netprofitorloss_year2>
			<xsl:value-of select="$srec/a1a_netprofitorloss_year2"/>
		</sa_a1a_netprofitorloss_year2>
		<sa_a1a_netprofitorloss_year3>
			<xsl:value-of select="$srec/a1a_netprofitorloss_year3"/>
		</sa_a1a_netprofitorloss_year3>
		<sa_a1b_depletion_year1>
			<xsl:value-of select="$srec/a1b_depletion_year1"/>
		</sa_a1b_depletion_year1>
		<sa_a1b_depletion_year2>
			<xsl:value-of select="$srec/a1b_depletion_year2"/>
		</sa_a1b_depletion_year2>
		<sa_a1b_depletion_year3>
			<xsl:value-of select="$srec/a1b_depletion_year3"/>
		</sa_a1b_depletion_year3>
		<sa_a1c_depreciation_year1>
			<xsl:value-of select="$srec/a1c_depreciation_year1"/>
		</sa_a1c_depreciation_year1>
		<sa_a1c_depreciation_year2>
			<xsl:value-of select="$srec/a1c_depreciation_year2"/>
		</sa_a1c_depreciation_year2>
		<sa_a1c_depreciation_year3>
			<xsl:value-of select="$srec/a1c_depreciation_year3"/>
		</sa_a1c_depreciation_year3>
		<sa_a1d_mealexclusion_year1>
			<xsl:value-of select="$srec/a1d_mealexclusion_year1"/>
		</sa_a1d_mealexclusion_year1>
		<sa_a1d_mealexclusion_year2>
			<xsl:value-of select="$srec/a1d_mealexclusion_year2"/>
		</sa_a1d_mealexclusion_year2>
		<sa_a1d_mealexclusion_year3>
			<xsl:value-of select="$srec/a1d_mealexclusion_year3"/>
		</sa_a1d_mealexclusion_year3>
		<sa_a2_reccapitalgains_year1>
			<xsl:value-of select="$srec/a2_reccapitalgains_year1"/>
		</sa_a2_reccapitalgains_year1>
		<sa_a2_reccapitalgains_year2>
			<xsl:value-of select="$srec/a2_reccapitalgains_year2"/>
		</sa_a2_reccapitalgains_year2>
		<sa_a2_reccapitalgains_year3>
			<xsl:value-of select="$srec/a2_reccapitalgains_year3"/>
		</sa_a2_reccapitalgains_year3>
		<sa_a3a_netprofitorloss_year1>
			<xsl:value-of select="$srec/a3a_netprofitorloss_year1"/>
		</sa_a3a_netprofitorloss_year1>
		<sa_a3a_netprofitorloss_year2>
			<xsl:value-of select="$srec/a3a_netprofitorloss_year2"/>
		</sa_a3a_netprofitorloss_year2>
		<sa_a3a_netprofitorloss_year3>
			<xsl:value-of select="$srec/a3a_netprofitorloss_year3"/>
		</sa_a3a_netprofitorloss_year3>
		<sa_a3b_depreciation_year1>
			<xsl:value-of select="$srec/a3b_depreciation_year1"/>
		</sa_a3b_depreciation_year1>
		<sa_a3b_depreciation_year2>
			<xsl:value-of select="$srec/a3b_depreciation_year2"/>
		</sa_a3b_depreciation_year2>
		<sa_a3b_depreciation_year3>
			<xsl:value-of select="$srec/a3b_depreciation_year3"/>
		</sa_a3b_depreciation_year3>
		<sa_a4a_1065income_year1>
			<xsl:value-of select="$srec/a4a_1065income_year1"/>
		</sa_a4a_1065income_year1>
		<sa_a4a_1065income_year2>
			<xsl:value-of select="$srec/a4a_1065income_year2"/>
		</sa_a4a_1065income_year2>
		<sa_a4a_1065income_year3>
			<xsl:value-of select="$srec/a4a_1065income_year3"/>
		</sa_a4a_1065income_year3>
		<sa_a4b_1120sincome_year1>
			<xsl:value-of select="$srec/a4b_1120sincome_year1"/>
		</sa_a4b_1120sincome_year1>
		<sa_a4b_1120sincome_year2>
			<xsl:value-of select="$srec/a4b_1120sincome_year2"/>
		</sa_a4b_1120sincome_year2>
		<sa_a4b_1120sincome_year3>
			<xsl:value-of select="$srec/a4b_1120sincome_year3"/>
		</sa_a4b_1120sincome_year3>
		<sa_a5_totalexpense_year1>
			<xsl:value-of select="$srec/a5_totalexpense_year1"/>
		</sa_a5_totalexpense_year1>
		<sa_a5_totalexpense_year2>
			<xsl:value-of select="$srec/a5_totalexpense_year2"/>
		</sa_a5_totalexpense_year2>
		<sa_a5_totalexpense_year3>
			<xsl:value-of select="$srec/a5_totalexpense_year3"/>
		</sa_a5_totalexpense_year3>
		<sa_a6_w2incomecorp_year1>
			<xsl:value-of select="$srec/a6_w2incomecorp_year1"/>
		</sa_a6_w2incomecorp_year1>
		<sa_a6_w2incomecorp_year2>
			<xsl:value-of select="$srec/a6_w2incomecorp_year2"/>
		</sa_a6_w2incomecorp_year2>
		<sa_a6_w2incomecorp_year3>
			<xsl:value-of select="$srec/a6_w2incomecorp_year3"/>
		</sa_a6_w2incomecorp_year3>
		<sa_b1_taxableincome_year1>
			<xsl:value-of select="$srec/b1_taxableincome_year1"/>
		</sa_b1_taxableincome_year1>
		<sa_b1_taxableincome_year2>
			<xsl:value-of select="$srec/b1_taxableincome_year2"/>
		</sa_b1_taxableincome_year2>
		<sa_b1_taxableincome_year3>
			<xsl:value-of select="$srec/b1_taxableincome_year3"/>
		</sa_b1_taxableincome_year3>
		<sa_b2_totaltax_year1>
			<xsl:value-of select="$srec/b2_totaltax_year1"/>
		</sa_b2_totaltax_year1>
		<sa_b2_totaltax_year2>
			<xsl:value-of select="$srec/b2_totaltax_year2"/>
		</sa_b2_totaltax_year2>
		<sa_b2_totaltax_year3>
			<xsl:value-of select="$srec/b2_totaltax_year3"/>
		</sa_b2_totaltax_year3>
		<sa_b3_depreciation_year1>
			<xsl:value-of select="$srec/b3_depreciation_year1"/>
		</sa_b3_depreciation_year1>
		<sa_b3_depreciation_year2>
			<xsl:value-of select="$srec/b3_depreciation_year2"/>
		</sa_b3_depreciation_year2>
		<sa_b3_depreciation_year3>
			<xsl:value-of select="$srec/b3_depreciation_year3"/>
		</sa_b3_depreciation_year3>
		<sa_b4_depletion_year1>
			<xsl:value-of select="$srec/b4_depletion_year1"/>
		</sa_b4_depletion_year1>
		<sa_b4_depletion_year2>
			<xsl:value-of select="$srec/b4_depletion_year2"/>
		</sa_b4_depletion_year2>
		<sa_b4_depletion_year3>
			<xsl:value-of select="$srec/b4_depletion_year3"/>
		</sa_b4_depletion_year3>
		<sa_b5_mortgages_year1>
			<xsl:value-of select="$srec/b5_mortgages_year1"/>
		</sa_b5_mortgages_year1>
		<sa_b5_mortgages_year2>
			<xsl:value-of select="$srec/b5_mortgages_year2"/>
		</sa_b5_mortgages_year2>
		<sa_b5_mortgages_year3>
			<xsl:value-of select="$srec/b5_mortgages_year3"/>
		</sa_b5_mortgages_year3>
		<sa_b7_ownershippercent_year1>
			<xsl:value-of select="$srec/b7_ownershippercent_year1"/>
		</sa_b7_ownershippercent_year1>
		<sa_b7_ownershippercent_year2>
			<xsl:value-of select="$srec/b7_ownershippercent_year2"/>
		</sa_b7_ownershippercent_year2>
		<sa_b7_ownershippercent_year3>
			<xsl:value-of select="$srec/b7_ownershippercent_year3"/>
		</sa_b7_ownershippercent_year3>
		<sa_b9_dividendincome_year1>
			<xsl:value-of select="$srec/b9_dividendincome_year1"/>
		</sa_b9_dividendincome_year1>
		<sa_b9_dividendincome_year2>
			<xsl:value-of select="$srec/b9_dividendincome_year2"/>
		</sa_b9_dividendincome_year2>
		<sa_b9_dividendincome_year3>
			<xsl:value-of select="$srec/b9_dividendincome_year3"/>
		</sa_b9_dividendincome_year3>
		<sa_c1_depreciation_year1>
			<xsl:value-of select="$srec/c1_depreciation_year1"/>
		</sa_c1_depreciation_year1>
		<sa_c1_depreciation_year2>
			<xsl:value-of select="$srec/c1_depreciation_year2"/>
		</sa_c1_depreciation_year2>
		<sa_c1_depreciation_year3>
			<xsl:value-of select="$srec/c1_depreciation_year3"/>
		</sa_c1_depreciation_year3>
		<sa_c2_depletion_year1>
			<xsl:value-of select="$srec/c2_depletion_year1"/>
		</sa_c2_depletion_year1>
		<sa_c2_depletion_year2>
			<xsl:value-of select="$srec/c2_depletion_year2"/>
		</sa_c2_depletion_year2>
		<sa_c2_depletion_year3>
			<xsl:value-of select="$srec/c2_depletion_year3"/>
		</sa_c2_depletion_year3>
		<sa_c3_mortgages_year1>
			<xsl:value-of select="$srec/c3_mortgages_year1"/>
		</sa_c3_mortgages_year1>
		<sa_c3_mortgages_year2>
			<xsl:value-of select="$srec/c3_mortgages_year2"/>
		</sa_c3_mortgages_year2>
		<sa_c3_mortgages_year3>
			<xsl:value-of select="$srec/c3_mortgages_year3"/>
		</sa_c3_mortgages_year3>
		<sa_c5_ownershippercent_year1>
			<xsl:value-of select="$srec/c5_ownershippercent_year1"/>
		</sa_c5_ownershippercent_year1>
		<sa_c5_ownershippercent_year2>
			<xsl:value-of select="$srec/c5_ownershippercent_year2"/>
		</sa_c5_ownershippercent_year2>
		<sa_c5_ownershippercent_year3>
			<xsl:value-of select="$srec/c5_ownershippercent_year3"/>
		</sa_c5_ownershippercent_year3>
		<sa_d_numberofmonths>
			<xsl:value-of select="$srec/d_numberofmonths"/>
		</sa_d_numberofmonths>
		<sa_d1_salarydraws>
			<xsl:value-of select="$srec/d1_salarydraws"/>
		</sa_d1_salarydraws>
		<sa_d2_addbackamount1>
			<xsl:value-of select="$srec/d2_addbackamount1"/>
		</sa_d2_addbackamount1>
		<sa_d2_ownershippercent>
			<xsl:value-of select="$srec/d2_ownershippercent"/>
		</sa_d2_ownershippercent>
		<sa_d3_netprofitamount1>
			<xsl:value-of select="$srec/d3_netprofitamount1"/>
		</sa_d3_netprofitamount1>
	</xsl:template>

</xsl:stylesheet>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial