XMl的属性的赋值问题(请看个例子)?

myblessu 2003-08-25 11:26:12
我的XML文件(1.xml)如下:

<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="1.xsl"?>
<标题>
<内容>我是哪里人呀?</内容>
<颜色>blue</颜色>
</标题>

我的XSL文件(1.xsl)如下:

<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<font color="red">
<xsl:value-of select="标题/内容"/>
</font>
</xsl:template>
</xsl:stylesheet>

如果用IE打开1.xml将显示红色的“我是哪里人呀?”

我现在想把1.xsl中的<font color="red">按给出的1.xml中的颜色值改为<font color="blue">如何做到?

(我用<font color="<xsl:value-of select="标题/颜色"/>">不行,怎么做?)


...全文
85 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
myblessu 2003-08-25
  • 打赏
  • 举报
回复
非常感谢!
月光易水 2003-08-25
  • 打赏
  • 举报
回复
or
<font>
<xsl:attribute name="color"><xsl:value-of select="标题/颜色" /></xsl:attribute>
<xsl:value-of select="标题/内容"/>
</font>


:_)
fason 2003-08-25
  • 打赏
  • 举报
回复
<font>
<xsl:attribute name="color">
<xsl:value-of select="标题/内容"/>
</xsl:attribute>
</font>
saucer 2003-08-25
  • 打赏
  • 举报
回复
<font color="{标题/颜色}">

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧