Im having an issue coming up with a strategy for this transformation. I cant use a single for-each because the resulting XML must be sequenced.
Here is the input xml
<people>
<person>
<name>Tim</name>
</person>
<person>
<name>Tom</name>
</person>
<person>
<name>Jon</name>
</person>
<person>
<name>Sam</name>
</person>
<person>
<name>Bill</name>
</person>
</people>
Here is how it needs to output
<people>
<friend>
<name>Jon</name>
</friend>
<friend>
<name>Bill</name>
</friend>
<foe>
<name>Sam</name>
</foe>
<neutral>
<name>Tim</name>
</neutral>
<neutral>
<name>Tom</name>
</neutral>
</people>
The criteria for placing each name as friend, foe, neutral is in the xslt, but if I loop through each name, the elements friend, foe, and neutral will be out of order and fail schema tests. This is in XSLT 2.0