Xslt 2.0 对每个组使用xslt

Xslt 2.0 对每个组使用xslt,xslt-2.0,xslt-grouping,Xslt 2.0,Xslt Grouping,我试图使用XSLT2.0根据字段对记录进行分组,并为每个记录创建一个“组id” 我尝试创建这个XSLT <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="/*"> <Hire> &l

我试图使用XSLT2.0根据字段对记录进行分组,并为每个记录创建一个“组id”

我尝试创建这个XSLT

 <xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:template match="/*">
 <Hire>
  <xsl:for-each-group select="Record" group-by="XRefCode">
   <group name="{current-grouping-key()}">
    <xsl:copy-of select="current-group()"/>
   </group>
  </xsl:for-each-group>
 </Hire>
</xsl:template>
</xsl:stylesheet>

我得到的只是输出中的根节点

这是输入

   <?xml version="1.0" encoding="UTF-8"?>
    <Data>
<Record>
    <H1>D</H1>
    <Employee>Employee</Employee>
    <Employee1>Employee</Employee1>
    <XRefCode>012912</XRefCode>
    <EmployeeNumber>012912</EmployeeNumber>
</Record>
<Record>
    <H1>D</H1>
    <Employee>Employee</Employee>
    <Employee1>Employee</Employee1>
    <XRefCode>09090</XRefCode>
    <EmployeeNumber>012912</EmployeeNumber>
</Record>
<Record>
    <H1>D</H1>
    <Employee>Employee</Employee>
    <Employee1>Employee</Employee1>
    <XRefCode>012912</XRefCode>
    <EmployeeNumber>012912</EmployeeNumber>
</Record>
<Record>
    <H1>D</H1>
    <Employee>Employee</Employee>
    <Employee1>Employee</Employee1>
    <XRefCode>09090</XRefCode>
    <EmployeeNumber>012912</EmployeeNumber>
</Record>
     </Data>

D
雇员
雇员
012912
012912
D
雇员
雇员
09090
012912
D
雇员
雇员
012912
012912
D
雇员
雇员
09090
012912

可以很好地处理您的原始代码和输入,因此您可能有一些不同的输入(名称空间?)和/或您可能不使用XSLT 2处理器。您是对的。它应该是有效的。非常感谢。