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>