以文本方式查看主题

-  W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWL  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  请教各位高手一个问题?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=47042)


--  作者:raull
--  发布时间:5/17/2007 6:56:00 PM

--  请教各位高手一个问题?
有xml文档如下:
<ListBonus>
  <BonusInfo>
    <id>2</id>
    <Spreader>test</Spreader>
    <Money>100.0000</Money>
    <DateTime>2007-05-16T19:28:57.3100000+08:00</DateTime>
    <State>0</State>
    <PayMethod>银行帐号、邮政汇款等ccxvxzcvxc</PayMethod>
  </BonusInfo>
  <BonusInfo>
    <id>1</id>
    <Spreader>lf</Spreader>
    <Money>990.0000</Money>
    <DateTime>2007-05-15T11:15:39.9200000+08:00</DateTime>
    <State>1</State>
  </BonusInfo>
</ListBonus>

我想在xsl中实现BonusInfo节点下面根据元素State的值传递id值比如 <State>的值是1那么显示一个超链接<a href="....?pID={id}",如果是0就忽略,这该如何实现呢? 谢谢


--  作者:Qr
--  发布时间:5/17/2007 7:15:00 PM

--  
问题表述不清楚。
--  作者:raull
--  发布时间:5/17/2007 7:25:00 PM

--  
您好,Qr,期望你的指点。
我的xsl如下:
<xsl:template match="BonusInfo">
<xsl:if test="position()&gt;=1 and position() &lt;= 2">   
<tr>
<xsl:apply-imports
 <td align="center" valign="middle">
 <input type="button" onclick="window.location.href='./showBonusInfo.aspx?id={id}'" value="处理"/>------>如果State的值为1才显示这个button,如为0则不显示
 </td>
 .......
 <td align="center" valign="middle">
  <xsl:choose>
  <xsl:when test="State">
   <xsl:if test="number(State)=0">未处理</xsl:if>
   <xsl:if test="number(State)=1">已处理</xsl:if>
   <xsl:if test="number(State)=2">兑换失败</xsl:if>
  </xsl:when>
  <xsl:otherwise>无信息</xsl:otherwise>
  </xsl:choose>
 </td>
 ......
 </xsl:if>  
</xsl:template>

希望根据State的值来显示Button


--  作者:Qr
--  发布时间:5/17/2007 7:40:00 PM

--  
这样不行吗:
  <xsl:choose>
  <xsl:when test="State=1">
   <input type="button" onclick="window.location.href='./showBonusInfo.aspx?id={id}'" value="处理"/>
  </xsl:when>
  <xsl:when test="State=0">
   
  </xsl:when>
  <xsl:otherwise></xsl:otherwise>
  </xsl:choose>

--  作者:raull
--  发布时间:5/17/2007 7:57:00 PM

--  
感谢Qr的回答,但这样不行不能直接在这里直接输出这个button,这里者能输出“未处理”,而是要在指定的地方输出这个Button,比如在这个表的第一列输出。



W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms