[xsl] calculating math:matrix longest column strings

Subject: [xsl] calculating math:matrix longest column strings
From: "Matthew L. Avizinis" <mla@xxxxxxxxx>
Date: Wed, 15 Oct 2003 16:26:25 -0400
Hello all,
I need some help.
suppose I have a math:matrix of 4 columns by 4 rows (but the matrix could be of any size). I am currently "looking at" a math:mn in the 2nd row, 3rd column during processing of an XSLT transform. I need to be able to find and sum the longest cell in each of the preceding two columns. By the "longest" cell, I mean the cell which has the longest string in the column. In other words, I need to add together the lengths of the longest strings in all the preceding columns of the current element being processed. The structure of the matrix conforms to the w3c schema for mathML, so use any example you like such as
<math>
<matrix>
<matrixrow>
<mn>1</mn>
<mn>10</mn><!-- longest in column -->
<mn>2</mn>
<mi>a</mi>
</matrixrow>
<matrixrow>
<msup><mi>x</mi><mn>2</mn></msup><!-- longest in column -->
<mn>1</mn>
<mn>2</mn>
<mi>x</mi>
</matrixrow>
<matrixrow>
<mn>1</mn>
<mn>1</mn>
<mn>2</mn>
<mn>3</mn>
</matrixrow>
<matrixrow>
<mn>1</mn>
<mn>1</mn>
<mn>2</mn>
<mn>3</mn>
</matrixrow>
</matrix>
</math>


So, for purposes of this example,  the answer would be 4.
Thanks in advance,
Matthew L. Avizinis
Gleim Publications, Inc.


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



Current Thread