I'm running into a bit of an problem with XSLT while transforming an xml to another xml. The xml and xslt I am working with is more complex, and this problem is just a section of it.
The Problem
I want information stored in a single element to go to two different elements in the output, and then do the same operation on the next element.
My programming instinct was to find the XSLT 1.0 version of making two lists and appending the correct data, but I don't see how to do that in pure XSLT 1.0.
The current solution is to call for-each statements for every kind of data I want to extract from these elements, but this ends up with a lot of repeating code. There has to be a better way! What is it and can you explain it well?
An example
I have an xml of character elements. I want to extract names and quotes from each character, and put the names in a "character" element and quotes in a "taglines" element.
Initial XML:
<Cast>
<Character>
<name>The Cheat</name>
<quote>Meh</quote>
</Character>
<Character>
<name>Homsar</name>
<quote>eey-y-yy</quote>
</Character>
</Cast>
Output XML:
<Cast>
<Character>
<name>The Cheat</name>
<name>Homsar</name>
</Character>
<taglines>
<quote>Meh</quote>
<quote>eey-y-yy</quote>
</taglines>
</Cast>