[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Template/function libraries for measurement units.
>Date: Mon, 20 Jan 2003 21:52:22 -0800 (PST) >From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> >Subject: Re: Template/function libraries for measurement units. >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > >> Yes, Dimitre's code demonstrates pure XSLT implementations with >particular >> attention to efficiency through the use of functional programming >concepts. >> >> It may take some effort to figure out how to safely extract the >templates you >> need from the complete calculator application, but it is worth it, to >get the >> most portable solution. >> > >Thank you Mike and Michael for mentioning FXSL. > > >Conversion from degrees to radians is defined in the trignm.xsl module >like this: > > <xsl:variable name="deg2rads" select="$pi div 180"/> > >and further down: > > <xsl:variable name="vRads" > select="(($pUnit = 'rad') * $pX) > + ((not($pUnit = 'rad')) * ($pX * $deg2rads))"/> > >which means, that when we want to conver $pX degrees to radians, we'll >use: > >$pX * $deg2rads > > > >Conversion from radians to degrees is defined in the arctrignm.xsl >module in a similar way: > > <xsl:variable name="rad2degs" select="180 div $pi"/> > >and further down: > > <!-- convert radians to degrees (when 'deg' specified) --> > <xsl:value-of > select="(($pUnit = 'rad') * $vradResult) > + ((not($pUnit = 'rad')) * ($vradResult * $rad2degs))"/> > >which means, that when we want to conver $pX radians to degrees, we'll >use: > >$pX * $rad2degs > > >If one needs to work also with minutes and seconds, then this can be >added easily -- delete or multiply twice by 60. > >Should one wait (how long?) until an extension function is provided by >his vendour or by a "standard extension function" and his vendour then >implements it? And hope to be portable? > >Or just use the simple pure XSLT 1.0 expressions above? > >I think everybody can easily find the correct answer. > > >===== >Cheers, > >Dimitre Novatchev. >http://fxsl.sourceforge.net/ -- the home of FXSL > > >__________________________________________________ >Do you Yahoo!? >Yahoo! Mail Plus - Powerful. Affordable. Sign up now. >http://mailplus.yahoo.com 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
|