以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  请教:xsl:attribute该怎么用啊 在线等  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=9836)


--  作者:ty44092003
--  发布时间:9/8/2004 10:28:00 AM

--  请教:xsl:attribute该怎么用啊 在线等
<?xml version="1.0" encoding="gb2312"?>
<html xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<head>
<title>xpath</title>
</head>
<body>
<xsl:for-each select="/order/item[1]">
<xsl:attribute name="stlye">color:red</xsl:attribute>
<xsl:value-of select="price"/>
</xsl:for-each>
</body>
</html>
这段代码为什么不对


[此贴子已经被作者于2004-9-8 11:02:29编辑过]

--  作者:菜籽
--  发布时间:9/9/2004 2:42:00 PM

--  
<xsl:attribute name="stlye">color:red</xsl:attribute>
改成下面的语句,可以么?我没有测试,只是看到你的style拼写错误!
<xsl:attribute name="style">color:red</xsl:attribute>


--  作者:yushan_43436
--  发布时间:9/10/2004 7:44:00 PM

--  
啊,这么经典
不过xsl:attribute什么功能?
--  作者:alextoby
--  发布时间:9/14/2004 1:15:00 PM

--  
attribute 是用来在输出文件的标记中添加属性

例如一个XSL文件
<xsl:element name="A">
  <xsl:attribute name="href">
     test12.asp?cateid=<xsl:value-of />
  </xsl:attribute>
  <xsl:attribute name="target">
  _blank
  </xsl:attribute> 

这里转化后相当于HTML的

<a href="test12.asp?cateid=xxx" target="_blank">xxx </a>


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