[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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:
/
Re: [xsl] Generate N elements
Subject: Re: [xsl] Generate N elements From: Mike Trotman <mike.trotman@xxxxxxxxxxxxx> Date: Thu, 08 Jul 2004 14:07:24 +0100 |
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
-- Datalucid Limited 8 Eileen Road South Norwood London SE25 5EJ United Kingdom
/ tel :0208-239-6810 mob: 0794-725-9760 email: mike.trotman@xxxxxxxxxxxxx
UK Co. Reg: 4383635 VAT Reg.: 798 7531 60
/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Generate N elements, Kenny Bogoe (BogoeMD | Thread | [xsl] xPath question, Jan Kohnert |
RE: [xsl] xPath question, vsubramanian | Date | Re: [xsl] xPath question, David Carlisle |
Month |
Keywords