File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xsl count

 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • 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>
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Balaji, is it a question or an answer?
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • 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
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please help me!
If my question is not clear,please tell me.
Regards
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • 0
  • Mark post as helpful
  • send pies
  • 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
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic