What XSLT Processor? I just use Mozilla Firefox to render the XML and
XSLT file into a webpage.
Anyway, I figured it all out before I got this e-mail. I'm using
xPath to do a bit of multiplying and such. Before, I only knew that
XPath could do addition and subtraction.
-Kenji
On Thu, 18 Nov 2004 10:44:12 +0200, jarno(_dot_)elovirta(_at_)nokia(_dot_)com
<jarno(_dot_)elovirta(_at_)nokia(_dot_)com> wrote:
Hi,
help with the % and weight, I'll need to calculate multiplication.
Javascript seemed the logical way, but I can't figure out how to send
Why?
=================================================================
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<script type="text/javascript">
<!--
function percent(pom) {
var max = 100;
return pom * max;
}
//-->
</script>
If you want to use extensions written in Javascript, you have to declare them
as such. Right now you're just generating a Javascript block into you result
tree. See your XSLT processors documentation on how to use extensions written
in Javascript.
<title>Weight Chart</title>
</head>
<body>
<xsl:for-each select="chart/chart-head">
<h1><xsl:value-of select="chart-title" /></h1>
</xsl:for-each>
<xsl:for-each select="chart/chart-data">
<table>
<tr>
<th>Exercise</th>
<th>Muscles</th>
<th>Max %</th>
<th>Weight</th>
<th>Reps</th>
</tr>
<xsl:for-each select="exercise">
<tr>
<td><xsl:value-of
select="@title" /></td>
<td><xsl:value-of
select="muscles" /></td>
<td><xsl:value-of
select="max-percent" /></td>
<td><span onload="percent(<xsl:value-of
select="max-percent">)" /> Lbs.</td>
This is ill-formed XML. Again, check the documentation how to call
extensions, I quess something in the lines of
<span onload="{percent(max-percent)}" />
or just use XPath
<span onload="{percent(max-percent * 100)}" />
Cheers,
Jarno
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--