xsl 常用.jsp

现在用的都是有规分律数据, 特殊的数据用XSL. DOM4J 的方法进行处理

 

./@DeptName  //当前
../@DeptName //上一层
//*********** 一样的意义 /root/row == //row == ./row  


<xsl:for-each select="./table1">    //当前循环
 

//*********** row[1]是指第一行,没有[0]形式
<xsl:value-of select="/root/row[1]/@PP1"/>  //特指一个


<xsl:for-each select="//row[@PerID=$personid]"> 
<xsl:variable name="month" select="/root/row[@PerID=$aPerson]"></xsl:variable>


<xsl:value-of select="format-number(sum(>  //到第一层全部Xnum合计
<xsl:value-of select="format-number(sum(
>  //到第二层全部Xnum合计
<xsl:value-of select="format-number(sum(
./row/@PSPT),'###,##0')" /> 
<xsl:value-of select="format-number(sum(//row[@AppDate=$p]/@AppMoney),'###,###,##0')"/> 

 
 
 
<td style="text-align:right"> 
 
 
 
 
多个条件
 <xsl:if test="$DeptPosition=1 and position()=1">  --没有else
  
 <xsl:choose>
  <xsl:when test="./@DeptName='销售一部' or ./@DeptName='华南一部'  or ./@DeptName='上海一部' or ./@DeptName='管理推进部'">
    
  </xsl:when>
  <xsl:otherwise>
    
  </xsl:otherwise>
 </xsl:choose>

 <xsl:value-of select="count(//table1//table2[position()<$Table2Position]//table4) + $Position "/>

 <xsl:variable name="departCount" select="count(./*[@PresentFlag='1100' or @PresentFlag='1102'] )"/></xsl:variable>
 
 <xsl:if test="($table2Position) mod 2 =1">
 
 判别字符串
 <td class="tdcenter"><strong>未开通为:<xsl:value-of select="count(./*/*[@OpenDate='未开通'])"/></strong></td>
 
不等号
 (case when hp.perTypeId is null then '0'
  when hp.perTypeId &lt;&gt; '2700' then '非销售'
  else convert(varchar(10),dateDiff(mm,hp.registerDate,getDate())+1) end) as t_number,
 not($ALeftFlag='0')
 
大于小于号
 <xsl:when test="./@ImagesNum > 0 ">
 &lt; ==== < 
 &gt; ==== >
 <=
 >=
 xsl显示也是用 &lt; &gt;


运算: 加法,除号,取模
 <xsl:value-of select="$AArriveLate+$AleftAdv"/>
 <xsl:value-of select="format-number(sum(>
 <xsl:value-of select="format-number( (sum(
./row/@PSPA)+0.0001) div ((sum(./row/@d3Pst)+0.0001) * $PP1 * $M1),  '##0.00%')" />
 <td bgcolor="#E4E8EF"><xsl:value-of select="format-number((sum(>
 <xsl:if test="position() mod 3 = 0">


复制数字不会少数字方法:
 <td>'<xsl:value-of select="@CardID" /></td>


空格
 <td align="center" nowrap="true"><xsl:value-of select="

./@dialNumber" /> &#160;</td>
 Dom4j的空格是用中文输入法全码空格, 空格也可以显示了一行
 定义TD的长度<td nowrap="true" style="width:50px">


换行
 1.
 <tr align="center" class="reporttr">
  <td colspan="7">
   <p align="center"><br/>
    <b><font size="5" color="blue">定义新单积分表</font></b><br/><br/>
    <font color="red">时间范围:从2008-06-01日到现在</font><br/><br/>
    (3600≤到帐<4050积分为0.5, 4050≤到帐<4500积分为1, 4500≤到帐积分为2)
    <br/>
    <br/>
   </p> 
  </td>
 </tr>
 
 2.
 <div>   </div>
 
 
利用<div>跳行
 <td align="center">
  <div>合并月PDTT目标:<xsl:value-of select="format-number(./@GatherDest,'####,##0')" />元</div>
  <div>定义正式到帐达标率:<xsl:value-of select="format-number(./@GatherRate * 100, '########0.00')" />%</div>
 </td> 


赋值
xsl只可以赋一次的值, 但可以循环赋一个名的值
 <td class="tdcenter">
  <input type="checkbox" name="choose"  class="radio" >
   <xsl:attribute name="ID">
    <xsl:value-of select="../@DeptID" />
   </xsl:attribute>  
   <xsl:attribute name="value">
    <xsl:value-of select="./@ID" />
   </xsl:attribute>
   </input>
 </td>


NaN值处理
 <xml id="ID1_stylesheet_local">
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   <xsl:decimal-format NaN ='0'/><!-- NaN处理 -->
   <xsl:template match="/root">
   ............................
   </xsl:template>
  </xsl:stylesheet>
 </xml>
 


 <a><xsl:attribute name="name">#indextop</xsl:attribute></a>   <!--IE适用-->
 <a><xsl:attribute name="name">indextop</xsl:attribute></a>   <!--FF适用-->
 <a><xsl:attribute name="href">#indextop</xsl:attribute><font color='#999999'>↑返回索引</font></a>


javascript
 <td colspan="5">
  <a><xsl:attribute name="href">mailto:daodao@jobcn.com?subject=所属行业: <xsl:value-of select="./@CallingName" />&amp;body=所需新增的品牌关键字是:</xsl:attribute><font color='#999999'>添加行业品牌名称</font></a>
 </td>
 
 <td width='130' bgcolor='#FFFFF9' style="word-break:break-all;border:0px solid #CCCCCC;">
  <a style="cursor:pointer">
   <xsl:attribute name="onClick">
    javascript:window.open("CusBrandCompanyTract.jsp?contenttype=text/html&amp;ID=<xsl:value-of select="./@ID"/>", "_blank", "menubar=0,status=1,toolbar=0,scrollbars=yes,resizable=1,width=740,height=600,top=50,left=50");
   </xsl:attribute>
   <xsl:value-of select="./@CusBrandName"/> <font color="blue"><xsl:value-of select="./@CountTract"/>/<xsl:value-of select="./@TotalTract"/></font>
  </a>
 </td>
 
 <td  nowrap="true">
  <a style="cursor:pointer">
   <xsl:attribute name="onClick">
    javascript:TractPrintView("printTract", "<xsl:value-of select="./@ID"/>");
   </xsl:attribute>
   <font color="blue">预览</font>
  </a>
 </td>
 
 <td style="text-align:left">
  <a>
   <xsl:attribute name="href">
   #
   </xsl:attribute>
   <xsl:attribute name="onClick">
    javaScript:CustomerView("view","<xsl:value-of select="./@CusID" />");
   </xsl:attribute>
   <font color="blue"><xsl:value-of select="./@CusName" /></font>
  </a>
 </td> 

 <td align="center">
  <img  height="115">
   <xsl:attribute name="src">/images/bulletin/top1.jpg</xsl:attribute>
  </img>
 </td>
 <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
   <td><img src="images/body_top.jpg" width="780" height="20" /></td>
  </tr>
 </table>
 
 <td bgcolor="#FFFFFF" rawspan="13">
  <img >
   <xsl:attribute name="src">
      <!--/include/chart_java.jsp?TopTitle=&amp;BottomTitle=&amp;CoordColor=FF6600&amp;chartData=<xsl:for-each select="./table2"> <xsl:value-of select="./@MonthNum"/>,<xsl:value-of select="format-number(./@GatherMoney, '####.0000')" />,</xsl:for-each>-->
      /include/PieChart.jsp?type=2&amp;width=500&amp;height=300&amp;titles=&amp;keys=<xsl:for-each select="./table2"><xsl:value-of select="./@MonthNum"/>,</xsl:for-each>&amp;values=<xsl:for-each select="./table2"><xsl:value-of select="format-number(./@GatherMoney, '####.0000')" />,</xsl:for-each>
   </xsl:attribute>
  </img>      
 </td>
 <td bgcolor="#FFFFFF" nowrap="true">
  <img>
   <xsl:attribute name="src">
    <xsl:choose>
     <xsl:when test="$progress1 &gt; ./@PSTTPercent">
      /include/percent_java.jsp?CoordColor=FF6600&amp;width=90&amp;height=12&amp;percent=<xsl:value-of select="./@PSTTPercent" />
     </xsl:when>
     <xsl:otherwise>
      /include/percent_java.jsp?width=90&amp;height=12&amp;percent=<xsl:value-of select="./@PSTTPercent" />
      <!--/include/percent_java.jsp?width=90&amp;height=12&amp;percent=<xsl:value-of select="format-number(./@PSTTPercent,'##0.00')" />  有可能是这样取值 -->
     </xsl:otherwise>
    </xsl:choose> 
   </xsl:attribute>
  </img>
 </td> 
 
 <table border="0" borderColor="#000000"  class="reporttable" style="border-collapse:collapse;width:60%;" id="RowTable">
  <tr>
   <xsl:for-each select="./row">
    <td>
     <input type="text" style="width=120px">
     <xsl:attribute  name='name'>
      <xsl:value-of select="./@TractID"/>
     </xsl:attribute> 
     <xsl:attribute  name='id'>
      <xsl:value-of select="./@TractID"/>
     </xsl:attribute>                
     <xsl:attribute  name='value'>
      <xsl:value-of select="./@NoGatherInfo"/>
     </xsl:attribute> 
     </input>
     <textarea rows="2" cols="15">
      <xsl:attribute  name='name'>
       <xsl:value-of select="./@TractID"/>
      </xsl:attribute> 
      <xsl:attribute  name='id'>
       <xsl:value-of select="./@TractID"/>
      </xsl:attribute>                
      <xsl:value-of select="./@NoGatherInfo"/
     </textarea>     
     <input type="button" name="savebutton" style="width=40px" class="tbbutton" value="提交">
     <xsl:attribute name="onClick">
      javaScript:page_submitsave("<xsl:value-of select="./@TractID"/>");
     </xsl:attribute>
     </input>
    </td>
   </xsl:for-each>
  </tr>
 </table>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值