预期令牌'eof'找到'@'

解码器

我正在学习xslt和xpath。当从节点中选择一个属性时,出现此错误预期标记'eof'找到了'@'。

这是我的XML和XSL文件:

XML:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<inventory>
<drink>
    <lemonade supplier="mother" id="1">
        <price>$2.50</price>
        <amount>20</amount>
    </lemonade>
    <pop supplier="store" id="2">
        <price>$1.50</price>
        <amount>10</amount>
    </pop>
</drink>
<snack>
    <chips supplier="store" id="3">
        <price>$4.50</price>
        <amount>60</amount>
        <calories>180</calories>
    </chips>
</snack>
</inventory>

XSL文件:

<?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:value-of select="inventory/snack/chips@supplier"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
伊恩·罗伯茨(Ian Roberts)

您缺少斜线:

<xsl:value-of select="inventory/snack/chips/@supplier"/>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章