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/15/2008 2:41:00 PM
barnum@b... wrote:
> MSXML unfortunately....
With MSXML you could use an extension function written in JavaScript e.g.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:my="http://example.com/2008/mf"
exclude-result-prefixes="my msxsl"
version="1.0">
<xsl:output method="html" indent="yes"/>
<msxsl:script language="JavaScript" implements-prefix="my">
function stringToDouble (s) {
return parseFloat(s);
}
</msxsl:script>
<xsl:template match="root">
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
<ul>
<xsl:apply-templates select="foo"/>
</ul>
</body>
</html>
</xsl:template>
<xsl:template match="foo">
<li>
<xsl:value-of select="@a1 * my:stringToDouble(string(@a2))"/>
</li>
</xsl:template>
</xsl:stylesheet>
where you would have data like
<root>
<foo a1="2" a2="1.2E+2"/>
</root>
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
