File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes xsl count Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xsl count " Watch "xsl count " New topic
Author

xsl count

Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
<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>


Spritle Software Blogs
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Balaji, is it a question or an answer?
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
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

Joined: Jul 13, 2001
Posts: 3150
Can someone please help me!
If my question is not clear,please tell me.
Regards
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You can call the function 'position()' from e.g. 'xsl:if' and then validate what value it has.
/Rene


Regards, Rene Larsen
Dropbox Invite
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
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

Joined: Mar 06, 2001
Posts: 1209
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

Joined: Jul 13, 2001
Posts: 3150
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
 
subject: xsl count