我正在尝试为测试做一个简单的选择,但它似乎不起作用。这是sml:http://pastebin.com/cwEcVEiL
这是我的xslt样式:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tei="http://www.tei-c.org/ns/1.0"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="/tei:TEI/tei:text/tei:body">
TEST
</xsl:template>
</xsl:stylesheet>
使用这种样式,它仅选择整个xml文档,但是如果我键入match =“ /”,则按预期输出一次TEST。
问题是什么?
对于根本没有任何模板匹配的元素,XSLT将应用内置的默认模板。
除非您想要此默认行为,否则应覆盖这些行为,例如:
<xsl:template match="/">
<xsl:apply-templates select="/tei:TEI/tei:text/tei:body" />
</xsl:template>
<xsl:template match="tei:body">
TEST
</xsl:template>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句