Subject: RE: [xsl] Library functions From: "DuCharme, Bob (LNG)" <robert.ducharme@xxxxxxxxxxxxxx> Date: Tue, 7 Aug 2001 16:47:00 -0400 |
>Is the following piece >of psedo code has the correct idea: > > <fo:block > border-before-width = "floor(4.2 div 2.0)*1.0in" > </fo:block> To tell an XSLT processor to evaluate an expression, you put curly braces around it to make it an attribute value template. The string showing the units ("in") will just confuse it when it's trying to do the math, so append that to the result of the calculation by putting it after the right brace. (After all, you're telling the FO processor about the units, not the XSLT processor, which won't know what to do with them.) This gives you the following: <fo:block border-before-width = "{floor(4.2 div 2.0)}in"/> I wrote something for XML.com demonstrating the use of various math functions in XSLT; see http://www.xml.com/pub/a/2001/05/07/xsltmath.html. (It's an excerpt from my book.) Note that the examples in the column don't use attribute value templates because the XSLT processor assumes that the value of an xsl:value-of element's select attribute is an expression to be evaluated. For this reason, you would have to add the "in" units string as a text node outside of the xsl:value-of element. Bob DuCharme www.snee.com/bob <bob@ snee.com> see http://www.snee.com/bob/xsltquickly for info on new book "XSLT Quickly" from Manning Publications. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Library functions, Carmelo Montanez | Thread | Re: [xsl] Library functions, Carmelo Montanez |
RE: [xsl] Prepending Text to Output, Avula, Raj | Date | Re: [xsl] Library functions, Carmelo Montanez |
Month |