E
Eric
I am trying to figure out a good way to implement a XSLT
transformation. Basically my goal is that I want to be able to ouput
the following XML in a document:
<chart type="pie" width="100" height="100">
<data label="Foo" value="12"/>
<data label="Bar" value="15"/>
.....
</chart>
This should transform into HTML which looks like:
<img width="100" height="100"
src="chart.rhtml?type=pie&width=100&height=100&data1=Foo&label1=12&data2=Bar&label2=15"/>
chart.rhtml is a server-side script that reads the URL parameters and
generates a graphical chart in PNG format. The goal is to be able to
easily slap charts in pages. To generate the URL string my first
thought was to use <xsl:for-each>. But when attempting to do that I ran
into the problem of not being able to store the string built so far
because xsl:variable cannot be modified.
So my next attempt was to create a named template that calls itself
recusively passing the string built thus far as one of the parameters.
When it is on the last "data" tag is simply outputs the string that was
built. This works fine when using the XSLT engine of my choice
because I can use xxx:node-set to convert the data nodes passed into
the named template to a node set so that I can use the variable in
XPath queries. But when I attempt this method on Mozilla's XSLT engine
it fails because it does not seem to support a xxx:node-set function.
So how do I implement this transformation using straight XSLT 1.0 code
and have it work in Mozilla's XSLT engine.
Any ideas? I appreciate any help that I can get.
Eric
transformation. Basically my goal is that I want to be able to ouput
the following XML in a document:
<chart type="pie" width="100" height="100">
<data label="Foo" value="12"/>
<data label="Bar" value="15"/>
.....
</chart>
This should transform into HTML which looks like:
<img width="100" height="100"
src="chart.rhtml?type=pie&width=100&height=100&data1=Foo&label1=12&data2=Bar&label2=15"/>
chart.rhtml is a server-side script that reads the URL parameters and
generates a graphical chart in PNG format. The goal is to be able to
easily slap charts in pages. To generate the URL string my first
thought was to use <xsl:for-each>. But when attempting to do that I ran
into the problem of not being able to store the string built so far
because xsl:variable cannot be modified.
So my next attempt was to create a named template that calls itself
recusively passing the string built thus far as one of the parameters.
When it is on the last "data" tag is simply outputs the string that was
built. This works fine when using the XSLT engine of my choice
because I can use xxx:node-set to convert the data nodes passed into
the named template to a node set so that I can use the variable in
XPath queries. But when I attempt this method on Mozilla's XSLT engine
it fails because it does not seem to support a xxx:node-set function.
So how do I implement this transformation using straight XSLT 1.0 code
and have it work in Mozilla's XSLT engine.
Any ideas? I appreciate any help that I can get.
Eric