[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Transposing matrices

Subject: Re: Transposing matrices
From: martin@xxxxxxxx
Date: Sun, 20 Oct 2002 19:29:27 +0000 (GMT)
transposing matrices
Nickolay -

should the 'embedded' matrices be transposed as well?
then maybe

<xsl:template match="matrix"> <!-- no need for // -->
 <xsl:variable name="matrix" select="."/>
 <matrix>
 <xsl:for-each select="row[1]/item">
 <xsl:variable name="i" select="position()"/>
 <row>
   <xsl:for-each select="$matrix/row">
     <item><xsl:apply-templates select="item[$i]/*"/></item>
   </xsl:for-each>
 </row>
 </xsl:for-each>
 </matrix>
 </xsl:template>

provided there's a template (eg the default) for text that copies
content that isn't a matrix. also, this may not work with non-text,
non-matrix items!

otherwise, replace the value-of with copy-of :
    <xsl:copy-of select="item[$i]"/>
(no enclosing <item> tags as you get them anyhow with the copy-of)

btw, you wrote: <xsl:for-each select="//row">
this will match on all rows of all matrices, probably not what you want

hth,

/m




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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.