Xslt 在XSL转换中使用XML模式组
我在XML模式中有组定义。像这样:Xslt 在XSL转换中使用XML模式组,xslt,xsd,Xslt,Xsd,我在XML模式中有组定义。像这样: <attributeGroup name="my_attributes"> <attribute ref="ns:foo" /> <attribute ref="ns:bar" /> </attributeGroup> 此外,我还有一个XML转换,我希望能够重用这些定义。是否可以创建与此类组匹配的模板?可能是这样的: <xsl:template matchGroup="my_attri
<attributeGroup name="my_attributes">
<attribute ref="ns:foo" />
<attribute ref="ns:bar" />
</attributeGroup>
此外,我还有一个XML转换,我希望能够重用这些定义。是否可以创建与此类组匹配的模板?可能是这样的:
<xsl:template matchGroup="my_attributes">
<foobar>
<xsl:copy-of select="@*"/>
<xsl:value-of select="." />
</foobar>
</xsl:template>
<xsl:template matchGroup="my_attributes">
<foobar>
<xsl:copy-of select="@*"/>
<xsl:value-of select="." />
</foobar>
</xsl:template>
是否可以创建与此类组匹配的模板?
可能是这样的:
<xsl:template matchGroup="my_attributes">
<foobar>
<xsl:copy-of select="@*"/>
<xsl:value-of select="." />
</foobar>
</xsl:template>
<xsl:template matchGroup="my_attributes">
<foobar>
<xsl:copy-of select="@*"/>
<xsl:value-of select="." />
</foobar>
</xsl:template>
上述匹配模式的含义:
将前缀
“ns:
关联到的命名空间中的任何属性与local-name()
foo
匹配,并且其“父级”(此属性附加到的元素)*还有另一个名为*ns:bar
matchGroup
中得到什么语义。你期望它做什么?