XSLT1.0 Sequência de renderização de diferentes elementos armazenados em uma variável como tabela M x N
Eu tenho o seguinte XML (é simplificado e a maioria dos atributos é omitida):
<Document>
<Transfer Name="" From="" To=""/>
<Transfer Name="" From="" To=""/>
<OtherElement/>
<OtherElement/>
<Flight AirLina="" From="" To=""/>
<Flight AirLina="" From="" To=""/>
<OtherElement/>
<Hotel Name="" Duration=""/>
<Hotel Name="" Duration=""/>
<OtherElement/>
<OtherElement/>
<Extras Name="" Price=""/>
<Extras Name="" Price=""/>
<Extras Name="" Price=""/>
<Extras Name="" Price=""/>
<Extras Name="" Price=""/>
<Extras Name="" Price=""/>
<OtherElement/>
<OtherElement/>
</Document>
Eu tenho uma variável, contendo diferentes elementos:
<xsl:variable name="packageElements"
select="/Document/Transfer | /Document/Coach | /Document/Flight | /Document/Hotel | /Document/Extras" />
Gostaria de exibir esses dados em uma tabela com 2 colunas. Estou usando o processador XSLT1.0 e MSXSL.
Eu tenho experimentado com a solução mais simples que consegui pensar:
<table>
<tbody>
<xsl:for-each select="$packageElements[position() mod 2 = 1]">
<tr>
<td>
<!-- current element -->
<xsl:value-of select="local-name()"/>
</td>
<td>
<!-- element following the current in the $packageElements variable -->
<!-- Here is where I'm stuck, I can't figure out how to correctly pick it up :( -->
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
Realmente apreciaria qualquer ajuda.