Subject: XSLT string formatting functions From: "Albert Tsun" <albert.tsun@xxxxxxxxxxxx> Date: Wed, 18 Oct 2000 10:16:08 +0800 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
XPath errata published, James Clark | Thread | trax.openxml.org coming back?, Mike Brown |
XPath errata published, James Clark | Date | Re: Conditional variable assignment, Steve Muench |
Month |