0
我有一个xml文件。我想通过xsl.so更改xml元素的一些样式我也有一个xsl文件。然后我想查看浏览器中的更改,但我不知道我怎样才能做到这一点?在浏览器中查看xsl的输出
xml文件:(的test.xml)
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test2.xsl"?>
<root>
<Text Style='style1'></Text>
<Text Style='style2'></Text>
</root>
XSL文件:(test.xsl)
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:output method="html"/>
<xsl:attribute-set name="style1">
<xsl:attribute name="Font">Arial</xsl:attribute>
<xsl:attribute name="Bold">true</xsl:attribute>
<xsl:attribute name="Color">Red</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="style2">
<xsl:attribute name="Font">Sans</xsl:attribute>
<xsl:attribute name="Italic">true</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="Text[@Style='style1']">
<xsl:copy use-attribute-sets="style1">
<xsl:copy-of select="@*[name()!='Style']"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="Text[@Style='style2']">
<xsl:copy use-attribute-sets="style2">
<xsl:copy-of select="@*[name()!='Style']"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
没有任何办法看到在浏览器中输出我想这个属性,看STYLE1(宋体,?大胆,红色)。 –
@mdharaghizadeh:查看更新的答案 – MiMo