473,326 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Iterate trough a string

hi all,

In my XML document i have <paragraph type="...">some text</paragraph>
the type="..." specifies what type the paragraph is. This is all
defined somewehere else in the document.
The type specifies what font should be used, if the text should be
bold etc.
It also specifies if the text should be underlined including spaces,
underlined excluding spaces or not underlined at all.
The problem arise when i need to underline excluding the spaces
(space, tab etc.)
To do this i have to itterate trough the string and use underscore if
the character is not a whitespace. I have this in my xsl document:
===code=========================================== ==============================
<xsl:template name="word_underline">
<xsl:param name="pos" />
<xsl:choose>
<xsl:when test="substring(current()/text(),$pos,$pos)=' '">
<fo:inline text-decoration="no-underline">
<xsl:value-of select="substring(current()/text(),$pos,$pos)" />
</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline text-decoration="underline">
<xsl:value-of select="substring(current()/text(),$pos,$pos)" />
</fo:inline>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length()!=$pos">
<xsl:call-template name="word_underline">
<xsl:with-param name="pos">
<xsl:value-of select="$pos+1" />
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
===/code============================================== ==========================

and then i call this template like this:

===code=========================================== ==============================
<xsl:when test="/document/definitions/stylesheets/stylesheet[@name=current()/@stylesheet]/character/face/wordunderline='1'">
<xsl:call-template name="word_underline">
<xsl:with-param name="pos">1</xsl:with-param>
</xsl:call-template>
</xsl:when>
===/code============================================== ==========================

If I run the above throug FOP (with xalan-j) the text looks all messed
up. If the string is <paragraph type="...">some text</paragraph> the
output looks something like this:
soos mesome t somet tex mtxt ext
or something like that. and everything is underlined. (spaces also)

Does anybody know what i am doing wrong?
thanks for any help,
Jurrie
Jul 20 '05 #1
0 1575

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrés Giraldo | last post by:
Hi! I'm trying to pass trough all the objects of a form but I have some text inputs in a DIV and I have many DIVs like this on my form. I'm doing something like: for (i = 0; i <...
4
by: Radek Michalski | last post by:
Hi! I'm looking for a macro, that let me pass trough all rows in table (ID int - key, string Name) and everytime calls a query with a Name (or ID) as parameter. I can't find this kind of macro....
0
by: Javier de la Torre | last post by:
Hi all, I'm wondering if someone has experiment problems using SQL statements with UNIONS trough the ODBC driver. For example this SQL statement: (SELECT DISTINCT compactes.numplec AS UnitId...
3
by: Antoine Junod | last post by:
Hello, I definitely have a problem to build a clean data structure. I would be very happy if some of you could help me as well as in the past. Here is my problem: -> I have a list of...
1
by: JLuis | last post by:
Hi I'm consuming a WebService which is declared as String. When I read it I got a string, which is ok. But they tell me it also contains several fields (they built it in some Borland language),...
5
by: Tor Inge Rislaa | last post by:
I have a dataset with a table "Artikler". Before I bind the table to a DataList in my Web Form I want to update the value of each row of the field "PreText" in the table. (I don't want to update...
4
by: Boni | last post by:
I want consuming a webserivce trough a proxy. I use this code. myService s = new myService (); System.Net.WebProxy proxyObject = new System.Net.WebProxy("http://proxyhost:8080"); s.Proxy =...
1
by: nagarwal | last post by:
hi frnds, I am facing a prblm in displaying the contents of an ArrayList which contains 'String' Objects using logic:iterate tag.. example: in the Action : String s=null; String s1=null;...
1
by: prathna | last post by:
Hi .. I have a logic:iterate tag which will display 5 rows each row with a drop downlist and 2 textfields.now by default all the rows will be shown.how do i hide all the rows except the first...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.