有人可以帮我找出下面 XSLT 中的问题吗?我只需要将“viewport”行插入到 html 标记中,但是收到与我的 XSLT 文件的最后一个标记相关的错误消息“XML 文档必须以相同的实体开始和结束”。 非常欢迎任何意见,谢谢!
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Identity template -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template to match the head element -->
<xsl:template match="head">
<xsl:copy>
<!-- Copy existing content -->
<xsl:apply-templates select="@*|node()"/>
<!-- Add the new meta tag -->
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</xsl:copy>
</xsl:template>
@y.arazim 非常感谢,绝对是那里缺少的一个。 (
</xsl:stylesheet>
)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Identity template -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Template to match the head element -->
<xsl:template match="head">
<xsl:copy>
<!-- Copy existing content -->
<xsl:apply-templates select="@*|node()"/>
<!-- Add the new meta tag -->
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</xsl:copy>
</xsl:template>
<!-- AND NOW the Missing END-TAG </xsl:stylesheet> -->
</xsl:stylesheet>