以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  如何计算XML中的数据啊?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=34927)


--  作者:Coolkey
--  发布时间:6/27/2006 3:37:00 PM

--  如何计算XML中的数据啊?
我的XML文档有如下片断
<rect>
<width>1</width>
</rect>
<rect>
<width>2</width>
</rect>

现通过XSL文件转换,
<xsl:for-each select="rect">
 <rect x="150" y="100" height="15" width="50">
  <xsl:attribute name="y"><xsl:value-of select="width"/>*100</xsl:attribute>
 </rect>
</xsl:for-each>

可转换出来的总是 <rect x="150" y="1*100" height="15" width="50"/>
   <rect x="150" y="2*100" height="15" width="50"/>

而不是我想要的  <rect x="150" y="100" height="15" width="50"/>
   <rect x="150" y="200" height="15" width="50"/>
请各位高手帮忙解答,我该如何计算?


--  作者:Qr
--  发布时间:6/27/2006 6:31:00 PM

--  
XML中的元素值都属文本,这样改就好了:
<xsl:value-of select="number(width)*number(100)"/>
--  作者:cbgy08
--  发布时间:7/14/2006 1:32:00 PM

--  
为什么使用http://www.w3.org/TR/WD-xsl再用number()就会报错
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
125.000ms