0
我正在使用XSLT 1.0将XML转换为HTML,但是我收到了不希望的输出。为什么我会收到 “data.flow2” 在我的评论味精为什么我从其他标签获取输出? XML/XSLT
XML文件:
<?xml version="1.0" encoding="utf-8" ?>
<CommentsList>
<Comment>
<CommentBy>data.flow2</CommentBy>
<CommentMsg>Set Under Study</CommentMsg>
</Comment>
<Comment>
<CommentBy>data.flow2</CommentBy>
<CommentMsg>True Files</CommentMsg>
</Comment>
<Comment>
<CommentBy>data.flow2</CommentBy>
<CommentMsg>
<![CDATA[<a href='http://eservices.saudieng.sa/Attachments/DataFlowReports/ce2cd49ac33e45edb8902c7d074d 908a.pdf'>Download the Report</a>]]> </CommentMsg>
</Comment>
</CommentsList>
这是XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="CommentsList">
<table border="1">
<tr style="background-color:lightblue">
<td>Comment By</td>
<td>Comment Msg</td>
<td>Comment Date</td>
</tr>
<xsl:for-each select="/CommentsList/Comment">
<tr>
<td>
<xsl:value-of select="CommentBy"/>
</td>
<xsl:choose>
<xsl:when test="/CommentsList/Comment[3]/CommentMsg">
<td>
<CommentMsg>
<xsl:copy-of select="@*"/>
<xsl:value-of select="." disable-output-escaping="yes"/>
</CommentMsg>
</td>
</xsl:when>
<xsl:otherwise>
<td>
<xsl:apply-templates select="."/>
<xsl:value-of select="text()"/>
</td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
输出为注释味精是这样的:
data.flow2 [评论味精文本]
为什么我不能在获取评论味精文本LY?
感谢提前:)