You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by alphamanic <yo...@hotmail.com> on 2007/07/13 18:29:33 UTC
Newbie question for incrementing a number
Hi Guys,
This is a newbie question.
I have an XSL which reads in some of value from xml using Document()
function and some some <XSL:PARM>. I'm using <fo:block> to display the
content in a block.
Simply what I want to do is create a counter that will increment for my each
<FO:BLOCK>i.e.
<fo:block>
<display counter value>
<xsl:valueOf select="$param1"/>
</fo:block>
<fo:block>
<display counter value>
<xsl:valueOf select="document(somexml.xml)/note1"/>
</fo:block>
etc.
Please help? - I've tried the below code but it doesn't work:
<xsl:parm name="counter" select="1"/>
<some template>
<fo:block>
<xsl:with-parm name="counter" select="$counter + 1"/>
<xsl:valueOf select="$counter"/> - this return 1 instead of 2
</some template>
--
View this message in context: http://www.nabble.com/Newbie-question-for-incrementing-a-number-tf4075495.html#a11582913
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Newbie question for incrementing a number
Posted by Trevor Keast <tk...@cssi.org>.
You cannot increment a number using (x = x + 1) as you can in most
languages, however you can use the position() function as a counter in
many cases.
For example:
<xsl:valueOf select="position()"/>
The alternative to this is to use a recursive template, which is a bit
more tricky.
Hope that helps,
Trevor.
alphamanic wrote:
> Hi Guys,
>
> This is a newbie question.
>
> I have an XSL which reads in some of value from xml using Document()
> function and some some <XSL:PARM>. I'm using <fo:block> to display the
> content in a block.
> Simply what I want to do is create a counter that will increment for my each
> <FO:BLOCK>i.e.
>
> <fo:block>
> <display counter value>
> <xsl:valueOf select="$param1"/>
> </fo:block>
>
> <fo:block>
> <display counter value>
> <xsl:valueOf select="document(somexml.xml)/note1"/>
> </fo:block>
>
> etc.
>
> Please help? - I've tried the below code but it doesn't work:
> <xsl:parm name="counter" select="1"/>
> <some template>
> <fo:block>
> <xsl:with-parm name="counter" select="$counter + 1"/>
> <xsl:valueOf select="$counter"/> - this return 1 instead of 2
> </some template>
--
Trevor Keast
Client Server Specialists Inc.
Email: tkeast@cssi.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Newbie question for incrementing a number
Posted by Lo...@log-net.com.
Check the archives for this group or try:
http://www.dpawson.co.uk/xsl/sect2/N4806.html
Oh, and try not to cross post.
-Lou
alphamanic <yo...@hotmail.com> wrote on 07/13/2007 12:29:33 PM:
>
> Hi Guys,
>
> This is a newbie question.
>
> I have an XSL which reads in some of value from xml using Document()
> function and some some <XSL:PARM>. I'm using <fo:block> to display the
> content in a block.
> Simply what I want to do is create a counter that will increment for my
each
> <FO:BLOCK>i.e.
>
> <fo:block>
> <display counter value>
> <xsl:valueOf select="$param1"/>
> </fo:block>
>
> <fo:block>
> <display counter value>
> <xsl:valueOf select="document(somexml.xml)/note1"/>
> </fo:block>
>
> etc.
>
> Please help? - I've tried the below code but it doesn't work:
> <xsl:parm name="counter" select="1"/>
> <some template>
> <fo:block>
> <xsl:with-parm name="counter" select="$counter + 1"/>
> <xsl:valueOf select="$counter"/> - this return 1 instead of 2
> </some template>
> --
> View this message in context: http://www.nabble.com/Newbie-question-
> for-incrementing-a-number-tf4075495.html#a11582913
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>