[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Print number of chars depending upon int value

Subject: Re: Print number of chars depending upon int value
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 22 Apr 2005 12:47:19 +0100
Re:  Print number of chars depending upon int value
> Should not there be an alternative for any function in
> xslt2.0 in xslt 1.0. 

No, of course not.
What would be the difference between (xslt1 + xslt1 versions of all
xslt2 features) and xslt2.

This is not specific to xslt, for any language, if a new feature is
added in a new version, it's not available in the old one.

> Otherwise it is required to write 100 lines of code as
> mentioned by Eliot Harold.


In this case it's not 100's of lines. Unless your padding needs to be
really long (ie nore characters than there are nodes in your stylesheet)
then you can do

<xsl:for-each select="(document('')//node())[position() &lt;=
$count]">.</xsl:for-each>

if you want to do a fully general recursive loop then something like

<xsl:template name="x">
 <xsl:param name="n"/>
  <xsl:if test="$n!=0">.<xsl:call-template name="x">
     <xsl:with-param name="n" select="$n - 1"/>
     </xsl:call-template>
  </xsl:if>
</xsl:template>

which is 7 lines, 3 of which are just closing open elements so it's
really only 3 lines of code.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.