Given exactly what you state is your input (I suspect it's more complicated),
this stylesheet will give the output you asked for using recursive calls to a
named template.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:call-template name="pageBrowser">
<xsl:with-param name="maxpage" select="14" />
</xsl:call-template>
</xsl:template>
<xsl:template name="pageBrowser">
<xsl:param name="maxpage" />
<xsl:param name="start" select="5" />
<xsl:variable name="factor" select="/pageBrowser/@pageSize" />
<xsl:variable name="skipcount" select="$start * $factor" />
<xsl:if test="$start le $maxpage">
<a href="toto.htm?skip={$skipcount}"><xsl:value-of select="$start" /></a>
<xsl:call-template name="pageBrowser">
<xsl:with-param name="maxpage" select="$maxpage" />
<xsl:with-param name="start" select="$start + 1" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Philippe LAPLANCHE <philippe(_dot_)laplanche(_at_)horus-si(_dot_)com>
Sent: Fri, 7 Apr 2006 16:54:40 +0200
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] RE: xsl for
Sorry I sent the mail before I finished writing it.
This may appear silly but I don't know how to do this in a clean way
with xsl ...
My input is
<pageBrowser startPage="5" pageSize="10"/>
And I want this output :
<a href="toto.htm?skip=50">5</a>
<a href="toto.htm?skip=60">6</a>
<a href="toto.htm?skip=70">7</a>
<a href="toto.htm?skip=80">8</a>
<a href="toto.htm?skip=90">9</a>
<a href="toto.htm?skip=100">10</a>
<a href="toto.htm?skip=110">11</a>
<a href="toto.htm?skip=120">12</a>
<a href="toto.htm?skip=130">13</a>
<a href="toto.htm?skip=140">14</a>
I mean I want to use a loop somewhere and I don't want to have
<xsl:template match="pageBrower">
<a href="toto(_dot_)htm?skip={(_at_)startPage*@pageSize}"><xsl:value-of
select="@startPage"/></a>
<a href="toto.htm?skip={(@startPage+1)*(_at_)pageSize}"><xsl:value-of
select="@startPage+1"/></a>
<a href="toto.htm?skip={(@startPage+2)*(_at_)pageSize}"><xsl:value-of
select="@startPage+2"/></a>
<a href="toto.htm?skip={(@startPage+3)*(_at_)pageSize}"><xsl:value-of
select="@startPage+3"/></a>
...
</xsl:template>
Thanks in advance
Philippe
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--