Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 2nd, 2011, 07:27 PM
Registered User
 
Join Date: Jan 2011
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default Create a number of element

Hi

How can I create a number X of nodes in xsl?

For example:
.<br>.<br>.<br>.<br>.<br>.<br>.<br>.<br>.<br>.
 
Old February 2nd, 2011, 07:32 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In XSLT 2.0

Code:
<xsl:for-each select="1 to $N">
  <br/>
</xsl:for-each>
In XSLT 1.0 the usual workaround, which assumes there are at least N nodes in your input document, is

Code:
<xsl:for-each select="//node()[position() &lt;= $N]">
  <br/>
</xsl:for-each>
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference

Last edited by mhkay; February 2nd, 2011 at 07:33 PM.. Reason: code typo





Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i create a number of page of group?? tetrap Crystal Reports 0 September 10th, 2006 10:08 AM
function to create whole number from decimal dhx10000 Classic ASP Professional 1 July 18th, 2006 08:17 PM
create XML element with namespace MikeLI Pro Visual Basic 2005 2 June 29th, 2006 08:33 PM
create an element using a variable for the name brenchley XSLT 2 December 9th, 2005 09:46 AM
How to create a sequential order number? evilandy Access ASP 2 September 24th, 2003 12:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.