![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Scientific (Engineering) format supported for multiplication operator? >Thread Next - Re: Scientific (Engineering) format supported for multiplication operator? Re: Scientific (Engineering) format supported for multiplication operator?To: NULL Date: 8/17/2008 11:20:00 PM On 15 Aug, 14:40, Martin Honnen <mahotr...@yahoo.de> wrote:
> bar...@bluezone.no wrote:
> > MSXML unfortunately....
>
> With MSXML you could use an extension function written in JavaScript e.g.
>
> <xsl:stylesheet
> =A0 =A0xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
> =A0 =A0xmlns:msxsl=3D"urn:schemas-microsoft-com:xslt"
> =A0 =A0xmlns:my=3D"http://example.com/2008/mf"
> =A0 =A0exclude-result-prefixes=3D"my msxsl"
> =A0 =A0version=3D"1.0">
>
> =A0 =A0<xsl:output method=3D"html" indent=3D"yes"/>
>
> =A0 =A0<msxsl:script language=3D"JavaScript" implements-prefix=3D"my">
> =A0 =A0function stringToDouble (s) {
> =A0 =A0 =A0return parseFloat(s);
> =A0 =A0}
> =A0 =A0</msxsl:script>
>
> =A0 =A0<xsl:template match=3D"root">
> =A0 =A0 =A0<html lang=3D"en">
> =A0 =A0 =A0 =A0<head>
> =A0 =A0 =A0 =A0 =A0<title>Example</title>
> =A0 =A0 =A0 =A0</head>
> =A0 =A0 =A0 =A0<body>
> =A0 =A0 =A0 =A0 =A0<ul>
> =A0 =A0 =A0 =A0 =A0 =A0<xsl:apply-templates select=3D"foo"/>
> =A0 =A0 =A0 =A0 =A0</ul>
> =A0 =A0 =A0 =A0</body>
> =A0 =A0 =A0</html>
> =A0 =A0</xsl:template>
>
> =A0 =A0<xsl:template match=3D"foo">
> =A0 =A0 =A0<li>
> =A0 =A0 =A0 =A0<xsl:value-of select=3D"@a1 * my:stringToDouble(string(@a2=
))"/>
> =A0 =A0 =A0</li>
> =A0 =A0</xsl:template>
>
> </xsl:stylesheet>
>
> where you would have data like
>
> <root>
> =A0 =A0<foo a1=3D"2" a2=3D"1.2E+2"/>
> </root>
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/
Thanks again!
We may have a possibility to run this part in .Net (using
XslCompiledTransform). What's the best way to use an extension
function there?
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
