Project

Profile

Help

Bug #1467 ยป test.xsl

Michael Kay, 2012-03-28 07:30

 
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://ACORD.org/Standards/Life/2" xmlns:vmf="http://www.altova.com/MapForce/UDF/vmf" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="ns0 vmf xs fn">
<xsl:template name="vmf:vmf1_inputtoresult">
<xsl:param name="input" select="()"/>
<xsl:choose>
<xsl:when test="$input='1'">
<xsl:value-of select="'ONE'"/>
</xsl:when>
<xsl:when test="$input='01'">
<xsl:value-of select="'ONE'"/>
</xsl:when>
<xsl:when test="$input='2'">
<xsl:value-of select="'TWO'"/>
</xsl:when>
<xsl:when test="$input='02'">
<xsl:value-of select="'TWO'"/>
</xsl:when>
<xsl:when test="$input='3'">
<xsl:value-of select="'THREE'"/>
</xsl:when>
<xsl:when test="$input='03'">
<xsl:value-of select="'THREE'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'ONE'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:variable name="var1_TXLife" as="node()?" select="ns0:TXLife"/>
<xsl:variable name="var3_result" as="xs:boolean?">
<xsl:for-each select="$var1_TXLife">
<xsl:variable name="var2_result" as="xs:boolean*">
<xsl:for-each select="ns0:TXLifeRequest">
<xsl:sequence select="fn:exists(ns0:InquiryLevel)"/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="fn:exists($var2_result[.])"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var4_resultof_any" as="xs:boolean" select="fn:exists($var3_result[.])"/>
<tns:searchByClientExample xmlns:tns="http://www.nylaarp.com/services/data/lsp">
<client>
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest">
<xsl:variable name="var5_CriteriaExpression" as="xs:QName" select="fn:QName('http://ACORD.org/Standards/Life/2', 'CriteriaExpression')"/>
<xsl:for-each select="ns0:CriteriaExpression/ns0:CriteriaExpression/ns0:Criteria">
<xsl:variable name="var6_cur" as="node()" select="."/>
<xsl:for-each select="ns0:PropertyValue[(fn:string($var6_cur/ns0:PropertyName) = 'DialNumber')]">
<addresses>
<address>
<cyhphe>
<xsl:sequence select="fn:string(.)"/>
</cyhphe>
</address>
</addresses>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest">
<xsl:variable name="var7_CriteriaExpression" as="xs:QName" select="fn:QName('http://ACORD.org/Standards/Life/2', 'CriteriaExpression')"/>
<xsl:for-each select="ns0:CriteriaExpression/ns0:CriteriaExpression/ns0:Criteria">
<xsl:variable name="var16_cur" as="node()" select="."/>
<xsl:for-each select="ns0:PropertyValue[(fn:string($var16_cur/ns0:PropertyName) = 'BirthDate')]">
<xsl:variable name="var8_resultof_cast" as="xs:string" select="fn:string(.)"/>
<xsl:variable name="var9_resultof_substring_after" as="xs:string" select="fn:substring-after($var8_resultof_cast, '/')"/>
<xsl:variable name="var10_resultof_substring_after" as="xs:string" select="fn:substring-after($var9_resultof_substring_after, '/')"/>
<xsl:choose>
<xsl:when test="(fn:string-length($var10_resultof_substring_after) != xs:decimal('4'))">
<xsl:sequence select="fn:error(fn:QName('http://www.altova.com/mapforce', 'mapforce:exception'), 'Invalid Year: Must be 4 digits')"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="var11_resultof_substring_before" as="xs:string" select="fn:substring-before($var8_resultof_cast, '/')"/>
<xsl:variable name="var12_resultof_substring_before" as="xs:string" select="fn:substring-before($var9_resultof_substring_after, '/')"/>
<xsl:variable name="var13_result" as="xs:string">
<xsl:choose>
<xsl:when test="(fn:string-length($var11_resultof_substring_before) != xs:decimal('2'))">
<xsl:sequence select="fn:concat(xs:string(xs:decimal('0')), $var11_resultof_substring_before)"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="$var11_resultof_substring_before"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="var14_result" as="xs:string">
<xsl:choose>
<xsl:when test="(fn:string-length($var12_resultof_substring_before) != xs:decimal('2'))">
<xsl:sequence select="fn:concat(xs:string(xs:decimal('0')), $var12_resultof_substring_before)"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="$var12_resultof_substring_before"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="var15_resultof_concat" as="xs:string" select="fn:concat(fn:concat(fn:concat(fn:concat($var10_resultof_substring_after, '-'), $var13_result), '-'), $var14_result)"/>
<xsl:choose>
<xsl:when test="($var15_resultof_concat != '0000-00-00')">
<cmdobd>
<xsl:sequence select="xs:string(fn:day-from-date(xs:date($var15_resultof_concat)))"/>
</cmdobd>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="fn:error(fn:QName('http://www.altova.com/mapforce', 'mapforce:exception'), 'Invalid Date: 0000-00-00')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest">
<xsl:variable name="var17_CriteriaExpression" as="xs:QName" select="fn:QName('http://ACORD.org/Standards/Life/2', 'CriteriaExpression')"/>
<xsl:for-each select="ns0:CriteriaExpression/ns0:CriteriaExpression/ns0:Criteria">
<xsl:variable name="var26_cur" as="node()" select="."/>
<xsl:for-each select="ns0:PropertyValue[(fn:string($var26_cur/ns0:PropertyName) = 'BirthDate')]">
<xsl:variable name="var18_resultof_cast" as="xs:string" select="fn:string(.)"/>
<xsl:variable name="var19_resultof_substring_after" as="xs:string" select="fn:substring-after($var18_resultof_cast, '/')"/>
<xsl:variable name="var20_resultof_substring_after" as="xs:string" select="fn:substring-after($var19_resultof_substring_after, '/')"/>
<xsl:choose>
<xsl:when test="(fn:string-length($var20_resultof_substring_after) != xs:decimal('4'))">
<xsl:sequence select="fn:error(fn:QName('http://www.altova.com/mapforce', 'mapforce:exception'), 'Invalid Year: Must be 4 digits')"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="var21_resultof_substring_before" as="xs:string" select="fn:substring-before($var18_resultof_cast, '/')"/>
<xsl:variable name="var22_resultof_substring_before" as="xs:string" select="fn:substring-before($var19_resultof_substring_after, '/')"/>
<xsl:variable name="var23_result" as="xs:string">
<xsl:choose>
<xsl:when test="(fn:string-length($var21_resultof_substring_before) != xs:decimal('2'))">
<xsl:sequence select="fn:concat(xs:string(xs:decimal('0')), $var21_resultof_substring_before)"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="$var21_resultof_substring_before"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="var24_result" as="xs:string">
<xsl:choose>
<xsl:when test="(fn:string-length($var22_resultof_substring_before) != xs:decimal('2'))">
<xsl:sequence select="fn:concat(xs:string(xs:decimal('0')), $var22_resultof_substring_before)"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="$var22_resultof_substring_before"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="var25_resultof_concat" as="xs:string" select="fn:concat(fn:concat(fn:concat(fn:concat($var20_resultof_substring_after, '-'), $var23_result), '-'), $var24_result)"/>
<xsl:choose>
<xsl:when test="($var25_resultof_concat != '0000-00-00')">
<cmdobm>
<xsl:sequence select="xs:string(fn:month-from-date(xs:date($var25_resultof_concat)))"/>
</cmdobm>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="fn:error(fn:QName('http://www.altova.com/mapforce', 'mapforce:exception'), 'Invalid Date: 0000-00-00')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest">
<xsl:variable name="var27_CriteriaExpression" as="xs:QName" select="fn:QName('http://ACORD.org/Standards/Life/2', 'CriteriaExpression')"/>
<xsl:for-each select="ns0:CriteriaExpression/ns0:CriteriaExpression/ns0:Criteria">
<xsl:variable name="var36_cur" as="node()" select="."/>
<xsl:for-each select="ns0:PropertyValue[(fn:string($var36_cur/ns0:PropertyName) = 'BirthDate')]">
<xsl:variable name="var28_resultof_cast" as="xs:string" select="fn:string(.)"/>
<xsl:variable name="var29_resultof_substring_after" as="xs:string" select="fn:substring-after($var28_resultof_cast, '/')"/>
<xsl:variable name="var30_resultof_substring_after" as="xs:string" select="fn:substring-after($var29_resultof_substring_after, '/')"/>
<xsl:choose>
<xsl:when test="(fn:string-length($var30_resultof_substring_after) != xs:decimal('4'))">
<xsl:sequence select="fn:error(fn:QName('http://www.altova.com/mapforce', 'mapforce:exception'), 'Invalid Year: Must be 4 digits')"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="var31_resultof_substring_before" as="xs:string" select="fn:substring-before($var28_resultof_cast, '/')"/>
<xsl:variable name="var32_resultof_substring_before" as="xs:string" select="fn:substring-before($var29_resultof_substring_after, '/')"/>
<xsl:variable name="var33_result" as="xs:string">
<xsl:choose>
<xsl:when test="(fn:string-length($var31_resultof_substring_before) != xs:decimal('2'))">
<xsl:sequence select="fn:concat(xs:string(xs:decimal('0')), $var31_resultof_substring_before)"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="$var31_resultof_substring_before"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="var34_result" as="xs:string">
<xsl:choose>
<xsl:when test="(fn:string-length($var32_resultof_substring_before) != xs:decimal('2'))">
<xsl:sequence select="fn:concat(xs:string(xs:decimal('0')), $var32_resultof_substring_before)"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="$var32_resultof_substring_before"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="var35_resultof_concat" as="xs:string" select="fn:concat(fn:concat(fn:concat(fn:concat($var30_resultof_substring_after, '-'), $var33_result), '-'), $var34_result)"/>
<xsl:choose>
<xsl:when test="($var35_resultof_concat != '0000-00-00')">
<cmdoby>
<xsl:sequence select="xs:string(year-from-date(xs:date($var35_resultof_concat)))"/>
</cmdoby>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="fn:error(fn:QName('http://www.altova.com/mapforce', 'mapforce:exception'), 'Invalid Date: 0000-00-00')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest">
<xsl:variable name="var37_CriteriaExpression" as="xs:QName" select="fn:QName('http://ACORD.org/Standards/Life/2', 'CriteriaExpression')"/>
<xsl:for-each select="ns0:CriteriaExpression/ns0:CriteriaExpression/ns0:Criteria">
<xsl:variable name="var38_cur" as="node()" select="."/>
<xsl:for-each select="ns0:PropertyValue[(fn:string($var38_cur/ns0:PropertyName) = 'FullName')]">
<cmname>
<xsl:sequence select="fn:string(.)"/>
</cmname>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest">
<xsl:variable name="var39_CriteriaExpression" as="xs:QName" select="fn:QName('http://ACORD.org/Standards/Life/2', 'CriteriaExpression')"/>
<xsl:for-each select="ns0:CriteriaExpression/ns0:CriteriaExpression/ns0:Criteria">
<xsl:variable name="var40_cur" as="node()" select="."/>
<xsl:for-each select="ns0:PropertyValue[(fn:string($var40_cur/ns0:PropertyName) = 'Gender')]">
<cmsxcd>
<xsl:sequence select="fn:string(.)"/>
</cmsxcd>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest">
<xsl:variable name="var41_CriteriaExpression" as="xs:QName" select="fn:QName('http://ACORD.org/Standards/Life/2', 'CriteriaExpression')"/>
<xsl:for-each select="ns0:CriteriaExpression/ns0:CriteriaExpression/ns0:Criteria">
<xsl:variable name="var42_cur" as="node()" select="."/>
<xsl:for-each select="ns0:PropertyValue[(fn:string($var42_cur/ns0:PropertyName) = 'GovtID')]">
<cmtidf>
<xsl:sequence select="xs:string(xs:decimal(fn:string(.)))"/>
</cmtidf>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</client>
<xsl:variable name="var48_result" as="xs:boolean">
<xsl:choose>
<xsl:when test="$var4_resultof_any">
<xsl:variable name="var44_result" as="xs:boolean?">
<xsl:for-each select="$var1_TXLife">
<xsl:variable name="var43_result" as="xs:boolean*">
<xsl:for-each select="ns0:TXLifeRequest">
<xsl:sequence select="fn:exists(ns0:InquiryLevel)"/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="fn:exists($var43_result[.])"/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="fn:exists($var44_result[.])"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="fn:true()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$var48_result">
<detailLevel>
<xsl:choose>
<xsl:when test="$var4_resultof_any">
<xsl:variable name="var46_result" as="xs:boolean?">
<xsl:for-each select="$var1_TXLife">
<xsl:variable name="var45_result" as="xs:boolean*">
<xsl:for-each select="ns0:TXLifeRequest">
<xsl:sequence select="fn:exists(ns0:InquiryLevel)"/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="fn:exists($var45_result[.])"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="fn:exists($var46_result[.])">
<xsl:variable name="var47_result" as="xs:string*">
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest/ns0:InquiryLevel">
<xsl:call-template name="vmf:vmf1_inputtoresult">
<xsl:with-param name="input" select="fn:string(@tc)" as="xs:string"/>
</xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="xs:string(fn:string-join(for $x in $var47_result return xs:string($x), ' '))"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="'ONE'"/>
</xsl:otherwise>
</xsl:choose>
</detailLevel>
</xsl:if>
<xsl:variable name="var49_let" as="xs:integer*">
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest/ns0:StartRecord">
<xsl:sequence select="xs:integer(fn:string(.))"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var50_result" as="xs:string+">
<xsl:choose>
<xsl:when test="fn:exists($var49_let)">
<xsl:for-each select="$var49_let">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="'0'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var50_result">
<start>
<xsl:sequence select="xs:string(xs:integer(.))"/>
</start>
</xsl:for-each>
<xsl:variable name="var51_let" as="xs:integer*">
<xsl:for-each select="$var1_TXLife/ns0:TXLifeRequest/ns0:MaxRecords">
<xsl:sequence select="xs:integer(fn:string(.))"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="var52_result" as="xs:string+">
<xsl:choose>
<xsl:when test="fn:exists($var51_let)">
<xsl:for-each select="$var51_let">
<xsl:sequence select="xs:string(.)"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="'500'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$var52_result">
<maxFetchSz>
<xsl:sequence select="xs:string(xs:integer(.))"/>
</maxFetchSz>
</xsl:for-each>
</tns:searchByClientExample>
</xsl:template>
</xsl:stylesheet>
    (1-1/1)