xml xsl recombine values



I'm real newbee to XML/XSL and try to convert a XML into another XML format. I have a filemaker export which I have to convert. The XML looks like that



<machineName>
<DATA>Machine 1</DATA>
<DATA>Machine 2</DATA>
<DATA>Machine 3</DATA>
<DATA>Machine 4</DATA>
<DATA>Machine 5</DATA>
<DATA>Machine 6</DATA>
<DATA>Machine 7</DATA>
</machineName>
<machineType>
<DATA>12</DATA>
<DATA>15</DATA>
<DATA>31</DATA>
<DATA>44</DATA>
<DATA>14</DATA>
<DATA>12</DATA>
<DATA>54</DATA>
</machineType>
<machineBuilt>
<DATA>1982</DATA>
<DATA>1985</DATA>
<DATA>1977</DATA>
<DATA>1966</DATA>
<DATA>1999</DATA>
<DATA>1975</DATA>
<DATA>2001</DATA>
</machineBuilt>


And that is how it should look like in the end:



<machine>
<name>Machine 1</name>
<machineType>12</machineType>
<machineBuilt>1982</machineBuilt>
</machine>
<machine>
<name>Machine 2</name>
<machineType>15</machineType>
<machineBuilt>1985</machineBuilt>
</machine>
<machine>
<name>Machine 3</name>
<machineType>31</machineType>
<machineBuilt>1977</machineBuilt>
</machine>
.... and so on


I managed to read the "machineName/Data" values and convert them to the desired formats with the xsl:for-each command. But I don't know how to read the others values within the loop.


Can anybody give me a clue?


thx for your help dan


No comments:

Post a Comment