• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

xsl count

 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<xsl:if test="$linecnt > $maxLine">
<xsl:call-template name="format">
<xsl:with-param select="substring($txt,$real-width + 1)" name="txt"/>
<xsl:with-param select="$width" name="width"/>
</xsl:call-template>
</xsl:if>
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Balaji, is it a question or an answer?
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Sorry! I forgot to check again what i exactly pasted from my textpad after typing.
whats going on with me.
This is my question.
I want to split 'n' number of characters into 35 characters per line AND with a maximum of 5 lines and strip off rest of the characters.
I'm doing this for xsl:fo.
As usual (after i got failed) i copied the code from http://www.dpawson.co.uk/xsl/sect2/N7240.html#d60e246
But to stripoff characters more than 5 lines,i have to count the number of lines it has printed already.
so that i can code something like this in the above code after <xsl:text></xsl:text> line.
<xsl:if test="$lineCnt & l t; $maxLine">
<xsl:call-template name="format">
<xsl:with-param select="substring($txt,$real-width + 1)" name="txt"/>
<xsl:with-param select="$width" name="width"/>
</xsl:call-template>
where maxLine is 5 and the lineCnt will increase after printing each line.
But I couldn't able to do it as xsl doesn't support changing value.
I'm missing the logic here,i think i have to do something with recursive funtion.
Please help!!
Thanks
[ July 03, 2002: Message edited by: Balaji Loganathan ]
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone please help me!
If my question is not clear,please tell me.
Regards
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call the function 'position()' from e.g. 'xsl:if' and then validate what value it has.
/Rene
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Balaji Loganathan:
[QB]Thks Rene,
I tried it,but its printing 0 in all occurences,I tried to place it in all possible place i can.
Basically what i tryin is
Input:
My little fox brown is blah blah end.
Output:
My lit
tle fo
x brow
n is b
lah bl
Condition is "max n lines(say 6),max 6 characters per line,strip of rest.
This I'm doing this for XSL:fo because in xsl:fo if i allow more than 5 lines in a table,its renders to second page, which it shoud not.

 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess u have to do some recursion here.


am not sure if i got your question right though.
anyways HTH
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Karthik,
This is what i'm trying for,felt bad that I couldn't able to code this of my own.Thanks a lot.
I just changed the rest variable code to avoid re-occurences of last line character.

Thanks again
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic