Re: converting from HTML to WML

Hi Mariam,

I don't mean to give you a hard time, but you are posing your question in 
the wrong place.  I think you would get a better response on an XSLT 
mailing list.  You should be able to locate one at www.xml.org or, perhaps, 
http://www.w3.org/Style/XSL/.

For myself, I am surprised that a WML user agent doesn't calculate cell 
sizes for you - much as HTML browsers do.

good luck,
Charlie


At 02:57 PM 5/6/2002 -0700, mariam aziz wrote:

>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!?
><http://rd.yahoo.com/welcome/*http://health.yahoo.com>Yahoo! Health - your 
>guide to health and wellness

Received on Tuesday, 7 May 2002 09:40:38 UTC