xml javascript lunghezza campo tabella

M

melogranina

Salve!
Ho la necessità di creare un documento xsl con una tabella che deve
avere i campi della stessa lunghezza del valore ottenuto da una
funzione javascript:


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<style>.fr {background-color:eek:range;}</style>
<style>.cella {font-family:Arial,sans-serif;
font-size:10pt;font-weight:100;text-align:left;text-transform:capitalize;color:white;}</style>
<style>.xy {background-color:#99FF66;}</style>
<style>.pr {background-color:yellow;}</style>
<style>.m {background-color:red;}</style>
<style>.mr {background-color:#FFFFCC;}</style>
<xsl:for-each select="rows/row">
<table border="0">
<TR>
<TD class="fr">
<xsl:attribute name="width">
<xsl:value-of select="gradi"/>
</xsl:attribute>
</TD>

Come faccio ad inserire la funzione JS per impostare il width del td??
Grazie
 
J

Joris Gillis

Salve!
Ho la necessità di creare un documento xsl con una tabella che deve
avere i campi della stessa lunghezza del valore ottenuto da una
funzione javascript:


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<style>.fr {background-color:eek:range;}</style>
<style>.cella {font-family:Arial,sans-serif;
font-size:10pt;font-weight:100;text-align:left;text-transform:capitalize;color:white;}</style>
<style>.xy {background-color:#99FF66;}</style>
<style>.pr {background-color:yellow;}</style>
<style>.m {background-color:red;}</style>
<style>.mr {background-color:#FFFFCC;}</style>
<xsl:for-each select="rows/row">
<table border="0">
<TR>
<TD class="fr">
<xsl:attribute name="width">
<xsl:value-of select="gradi"/>
</xsl:attribute>
</TD>

Come faccio ad inserire la funzione JS per impostare il width del td??
Grazie
Hi,

Not that I know any Italian, but I think I understood your question.

I could be totally wrong, but here I go:
In the deprecated XSLT 1.1 working draft, there were plans to implement an element 'script' to allow extension function via scripts. It would look like this:

<xsl:script implements-prefix="my-exstensions" language="javascript">
function calcWidth() {

}
</xsl:script>

That script would then be called with this:
<xsl:value-of select="my-exstensions:calcWidth()"/>

You might be using a transformation engine like Xalan that supports this non-existing XSLT 1.1
But I think XSLT 2.0 will allow it somehow eventually.


But as a general remark, I don't see why you should manually calculate the width of any table, as browsers can do that themselves.

regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top