Altova Mailing List Archives


[xsl] Special Characters for Position Sepcific Output.

From: "Avula, Raj" <RAvula@----------->
To:
Date: 7/26/2001 4:20:00 PM
Hi,
		I am writing XSL to generate Text Report which is position
specific.
	That is each attribute/element has to occupy certain no. of
characters
	(eg: Customer ID should occupy 1-10 characters, and firstname 11-35
etc.
	If the input is less than the specified charactes, I am appending
the spaces.)

	Sample XML:
<customer id="100">
	<name>
		<firstname>Steve</firstname>
	</name>
</customer>

	I am using follwoing command to print the first name that should
occupy 25 characters.
		<xsl:variable name="twentyfive_spaces" select="'
'" />
		<xsl:text>*</xsl:text>
		<xsl:value-of select="substring(concat(name/firstname,
$twentyfive_spaces), 1, 25)" />
		<xsl:text>*</xsl:text>

	But the problem is if there are any special characters in the input,
then the ouput is
	exceeding 25 characters.

Sample ouput in normal case is
*Steve                    *

In case of input like <firstname>St&amp;eve</firstname>, output will be
*St&amp;eve                   *
	which exceeds 25 characters. 
	
Please let me know, how can I handle this condition in XSL.


Regards,
Raj


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.