[xsl] Transposing matrices

Subject: [xsl] Transposing matrices
From: Nickolay Kolev <nmkolev@xxxxxxxxxxx>
Date: Sun, 20 Oct 2002 17:10:45 +0200
Hi all,

I amy trying to wite a stylesheet that will transpose matrices 
written in the following format: 

<matrix>
<row>
<item>xxx</item><item>yyy</item> ...
</row>
<row>
..
</row

.. more rows ... here

</matrix>

The stylesheet I have come up with so far (thanks to a very old 
message at this forum actually) is: 

<xsl:template match="//matrix">
<matrix>
<xsl:for-each select="//row[1]/item">
<xsl:variable name="i" select="position()"/>
<row>
  <xsl:for-each select="//row">
    <item><xsl:value-of select="item[$i]"/></item>
  </xsl:for-each>
</row>
</xsl:for-each>
</matrix>
</xsl:template>

This does work perfectly if the items contain "normal data". The  
stylesheet must however work as well with items that may contain 
A 
MATRIX! 

I know the way the matrices are selected should be modified but I 
can't figure out how. 

Could anyone please help?

Many thanks in advance,
Nickolay Kolev


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread