correctly handle nameReferences and cardinality (min/max) during transformation