Re: [xsl] html code generation & parameter between xslt and jscript

Subject: Re: [xsl] html code generation & parameter between xslt and jscript
From: Johnnie Fox <johnniefox@xxxxxxx>
Date: Mon, 28 Feb 2005 18:09:29 +0000
Sorry again for my too long preceding message !
Could I have a response with this shorter one ?
I try for a long time to get this parameter in JScript, and I don't understand why the inserted code isn't interpreted as html


Johnnie Fox a icrit:

Hi,
I would like to generate cells in a table depending on a variable in a xml tree.
I get two troubles :
get the number into the jscript procedure (I get a error, probably due to a format error ? )
the html generated code isn't interpreted (not the right moment to include that kind of code ?)
I'm newbe in xml/xslt using (it's probably visible :-) , thanks for your help
JF


_____________________________________________________________
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:utils="http://mycompany.com/mynamespace";>

<msxsl:script language="javascript" implements-prefix="utils"><![CDATA[
function col(context, lg ){
var nb = lg;
var i;
var s="";
for (i=0; i<nb; i++){
s += '<td><input type="text" size="1"/></td>';
}
return s;
}
]]></msxsl:script>
<xsl:output method="html" indent="yes"/>
<xsl:template match="racine">
<html>
<head>
<title></title>
</head>
<body>
<p align="center">
<table border="1">
<xsl:apply-templates/>
</table>
</p>
</body>
</html>
</xsl:template>
<xsl:template match="Horizontalement">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="l">
<tr><xsl:apply-templates/></tr>
</xsl:template>
<xsl:template match="m" >
<td> <input type="text" size="1"/> </td>
<xsl:variable name="lg" select="@long"/>
<xsl:copy-of select="utils:col(., $lg)" />

</xsl:template>
<xsl:template match="n">
<td bgcolor="black"/>
</xsl:template>
</xsl:stylesheet>


______________________________________________________________
<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type="text/xsl" href="mcroisis.xsl"?>
<racine>
<Horizontalement>
<l name="1">
<m long="12">Cilhbre restaurateur de Saint-Germain-des-Prhs. </m>
<n/>
<m long="7">Croquait le marmot ` Montmartre.</m>
</l>
<l name="2">
<m long="11">Imposer ses convictions.</m>
<n/>
<m long="8">Alengon ou Orlians, Provence ou Artois.</m>
</l>
<l name="3">
<m long="4">Peut faire peur aux enfants. </m>
<n/>
<m long="11">Un sacri caracthre. </m>
<n/>
<m long="3">Un sacri raccourci. </m>
</l>
<l name="4">
<m long="6">Un endroit qui n'itait pas dans le vent.</m>
<n/>
<m long="2">Poitiquement vert et bleu.</m>
<n/>
<m long="5">Poitiquement tout blanc. </m>
<n/>
<m long="2">Possessif.</m>
<n/>
<m long="1"/>
</l>

</racine>

Current Thread