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