rss
SOATUBE
Oracle
Custom Search SOABYTE here

Friday, September 23, 2011

XSLT: Padding text output to the right width

Padding Content
<!-- this is the function for making a field the right width --> 
<xsl:template name="leftjustify"> 
<xsl:param name="content"/>
  <xsl:param name="width"/>
  <xsl:choose>
  <xsl:when test="string-length($content) &gt; $width">
          <xsl:value-of select="substring($content,1,$width)"/>
  </xsl:when>
 <xsl:otherwise>
          <xsl:value-of select="$content"/>
  <xsl:call-template name="spaces">
       <xsl:with-param name="length">
                  <xsl:value-of select="$width - string-length($content)"/>
        </xsl:with-param>
   </xsl:call-template>
   </xsl:otherwise>
 </xsl:choose>
 </xsl:template>
 <xsl:template name="spaces">
  <xsl:param name="length"/>
  <!-- the value of this next variable is 255 spaces.. -->
  <xsl:variable name="longstringofspaces"><xsl:text>                                                                                                                                                                                                                                                               </xsl:text></xsl:variable>
  <xsl:value-of select="substring($longstringofspaces,1,$length)"/>
</xsl:template>  

8 comments:

Lucky Patcher said...

pes 2011 apk

luckys said...

yesmovies

harish sharma said...

putlocker

tech zone said...

news whatsapp groups

Nulls Royale said...

Thanks for your information, I was searching this for whole two days.
Also try Nulls Royale

gbwhatsapp said...

Thank you for sharing this, it was helpful!

GBwhatsApp APK said...

Thanks for the detailed article on this topic. I would like to see more such awesome articles from you.

Download FMWhatsapp APK said...

Thanks for sharing this valuable piece of information. Keep sharing more such awesome articles in the future. Goodbye!

Post a Comment

 
Blogger Profile