Subject: Re: XSLT Table defination Question
From: "Braumuller, Hans" <h.braumueller@xxxxxxxxxxxx>
Date: Fri, 21 Jun 2002 10:58:31 +0200
|
Hi Joerg,
your solution target also my problem in the
Re: count string-length without white-space and breaking if
white-space exists after 126 characters
thread.
Do you have an idea how to convert
testverylong stringgreatert hantwentychar
to
testverylong stringgreatert <br> hantwentychar
i mean if i encounter more than 20 character in my selection i wait until
the next white-space to insert a <br>
I have a blackout today. I cannot figure it out.
My talent lies more in the design than in written programms.
Thanks,
Greetings from Hamburg, Germany.
Hans Braumuller
> -----Ursprungliche Nachricht-----
> Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]Im Auftrag von Joerg
> Heinicke
> Gesendet: Freitag, 21. Juni 2002 00:15
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: Re: XSLT Table defination Question
>
>
> Use a recursive template:
>
> <xsl:template match="element-with-text">
> <xsl:call-template name="chars">
> <xsl:with-param name="string" select="normalize-space()"/>
> </xsl:call-template>
> </xsl:template>
>
> <xsl:template name="chars">
> <xsl:param name="string" select="''"/>
> <xsl:param name="number-of-chars" select="20"/>
> <xsl:value-of select="substring($string, 1, 20)"/>-<br/>
> <xsl:if test="string-length($string) > 20">
> <xsl:call-template name="chars">
> <xsl:with-param name="string" select="substring($string, 21)"/>
> </xsl:call-template>
> </xsl:if>
> </xsl:template>
>
> (untested)
>
> Regards,
>
> Joerg
>
>
> Mehul Kishor Mehta wrote:
> > Hello,
> >
> > I have question about XSLT. I have table with many columns.
> I want to
> > restrict one of the table column no bigger that say 20
> characters. But
> > the problem is value I am putting in from XML file may have
> words which
> > are longer than 20 characters and so table goes wide... !
> > e.g if the word is testverylongstringgreaterthantwentychar .
> > What happens is table goes wider.. and don't restrict it to 20
> > characters and rest show in next row..
> > I would like to have output something as follows..
> > testverylongstringic-
> > hgreaterthantwentych-
> > ar
> >
> > Here is the sample of table defination within XSLT
> >
> > <TABLE BORDER="true" CELLSPACING="1" CELLPADDING="4" WIDTH="98%">
> > <TR>
> > <TD WIDTH="20%" VALIGN="TOP" BGCOLOR="#66cccc" HEIGHT="10">
> > <B><center>
> > <FONT SIZE="2">
> > Attribute Name
> > </FONT>
> > </center></B>
> > </TD>
> > </TABLE>
> >
> > Do anyone know anyway I can do what I need ? I would be
> more than happy
> > even if you point me to right place (if you know) for the
> question I have.
> >
> > Thanks a lot for your help,
> > Mehul.
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|