Dave Pawsons XSLT FAQ has useful examples of this.
http://www.dpawson.co.uk/xsl/sect2/sect21.html
There are two main approaches:
- Repetiton - using recursive templates
- a neat approach Jeni Tennison pointed out by selecting document nodes
in the XSLT stylesheet and using position() to limit the number
This can be used in a for-each loop
e.g.
<xsl:variable name='thisdoc' select='.'/>
<xsl:for-each select='document("")//*[position() <= $num_times]'>
<!-- use $thisdoc if you want to access main document nodes -->
<!-- do whatever you want -->
</xsl:for-each>
Kenny Bogoe (BogoeMD) wrote:
Hi,
This is probably very simple... I need to generate N elements on the fly. N
is a number in my source xml.
Source xml:
<Root>
<data>4</data>
</Root>
Result xml:
<Root>
<info/>
<info/>
<info/>
<info/>
</Root>
Thanks,
Kenny Bogoe
--+------------------------------------------------------------------
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>
--+--
--
Datalucid Limited
8 Eileen Road
South Norwood
London SE25 5EJ
United Kingdom
/
tel :0208-239-6810
mob: 0794-725-9760
email: mike(_dot_)trotman(_at_)datalucid(_dot_)com
UK Co. Reg: 4383635
VAT Reg.: 798 7531 60
/