- From: mariam aziz <mariam_louis_aziz@yahoo.com>
- Date: Mon, 6 May 2002 14:57:45 -0700 (PDT)
- To: html-tidy@w3.org
- Message-ID: <20020506215745.12252.qmail@web14104.mail.yahoo.com>
Dear sir iam still have the problem of coverting table from HTML to WML without presenting it as table by border i arriver to an idea but i face some problems in implemening it by XSL the idea is get the max of length of strings in the previous column of <td> then get the string length of previos td in same row so calculate space as max-length of prev td in same column+1 example <table> <tr><td>a</td><td>xyz</td></tr> <tr><td>ab</td><td>xyzm</td></tr> <tr><td>abc</td><td>xyzx</td></tr> </table> so space between first td and second td in first row calculated as max(1,2,3) (length of a,length of ab,length of abc) which is 3 length of prev td which is length of a which is 1 so final requires space is 3-1+1=3 the result will be a xyz ab xyzm abc xyzx what i implement is getting max string length of prev col but problem is getting the length of prev td in same col and how can i loop by the result value to generate no of spaces equal to result no code which i write <xsl:template match="tr"> <xsl:apply-templates/> </xsl:template> <xsl:template match="td"> <xsl:variable name="po"> <xsl:value-of select="position()"/> </xsl:variable> <xsl:variable name="o"> <xsl:value-of select="position() div 2"/> </xsl:variable> <xsl:if test="$o!='1'"> <xsl:variable name="oy"> <xsl:value-of select="position()"/> </xsl:variable> <!-- i have problem here><xsl:variable name="len"><xsl:value-of select="string-length(//tr[position()=$o]/td[position()=$o - 1])"/></xsl:variable> <xsl:variable name="op"> <xsl:for-each select="//tr/td[position()=$o - 1]"> <xsl:sort select="string-length(.)" order="descending" data-type="number"/> <xsl:value-of select="string-length(.)"/> <xsl:text>~</xsl:text> </xsl:for-each> </xsl:variable> <xsl:variable name="max"> <xsl:value-of select="substring-before($op,'~')"/> </xsl:variable> <xsl:variable name="final"> <xsl:value-of select="$max+1-$len"/> </xsl:variable> <! another problem how to loop with final value to get spaces> <xsl:if test="$final>'0'"> <xsl:apply-templates select="td" mode="s"/> <xsl:text> </xsl:text> <xsl:value-of select="$final - 1"/> </xsl:if> </xsl:if> <xsl:apply-templates/> </xsl:template> wait for your reply please help me thanks --------------------------------- Do You Yahoo!? Yahoo! Health - your guide to health and wellness
Received on Monday, 6 May 2002 17:57:46 UTC