xslt功能实现

<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tk="http://www.qdocuments.net" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="tk msxsl">
 <xsl:import href="../../Toolkit/ListFrame.xslt"/>
 <xsl:variable name="tk:MainTable" select="$tk:Tables/@TableName"/>
 <xsl:variable name="tk:ListHeadUrl" select="concat($tk:DSelfURL, '&amp;cChar=', $tk:Sort/CChar,'&amp;ID=', $tk:Sort/ID)"/>
 <!--xsl:variable name="tk:ListOrder" select="concat('&amp;Sort=', $tk:Sort/SortField, '&amp;Order=', $tk:RealOrder)"/-->
 <xsl:variable name="tk:ListOrder" select="''"/>
 <xsl:variable name="tk:FieldID" select="$tk:XmlFile/Toolkit/tk:Module/tk:SubJoins/@LinkField"/>
 <xsl:template match="/">
  <xsl:call-template name="tk:MainContent2"/>
 </xsl:template>
 <xsl:template name="tk:MainContent2">
  <xsl:variable name="Page" select="$tk:Toolkit/Page"/>
  <xsl:apply-templates select="$Page"/>
  <xsl:apply-templates select="$tk:Tables" mode="tk:List"/>
  <xsl:apply-templates select="$Page"/>
  <br/>
 </xsl:template>
 <xsl:template match="Page">  <!--分页功能-->
  <table cellspacing="0" cellpadding="2" border="0" width="100%">
   <tr>
    <td nowrap="">
     <a title="首页">
      <xsl:if test="$tk:CurPage>1">
       <xsl:variable name="CxUrl" select="concat('&quot;',$tk:ListHeadUrl, '&amp;Page=1', $tk:ListOrder,'&quot;')"/>
       <xsl:attribute name="onclick"><xsl:value-of select="concat('BSQuery2(',$CxUrl,',','&quot;&quot;',')')"/></xsl:attribute>
       <xsl:attribute name="style">cursor:hand;text-decoration:underline</xsl:attribute>
      </xsl:if>
      <font face="webdings">9</font>
     </a>
     <xsl:call-template name="tk:WhiteSpace"/>
     <a title="前十页">
      <xsl:if test="$tk:CurPage>10">
       <xsl:variable name="CxUrl" select="concat('&quot;',$tk:ListHeadUrl, '&amp;Page=', $tk:CurPage - 10, $tk:ListOrder,'&quot;')"/>
       <xsl:attribute name="onclick"><xsl:value-of select="concat('BSQuery2(',$CxUrl,',','&quot;&quot;',')')"/></xsl:attribute>
       <xsl:attribute name="style">cursor:hand;text-decoration:underline</xsl:attribute>
      </xsl:if>
      <font face="webdings">7</font>
     </a>
     <xsl:call-template name="tk:WhiteSpace"/>
     <xsl:apply-templates select="$tk:Toolkit/NewPage"/>
     <a title="后十页">
      <xsl:if test="($tk:CurPage &lt;= TotalPage - 10)">
       <xsl:variable name="CxUrl" select="concat('&quot;',$tk:ListHeadUrl, '&amp;Page=', $tk:CurPage + 10, $tk:ListOrder,'&quot;')"/>
       <xsl:attribute name="onclick"><xsl:value-of select="concat('BSQuery2(',$CxUrl,',','&quot;&quot;',')')"/></xsl:attribute>
       <xsl:attribute name="style">cursor:hand;text-decoration:underline</xsl:attribute>
      </xsl:if>
      <font face="webdings">8</font>
     </a>
     <xsl:call-template name="tk:WhiteSpace"/>
     <a title="末页">
      <xsl:if test="$tk:CurPage &lt; TotalPage">
       <xsl:variable name="CxUrl" select="concat('&quot;',$tk:ListHeadUrl, '&amp;Page=', TotalPage, $tk:ListOrder,'&quot;')"/>
       <xsl:attribute name="onclick"><xsl:value-of select="concat('BSQuery2(',$CxUrl,',','&quot;&quot;',')')"/></xsl:attribute>
       <xsl:attribute name="style">cursor:hand;text-decoration:underline</xsl:attribute>
      </xsl:if>
      <font face="webdings">:</font>
     </a>
     <xsl:call-template name="tk:WhiteSpace"/>共<font color="red">
      <b>
       <xsl:value-of select="TotalPage"/>
      </b>
     </font>页
          <font color="red">
      <b>
       <xsl:value-of select="TotalRows"/>
      </b>
     </font>条
            <input id="MyPageID" name="MyPageID" type="text" size="3" value="{$tk:CurPage}"/>
     <xsl:variable name="CxUrl" select="concat('&quot;',$tk:ListHeadUrl,  $tk:ListOrder,'&quot;')"/>
     <input id="btnGoto" name="btnGoto" type="button" value="Go" onclick="{concat('changeCxPage(',$CxUrl,')')}"/>
    </td>
   </tr>
  </table>
 </xsl:template>
 <xsl:template match="NewPage">
  <xsl:choose>
   <xsl:when test="Item =$tk:CurPage ">
    <font color="red">
     <b>
      <xsl:value-of select="Item"/>
     </b>
    </font>
   </xsl:when>
   <xsl:otherwise>
    <xsl:variable name="CxUrl" select="concat('&quot;',$tk:ListHeadUrl, '&amp;Page=', Item, $tk:ListOrder,'&quot;')"/>
    <a onclick="{concat('BSQuery2(',$CxUrl,',','&quot;&quot;',')')}" style="cursor:hand;text-decoration:underline">
     <xsl:value-of select="Item"/>
    </a>
   </xsl:otherwise>
  </xsl:choose>
  <xsl:call-template name="tk:WhiteSpace"/>
 </xsl:template>
 
 <xsl:template match="tk:Table" mode="tk:List">
  <xsl:variable name="FieldList">
   <xsl:for-each select="$tk:Tables/tk:Field[tk:List/@HtmlCtrl]">
    <xsl:sort select="tk:List/@Order" data-type="number"/>
    <xsl:copy-of select="."/>
   </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="FieldNodes" select="msxsl:node-set($FieldList)/*"/>
  <table id="MainTD" cellspacing="0" cellpadding="1" border="1" width="100%" class="datagrid">
   <tr>
    <xsl:call-template name="tk:OperationHead"/>  <!--操作空表头-->
    <xsl:apply-templates select="$FieldNodes" mode="tk:ListHead"/>          <!--显示上面的表头-->
   </tr>
   <!--the DataList  查询出来的 $tk:Toolkit/BSDataFx 数据显示-->
   <xsl:variable name="Data" select="$tk:Toolkit/BSDataFx"/>
   <xsl:choose>
    <xsl:when test="count($Data) &gt; 0">         <!--如果查询出来记录数大于0则显示tk:showList模块-->
     <xsl:call-template name="tk:ShowList">
      <xsl:with-param name="Data" select="$Data"/>
      <xsl:with-param name="FieldList" select="$FieldNodes"/>
     </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
     <xsl:copy-of select="$tk:NoRecord"/>    <!--没有数据记录-->
    </xsl:otherwise>
   </xsl:choose>
  </table>
 </xsl:template>
 
 
 <xsl:template name="tk:ShowList">   <!--查询出来数据列表-->
  <xsl:param name="Data"/>
  <xsl:param name="FieldList"/>
  <xsl:for-each select="$Data">
    <xsl:variable name="IDValue">
    <xsl:call-template name="tk:MyListQueryString">
     <xsl:with-param name="DataRecord" select="."/>
     <xsl:with-param name="FieldList" select="$tk:Tables/tk:Field"/>
     <xsl:with-param name="FieldName" select="$tk:FieldID"/>
    </xsl:call-template>
   </xsl:variable>
   <tr valign="top" onmouseover="this.style.backgroundColor = '#F9F9F0';" onmouseout="this.style.backgroundColor = '';">
    <xsl:call-template name="tk:Operation">  <!--调用详细超连接-->
     <xsl:with-param name="RowId" select="position()"/>
     <xsl:with-param name="IDValue" select="$IDValue"/>
    </xsl:call-template>
    <xsl:apply-templates select="$FieldList" mode="tk:Item">
     <xsl:with-param name="DataRecord" select="."/>
     <xsl:with-param name="MyRowId" select="position()"/>
    </xsl:apply-templates>
   </tr>
  </xsl:for-each>
 </xsl:template>
 
 <xsl:template match="tk:Field" mode="tk:ListHead">      <!--显示上面的表头-->
  <xsl:call-template name="tk:ColHead">
   <xsl:with-param name="Title" select="tk:DisplayName"/>
  </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="tk:Field" mode="tk:Item">
     <xsl:param name="MyRowId"/>
  <xsl:param name="DataRecord"/>
  <xsl:call-template name="tk:DisplayListItem">
   <xsl:with-param name="DataRecord" select="$DataRecord"/>
   <xsl:with-param name="FieldList" select="$tk:Tables/tk:Field"/>
   <xsl:with-param name="Source" select="$tk:Source"/>
   <xsl:with-param name="aRowID" select="$MyRowId"/>
  </xsl:call-template>
  
 </xsl:template>
 <xsl:variable name="tk:NoRecord">
  <tr>
   <td colspan="20" class="pad5">没有内容</td>
  </tr>
 </xsl:variable>
 <xsl:template name="tk:OperationHead">
  <th style="color:black" nowrap="nowrap">操作</th>   <!--第一列操作列实现-->
 </xsl:template>
 <xsl:template name="tk:Operation">
  <xsl:param name="RowId"/>
  <xsl:param name="IDValue"/>
  <td>
   <xsl:if test="$IDValue != ''">
    <xsl:variable name="CxUrl" select="concat($tk:ListHeadUrl, '&amp;Page=1')"/>
    <a onclick="OpenSubPage('{$CxUrl}','{$IDValue}')" style="cursor:hand;text-decoration:underline">详细</a>
   </xsl:if>
  </td>
 </xsl:template>
 
 <xsl:template name="tk:ListItem">  <!--查询出来的值(list页面)-->
  <xsl:param name="Value"/>
  <xsl:param name="bRowID"/>
  <xsl:choose>
   <xsl:when test="tk:FieldName='GUIGE2'">
   <!--这里加一个判断是否为规格2<input type="text" value="{$DisplayValue}"></input>-->
       <td colspan="1">  <!--专空规格二空下一个位置  --> 
        <xsl:call-template name="GG2ColsTable">
         <!--这里调用GUIGE2的列数,并可以传相应的参数-->
              <xsl:with-param name="sRowID" select="$bRowID"/>
        </xsl:call-template>
      </td>
    </xsl:when>
   <xsl:otherwise>
      <td> 
       <div class="DivOut" onmouseover="DivOnMouseOver(this);" onmouseout="DivOnMouseOut(this);">
        <xsl:value-of select="$Value"/>
       </div>
       <input type="hidden" name="hd_{tk:FieldName}" value="{$Value}"/>
      </td>
   </xsl:otherwise>
  </xsl:choose>
   
 </xsl:template>
 
 <xsl:template name="tk:DisplayListItem">    <!--查询后显示的list中的td每个单元格内容-->
     <xsl:param name="aRowID"/>
  <xsl:param name="DataRecord"/>
  <xsl:param name="FieldList"/>
  <xsl:param name="Source"/>
  <xsl:variable name="Value" select="$DataRecord/*[local-name()=current()/tk:FieldName]"/>
  <xsl:variable name="CheckValue" select="tk:Extension/@CheckValue"/>
  <xsl:choose>
   <xsl:when test="$CheckValue!=''">
    <td>
     <xsl:call-template name="tk:WhiteSpace"/>
     <xsl:if test="$Value=$CheckValue">
      <IMG src="../images/check.gif" border="0" width="16" height="16"/>
     </xsl:if>
     <xsl:call-template name="tk:WhiteSpace"/>
    </td>
   </xsl:when>
   <xsl:otherwise>
    <xsl:variable name="DisplayValue">
     <xsl:call-template name="tk:DisplayValue">
      <xsl:with-param name="Field" select="."/>
      <xsl:with-param name="Value" select="$Value"/>
     </xsl:call-template>
    </xsl:variable>  
    
    <xsl:call-template name="tk:ListItem">
     <xsl:with-param name="Value" select="$DisplayValue"/>
     <xsl:with-param name="bRowID" select="$aRowID"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 
 <xsl:template name="GG2ColsTable">  <!--统计的数值   规格二的明细-->
     <xsl:param name="sRowID"/>
         <TABLE cellspacing="1" cellpadding="1" border="0" class="datagrid" bgcolor="#f6f6f6">
        <tr valign="top">
      <!--制作一个Virtual行表示定位第几行-->
       <xsl:for-each select="$tk:Toolkit/Cols">
       <xsl:variable name="ColLoc" select="position()"/>
       <xsl:variable name="GGWZ2" select="GGWZ2"/>
       <td bgcolor="#eaeff3" >
       <xsl:attribute name="width">45px</xsl:attribute> 
        <div class="DivOut" onmouseover="DivOnMouseOver(this);" onmouseout="DivOnMouseOut(this);">
           <xsl:call-template name="tk:WhiteSpace"/> 
           <xsl:variable name="WZ">
           <xsl:choose>
               <!--$tk:Toolkit/BSDataFx/*[local-name()=current()/tk:FieldName]-->
            <xsl:when test="$GGWZ2=1">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ1"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=2 ">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ2"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=3">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ3"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=4 ">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ4"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=5 ">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ5"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=6">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ6"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=7">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ7"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=8">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ8"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=9">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ9"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=10">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ10"/>
            </xsl:when>
               <xsl:when test="$GGWZ2=11">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ11"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=12">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ12"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=13">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ13"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=14">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ14"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=15">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ15"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=16">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ16"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=17">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ17"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=18">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ18"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=19">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ19"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=20">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ20"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=21">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ21"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=22">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ22"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=23">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ23"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=24">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ24"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=25">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ25"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=26">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ26"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=27">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ27"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=28">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ28"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=29">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ29"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=30">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ30"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=31">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ31"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=32">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ32"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=33">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ33"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=34">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ34"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=35">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ35"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=36">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ36"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=37">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ37"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=38">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ38"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=39">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ39"/>
            </xsl:when>
            <xsl:when test="$GGWZ2=40">
            <xsl:value-of select="$tk:Toolkit/BSDataFx[position()=$sRowID]/WZ40"/>
            </xsl:when>
            </xsl:choose>
           </xsl:variable>
           <xsl:call-template name="tk:WhiteSpace"/>  
           <xsl:choose>
            <xsl:when test="$WZ!=''">
             <xsl:value-of select="number($WZ)"/> 
            </xsl:when>
            <xsl:otherwise>
             <xsl:value-of select="$WZ"/> 
            </xsl:otherwise>
           </xsl:choose>
         </div>
       </td>
      </xsl:for-each>
       
         </tr>
   </TABLE>  
    </xsl:template>
 
 <xsl:template name="tk:ColHead">    <!--显示上面的表头-->
  <xsl:param name="Title"/>
  <th style="color:black" nowrap="nowrap" > 
    <xsl:choose>
    <xsl:when test="tk:FieldName='GUIGE2'">
       <xsl:call-template name="tk:GUIGE2Table">
         <xsl:with-param name="ColWidth" select="tk:Display/@ListWidth"/>
       </xsl:call-template>
     </xsl:when>
    <xsl:otherwise>
     <xsl:if test="tk:Display/@ListWidth">
      <xsl:attribute name="width"><xsl:value-of select="tk:Display/@ListWidth"/>px</xsl:attribute>
     </xsl:if>
     <xsl:value-of select="$Title"/>
    </xsl:otherwise>
   </xsl:choose>
  </th>
 </xsl:template>
 
 
 <xsl:template name="tk:GUIGE2Table">
  <!--接收参数  行数、列数、列宽-->
  <xsl:param name="ColWidth"/>
   <TABLE cellspacing="1" cellpadding="1" border="0" class="datagrid" bgcolor="#f6f6f6" >
    <xsl:attribute name="width"><xsl:value-of select="45*(count($tk:Toolkit/Cols))"/>px</xsl:attribute>
     <TR bgcolor="#eaeff3">
       <TD align="center" style="color:black" >
       <xsl:attribute name="colspan"><xsl:value-of select="(count($tk:Toolkit/Cols))"/></xsl:attribute>
       <b>尺码</b>
       </TD>
      </TR>
        <xsl:for-each select="$tk:Toolkit/Rows">
       <xsl:variable name="RowLoc" select="position()"/>
       <xsl:variable name="GGWZ1" select="GGWZ1"/>
        <tr bgcolor="#eaeff3"> 
         <xsl:for-each select="$tk:Toolkit/Cols">
          <xsl:variable name="ColLoc" select="position()"/>
          <xsl:variable name="GGWZ2" select="GGWZ2"/>
          <td>  
              <div>
                  <b><xsl:value-of select="$tk:Toolkit/GG2INFO[GGWZ1=$GGWZ1 and GGWZ2=$GGWZ2]/GGMC"/> </b>
              </div> 
          </td>
         </xsl:for-each>
        </tr>
      </xsl:for-each> 
   </TABLE>
 </xsl:template>
 


 <xsl:template name="tk:DisplayValue">   <!--内容显示-->
  <xsl:param name="Field"/>
  <xsl:param name="Value"/>
  <xsl:variable name="CheckValue" select="tk:Extension/@CheckValue"/>
  <xsl:choose>
   <xsl:when test="$Field/tk:CodeTable != ''">
    <xsl:value-of select="$tk:Toolkit/*[local-name()=$Field/tk:CodeTable][CODE_VALUE=$Value]/CODE_NAME"/>
   </xsl:when>
   <xsl:when test="$Field/tk:EasySearch/@RegName != ''">
    <xsl:value-of select="$tk:Toolkit/*[local-name()=$Field/tk:FieldName][CODE_VALUE=$Value]/CODE_NAME"/>
   </xsl:when>
   <xsl:when test="$Field/tk:List/@HtmlCtrl='CheckBox' and $Value=$CheckValue">
    <xsl:value-of select="'√'"/>
   </xsl:when>
   <xsl:when test="$Field/tk:List/@HtmlCtrl='CheckBox' and (not ($Value) or $Value!=$CheckValue)">
    <xsl:value-of select="'×'"/>
   </xsl:when>
   <xsl:when test="$Field/@DataType = 'Date'">
    <xsl:value-of select="substring($Value, 1, 10)"/>
   </xsl:when>
   <xsl:when test="$Field/@DataType = 'DateTime'">
    <xsl:value-of select="translate(substring($Value, 1, 19), 'T', ' ')"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="tk:FormatNumber">
     <xsl:with-param name="Field" select="$Field"/>
     <xsl:with-param name="Value" select="$Value"/>
    </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 
 <xsl:template name="tk:FormatNumber">
  <xsl:param name="Field"/>
  <xsl:param name="Value"/>
  <xsl:choose>
   <xsl:when test="($Field/@DataType = 'double' or $Field/@DataType = 'int') and ($Field/tk:Display/@Format and $Value != '')">
    <xsl:variable name="Temp">
     <xsl:value-of select="format-number($Value, $Field/tk:Display/@Format)"/>
    </xsl:variable>
    <xsl:choose>
     <xsl:when test="$Temp='NaN'">
      <xsl:value-of select="$Value"/>
     </xsl:when>
     <xsl:otherwise>
      <xsl:value-of select="$Temp"/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="$Value"/> 
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 <xsl:template name="tk:MyListQueryString">
  <xsl:param name="DataRecord"/>
  <xsl:param name="FieldList"/>
  <xsl:param name="FieldName"/>
  <xsl:for-each select="$FieldList">
   <xsl:if test="tk:FieldName=$FieldName">
    <xsl:value-of select="$DataRecord/*[local-name()=current()/tk:FieldName]"/>
   </xsl:if>
  </xsl:for-each>
 </xsl:template>
 <xsl:template name="tk:PostScript">
  <script language="JavaScript">
   <xsl:comment><![CDATA[    
  
   //统计页面刷新
  var BSQueryfirstPost = true;
  function postBSQuery(url,BSConditionData)
  {
   if (! BSQueryfirstPost)
   {
    alert("数据正在提交过程中,请稍后……");
    return false; 
   }
   BSQueryfirstPost = false;
   var condition = "";
   var contentStr = XmlHttpPost(encodeURI(url+"&condition="+condition), BSConditionData);
   document.all("MainContent").innerHTML = contentStr;
   BSQueryfirstPost = true; 
  }
  
  function postBSQuery2(url,BSConditionData)
  {
   if (! BSQueryfirstPost)
   {
    alert("数据正在提交过程中,请稍后……");
    return false; 
   }
   BSQueryfirstPost = false;
   var condition = "";
   var contentStr = XmlHttpPost(encodeURI(url+"&condition="+condition), BSConditionData);
   document.all("MainContent2").innerHTML = contentStr;
   BSQueryfirstPost = true; 
  }
  
   //项目选择
    function SelectItem(sObj,sTable)
    {
       var xmlsrc=document.all("src_"+sObj).value;
   var retValue=window.showModalDialog("BSWebComCxXmlPage.tkx?Source=ComSel/"+xmlsrc,"selMode:1111;curSel:4;CxTable:"+sTable+";RetMode:0","dialogWidth:800px;dialogHeight:570px;center:yes;scroll:no");
       if (retValue!=null)
       {
       var retValues=retValue.split(";");
        if (retValues[0]==1)
     {
       document.all("hd"+sObj).value="";
       document.all(sObj).value="全部";
     }
     else
     {
       document.all("hd"+sObj).value=retValues[1];
       document.all(sObj).value=retValues[2];
     }
   }
     }
    
     //查询
     function BSQuery(Url)
      {  
         
       setQueryXmlData();
       var XmlData = "<Toolkit><QueryState><STATE>0</STATE></QueryState>"+document.all("BSCondition").value+"</Toolkit>";
       postBSQuery(Url+"&Page=1",XmlData);             
     }
    
     //查询2
     function BSQuery2(Url)
     {    
         var XmlData = "<Toolkit><QueryState><STATE>1</STATE></QueryState>"+document.all("BSCondition").value+"</Toolkit>";
       postBSQuery2(Url,XmlData);             
     }   
    
     //查询3
     function BSQuery3(Url,sIDValue)
     {    
         var XmlData = "<Toolkit><QueryState><STATE>2</STATE><IDVALUE>"+sIDValue+"</IDVALUE></QueryState>"+document.all("BSCondition").value+"</Toolkit>";
       postBSQuery3(Url,XmlData);             
     }

     //查询4
     function BSQuery4(Url)
     {    
       var sIDValue = document.all("LinkID").value;
       var XmlData = "<Toolkit><QueryState><STATE>3</STATE><IDVALUE>"+sIDValue+"</IDVALUE></QueryState>"+document.all("BSCondition").value+"</Toolkit>";
       postBSQuery3(Url,XmlData);             
     }
         
     //设置查询条件
     function setQueryXmlData()
     {
   var tCount=0;
   var objTitle=document.all("SearchTitle");
   if (objTitle!=null) 
   {
    tCount=objTitle.length;
    if (tCount==null) tCount=1;
   }
   if (tCount==0) return;
   var XmlData="<BSCondition>";
   for (var i=0;i<tCount; i++)
   {
    
    var strField=document.all("SearchTitle",i).value;
    if (document.all("SearchTitle",i).title=="Complex")
    {
      XmlData = XmlData + "<"+strField+">"+document.all("hd"+strField).value+"</"+strField+">";
            continue;
    }
    XmlData = XmlData + "<"+strField+">"+document.all(strField).value+"</"+strField+">";
    if (document.all("SearchTitle",i).title=="DateSpan")
     XmlData = XmlData + "<"+strField+"END>"+document.all(strField+"END").value+"</"+strField+"END>";
   }
     XmlData = XmlData + "</BSCondition>"; 
     document.all("BSCondition").value =  XmlData ;        
     }
          
      //指定查询页面
      function changeCxPage(urlIn)
      {
        var eCtrl = window.event.srcElement;
        if (eCtrl == document.all('btnGoto', 0))
            eTmp = 0;
        else
            eTmp = 1;
   
        var pCtrl = document.all('MyPageID', eTmp);
        if (pCtrl == null) return; 
        if (IsInteger(pCtrl.value) && (parseInt(pCtrl.value)>0))
        {
            var url=urlIn+"&Page=" + pCtrl.value;
            BSQuery2(url,"");
        }
      }
    
      //打开详细页面
      function OpenSubPage(CxUrl,IDValue)
      {
        ChangeArea(1);
        document.all("LinkID").value = IDValue;
     BSQuery3(CxUrl,IDValue);
      }
       
  function postBSQuery3(url,BSConditionData)
  {
   if (! BSQueryfirstPost)
   {
    alert("数据正在提交过程中,请稍后……");
    return false; 
   }
   BSQueryfirstPost = false;
   var condition = "";
   var contentStr = XmlHttpPost(encodeURI(url+"&condition="+condition), BSConditionData);
   document.all("SubContent").innerHTML = contentStr;
   BSQueryfirstPost = true; 
  }
       
  //返回主页面
  function GoBack()
  {
   ChangeArea(0);
  }
  
  //页面切换
  function ChangeArea(sMode)
  {
   if (sMode=="0")
   {
    document.all("MainArea").style.display="";
    document.all("SubArea").style.display="none";
   }
   else
   {
    document.all("MainArea").style.display="none";
    document.all("SubArea").style.display="";
   }   
  }  
  
       ]]></xsl:comment>
  </script>
  <div id="floatDiv" style="position: absolute; visibility: hidden; left:0px; top:0px; width:200px; height:90px; z-index:10; overflow: auto; border:solid 1px #003366; background-color: #FFFFEE" class="scrollBar"/>
  <iframe width="168" height="190" name="gfPop" id="gfPop" src="../utility/calendar/ipopeng.htm" scrolling="no" frameborder="0" style="border:2px ridge; visibility:visible; z-index:999; position:absolute; left:-600px; top:0px;"/>
 </xsl:template>
</xsl:stylesheet>

posted @ 2007-08-27 21:52  Winner.Net(2007)  阅读(677)  评论(0编辑  收藏  举报