<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> 
  
  
  <xsl:template match="DATASET">
	<xsl:apply-templates />
  </xsl:template>
  
  
  <xsl:template match="RECORD[FIELD]">
	
		<TR><TD colspan="100%" BGCOLOR="#D9E2F2"></TD></TR>
	
		<TR>
	
		<xsl:for-each select="FIELD">
			<xsl:choose>
				<xsl:when test="HYPERLINK">
					<TD bgcolor="#c7d4eb">
					<font color="black" size="1"/>
					<A>
					<xsl:choose>
					
						<xsl:when test=".[@NAME='Balance']">
							<xsl:attribute name="HREF">
								<xsl:value-of select="HYPERLINK/URL" />
							</xsl:attribute>
							<xsl:value-of select="./@I18NVALUE" />
						</xsl:when>
						
						<xsl:otherwise>
							<xsl:attribute name="HREF">
								<xsl:value-of select="HYPERLINK/URL" />
							</xsl:attribute>
							<xsl:value-of select="HYPERLINK/VALUE" />
						</xsl:otherwise>
						
					</xsl:choose>
					</A>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='Amount']">
					<TD bgcolor="#c7d4eb">
					<font color="black" size="1"/>
					<xsl:value-of select="./@I18NVALUE"/>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='Balance']">
					<TD bgcolor="#c7d4eb">
					<font color="black" size="1"/>
					<xsl:value-of select="./@I18NVALUE"/>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='OrderDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='CurrentPlannedDeliveryDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
					
				<xsl:when test=".[@NAME='QuotationDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='Del.Date']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='DeliveryDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='PeriodDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='PlanDelDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='PlannedDeliveryDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				
				<xsl:when test=".[@NAME='EffectiveDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='ExpiryDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='DocumentDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				
				<xsl:when test=".[@NAME='ContractDate']">
					<TD bgcolor="#c7d4eb">
						<font color="black" size="1"/>
						 <xsl:eval>
						 	formatDateEx(this.text);
						 </xsl:eval>
					</TD>
				</xsl:when>
				  
				
				<xsl:when test="./@DISPLAYVALUE">
					<TD bgcolor="#c7d4eb"><font color="black" size="1"/><xsl:value-of select="./@DISPLAYVALUE"/></TD>
				</xsl:when>
				
				<xsl:otherwise>
					<TD bgcolor="#c7d4eb"><font color="black" size="1"/><xsl:value-of select="."/></TD>
				</xsl:otherwise>
				
			</xsl:choose>
			<TD bgcolor="#c7d4eb"></TD>
		</xsl:for-each>
		
		</TR>
		
	<xsl:apply-templates />
  </xsl:template>

  
  <xsl:template match="BACKENDDATA">
	<xsl:apply-templates />
  </xsl:template>

  
  <xsl:template match="/">
	<P/>
	<TABLE BORDER="0" width="80%" ALIGN="CENTER"  bgcolor="#20406E" cellspacing="0">
	<TR><TD height="25" colspan="100%">
		<font color="white" face="Arail,Verdana" point-size="11"/><b/><![CDATA[   ]]><xsl:value-of select="BACKENDDATA/DATASET/@NAME"/>
	</TD></TR>

	<TR>
	<xsl:for-each select="BACKENDDATA/DATASET/RECORD[0]">
	
			<xsl:for-each select="FIELD">	
				<xsl:choose>
				
					<xsl:when test="./@DISPLAYNAME">
						<TD BGCOLOR="#617FB3">
							<font color="white" face="Verdana" size="2"/><![CDATA[ ]]><xsl:value-of select="@DISPLAYNAME"/><![CDATA[ ]]>
						</TD>
						<TD BGCOLOR="#496087"></TD>
					</xsl:when>
					
					<xsl:otherwise>
						<TD BGCOLOR="#617FB3">
							<font color="white" face="Verdana" size="2"/><![CDATA[ ]]><xsl:value-of select="@NAME"/><![CDATA[ ]]>
						</TD>
						<TD BGCOLOR="#496087"></TD>
					</xsl:otherwise>
					
				</xsl:choose>
			</xsl:for-each>
		
			<xsl:for-each select=".//DATASET/RECORD[0]">
				<xsl:for-each select="FIELD">	
					<TD BGCOLOR="#617FB3">
						<font color="white" face="verdana" size="2"/><![CDATA[ ]]><xsl:value-of select="@NAME"/><![CDATA[ ]]>
					</TD>
					<TD BGCOLOR="#496087"></TD>
				</xsl:for-each>
			</xsl:for-each>
	</xsl:for-each>
	</TR>
	
	<xsl:apply-templates />
	
	<TR></TR>
	<TR></TR>
	<TR></TR>
	<TR><TD bgcolor="#617FB3" colspan="100%"/></TR>
	<TR><TD bgcolor="#617FB3" colspan="100%"/></TR>
	<TR><TD bgcolor="#c7d4eb" colspan="100%"/></TR>
	</TABLE>
  </xsl:template>

  <xsl:script><![CDATA[
    
    function formatDateEx(strDate)
    {
    	var objStr = new String(strDate)
    	var objDate = new Date ( objStr.substring(4,6) + "/" + objStr.substring(6,8) + "/" + objStr.substring(0,4) )
    	return formatDate(new Date(Date.parse(objDate)).getVarDate(), "MMMM dd',' yyyy")
      
    }
       
    
  ]]></xsl:script>
</xsl:stylesheet>
