Xslt 在XSL转换中使用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

我在XML模式中有组定义。像这样:

<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
mean?@Alp:我用你要求的解释更新了答案。谢谢你的解释,但这不是我故意需要的。XSD中的attributeGroup意味着任何属性都是允许的,它们不必同时出现(忽略父级)。我将把你的答案标记为解决方案,因为你告诉我,如果不硬编码每个属性名称(或使用名称空间),我的想法是不可能实现的。@Alp:欢迎你。至于误解,这种情况经常发生——如果你是一个领域的专家,但在另一个领域寻求帮助,不要指望其他领域的专家知道你专业领域的任何事情。我想知道你会从一个虚构的属性
matchGroup
中得到什么语义。你期望它做什么?