Ranjan K. Baisak wrote:
select="substring('...................................',
1, $myLength)"/> should do the trick!
But if $myLength is greater than the number of chars
in the string?
Like most things you'd accomplish with loops in traditional languages,
this can be done in XSLT with recursion and named templates. Here's a
simple stylesheet that prints 100 dots.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="dots">
<xsl:with-param name="count">100</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="dots">
<xsl:param name="count" select="1"/>
<xsl:if test="$count > 0">
<xsl:text>.</xsl:text>
<xsl:call-template name="dots">
<xsl:with-param name="count" select="$count -1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Obviously if you could call the dots template with the count param set
to a value provided by the input document rather than a constant as seen
here.
--
Elliotte Rusty Harold elharo(_at_)metalab(_dot_)unc(_dot_)edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
--~------------------------------------------------------------------
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>
--~--