首页 > 解决方案 > 如何通过 xsl 模板将字体和样式应用于 xml 数据

问题描述

我正在尝试修改 xsl 代码以将一些字体大小和颜色应用于它产生的内容,但没有取得多大成功。

这是我的示例 xml 数据格式

<xml>
<Node1 attribute1="Test1" attribute2="Test2" attribute3="Test3"></Node1>
</xml>

这是我拥有的当前 xsl 模板:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:jscript="http://www.url.com">

<xsl:apply-templates select="//Node1"></xsl:apply-templates>    

<xsl:template match="Node1">        
Value# 1 = <xsl:value-of select="@attribute1"/>
Value# 2 = <xsl:value-of select="@attribute2"/>
Value# 3 = <xsl:value-of select="@attribute3"/>
</xsl:template>

</xsl:stylesheet>

我想显示内容
Value #1 = Test1
Value #2 = Test2
Value #3 = Test3

在内容上带有一些字体样式和颜色。有人可以提供一些例子我该怎么做?谢谢

标签: xsltfonts

解决方案


推荐阅读