[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSLT string formatting functions
Hi all, I am now trying to develop a Report Engine using XML file as datasource and XSL file as report template to output a formatted report in text-file format. I use Xalan to do the transform to a get rid of the tags in XML files. But I got problems when I try to place XML data in desired positions using XSL construct. (1) How to have indentation, linefeed and space precisely placed in transformed output? In my XSL, I use <xsl:text> to represent spaces and linefeed. how can I make a string value (e.g. <xsl:value-of select="x1"/> to have a specific length? Because the text node may contain variable length, in order to place them nicely in report, I want to pad space before, after the text value. (2) Besides, is there any decimal format functions to nicely format text (which should be numeric figures) in specified format-string ? for example, in my XML source <Price> 1000</Price> How can I transform the 1000 (text) into a nicely formatted decimal string using XSL element? For example, if I want in my textual report: Price = [1,000.00] ( if I want to have formatted string of length 8 and have grouping separator "," and decimal-separator=".") or Price = [ 1,000.00] (with 2 spaces padded before 1,000.00) ( if I want to have formatted string of length 10 and have grouping separator "," and decimal-separator=".") Do I need to use <xsl:deimal-format> , format-number(.....) and if they are used, how can I apply in XSL and define them? Many Thanks in advance XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|