|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Field padding in XSLT2
Greetings,
Here is the code fragment I use to pad a character for an XSL stylesheet
that generates a text document:
<!-- This code copied from
http://www.topxml.com/code/default.asp?p=3&id=v20030419195352&ms=100&l=&sw=A
ll -->
<xsl:template name="pad">
<xsl:param name="num" />
<xsl:param name="max" />
<xsl:param name="char" />
<xsl:if test="not($num = $max)">
<xsl:value-of select="$char"/>
<xsl:call-template name="pad">
<xsl:with-param name="num" select="$num + 1"/>
<xsl:with-param name="max" select="$max"/>
<xsl:with-param name="char" select="$char"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
The template call to pad for 10 spaces looks like this:
<xsl:call-template name="pad">
<xsl:with-param name="num" select="0"/>
<xsl:with-param name="max" select="10"/>
<xsl:with-param name="char" select=" "/>
</xsl:call-template>
I have the luxury of using XSLT version 2. Is there a better/faster/easier
way of doing this padding?
Thanks,
Jim Neff
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








