[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Library functions

Subject: RE: Library functions
From: "DuCharme, Bob (LNG)" <robert.ducharme@xxxxxxxxxxxxxx>
Date: Tue, 7 Aug 2001 16:47:00 -0400
library function xslt
>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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.