我有一个xml:
<ShipmentUnit>
<TrackingID>101012163322</TrackingID>
<ShipUnitSequenceID>5</ShipUnitSequenceID>
<Type>CRDCRT</Type>
<DocumentReference type="parentUnit">
<DocumentID>
<ID>101012163322</ID>
</DocumentID>
</DocumentReference>
<PointOfStagingCode>KRD001000000</PointOfStagingCode>
</ShipmentUnit>
<ShipmentUnit>
<TrackingID>101012163322</TrackingID>
<ShipUnitSequenceID>7</ShipUnitSequenceID>
<Type>CRDCRT</Type>
<DocumentReference type="parentUnit">
<DocumentID>
<ID>101012163322</ID>
</DocumentID>
</DocumentReference>
<PointOfStagingCode>KRD001000000</PointOfStagingCode>
</ShipmentUnit>
<ShipmentUnit>
<TrackingID>101012163346</TrackingID>
<ShipUnitSequenceID>9</ShipUnitSequenceID>
<Type>CRDCRT</Type>
<PointOfStagingCode>KRD001000000</PointOfStagingCode>
</ShipmentUnit>
我想组一个组:
<xsl:for-each-group select="ShipmentUnit" group-by="DocumentReference[@type='parentUnit']/DocumentID/ID">
问题是当 XML 没有group-by
节点时会for-each-group
忽略该 XML 节点。
如何包含节点
<ShipmentUnit>
<TrackingID>101012163346</TrackingID>
<ShipUnitSequenceID>9</ShipUnitSequenceID>
<Type>CRDCRT</Type>
<PointOfStagingCode>KRD001000000</PointOfStagingCode>
</ShipmentUnit>
结果呢for-each-group
?