Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以有类似于<[a-zA-Z0-9]></[a-zA-Z0-9]>匹配 xslt 样式表中每个节点的模式?
<[a-zA-Z0-9]></[a-zA-Z0-9]>
你不想使用正则表达式。只需使用谓词来匹配不包含任何子节点的标签(元素)...
<xsl:template match="*[not(node())]"> ... </xsl:template>
您想如何对仅具有属性(如<foo attr="bar"/>)的元素进行分类?
<foo attr="bar"/>
如果您不想将具有属性的元素分类为单例,您可以将谓词更改为:
<xsl:template match="*[not(node()) and not(@*)]"> ... </xsl:template>
根据 w3c 标准,我的 xml 文件显然是正确的。但是,将它们发送到系统(不是我的)我得到一个错误。我试图通过http://www.xmlvalidation.com/站点验证它们并收到此错误:
XML 文档中的错误:1:1 prolog