From: Gaetan WURTZ (gaetan7@ifrance.com)
Date: 30/05/2002 - 13:06
bonjour,
excusez moi encore de vous importuner, mais j'ai décidement besion d'une
solution pour mon formulaire, voici le xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<!-- Sauvegarde en javascript-->
<!-- Utilisation de javascript -->
<script language="javascript">
var nb=0; //va contenir le nombre d'input
function record(nb)
{
var fso;
var fichier = "";
var caracteristique = "";
fso = new ActiveXObject('Scripting.FileSystemObject');
fichier = fso.CreateTextFile("c:/texte.txt", true);
var i;
for (i=0;i!=nb;i++)
{
fichier.writeline(document.form1.elements[i].value);
} // end loop
//fin with
fichier.close();
}
</script>
<XML ID="header" SRC="digital_header.xml"/>
<BODY>
<FORM name="form1">
<H1>Analog input</H1>
<H2>CJC Header</H2>
<TABLE BORDER="3" CELLSPACING="2" CELLPADDING="6">
<col border="1" bgcolor="#C4E1FF" bordercolor="#000000"/>
<!--Head of the Table -->
<!--Definition of the Table coluns width -->
<colgroup>
<col width="100"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
<col width="50"/>
</colgroup>
<!-- first line of the head -->
<THEAD align="left" bgcolor="#3399FF">
<!-- first line of the head -->
<tr>
<td/>
<th colspan="8">D15-D8</th>
<th colspan="8">D7-D0</th>
</tr>
<!-- second line of the head -->
<tr>
<td>
<b>CJC header address</b>
</td>
<td>D15</td>
<td>D14</td>
<td>D13</td>
<td>D12</td>
<td>D11</td>
<td>D10</td>
<td>D9</td>
<td>D8</td>
<td>D7</td>
<td>D6</td>
<td>D5</td>
<td>D4</td>
<td>D3</td>
<td>D2</td>
<td>D1</td>
<td>D0</td>
</tr>
</THEAD>
<!-- The Body of the table -->
<TBODY>
<xsl:for-each
select="digital_header/Functions/Analog_input/CJC_header/Address_16Bit">
<tr>
<td>
<font color="black" size="5">
<B>
<xsl:value-of select="Address_16Bit_Offset"/>
</B>
</font>
</td>
<xsl:for-each select="Header_Element">
<th>
<xsl:attribute name="colspan"><xsl:value-of
select="HElement_Bit_Length"/></xsl:attribute>
<xsl:value-of select="HElement_Name"/>
<xsl:if match=".[HElement_Type='textbox']">
<INPUT ID="Code" TYPE="text" SIZE="20" DATASRC="#header"
DATAFLD="digital_header/Functions/Analog_input/CJC_header/Address_16Bit/
HElement_Value"/>
</xsl:if>
<xsl:if match=".[HElement_Type='listbox']">
<SELECT>
<OPTION>
<xsl:value-of select="HElement_ValuesChoice1"/>
</OPTION>
<OPTION>
<xsl:value-of select="HElement_ValuesChoice2"/>
</OPTION>
<OPTION>
<xsl:value-of select="HElement_ValuesChoice3"/>
</OPTION>
<OPTION>
<xsl:value-of select="HElement_ValuesChoice4"/>
</OPTION>
</SELECT>
</xsl:if>
<script>
nb++; //va contenir le nombre d'input
</script>
</th>
</xsl:for-each>
</tr>
</xsl:for-each>
</TBODY>
</TABLE>
<center>
<input type="button" name="Valide" value="Envoyer"
onclick="record(nb)"/>
</center>
</FORM>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
j'aimerai faire une sauvegarde de tous les éléments de type textbox et
listbox de mon xml dans un fichier xml, en local.
exemple de mon xml:
<Header_Element>
<HElement_ID>0</HElement_ID>
<HElement_Name>Board revision</HElement_Name>
<HElement_Value>4</HElement_Value>
<HElement_Type>listbox</HElement_Type>
<HElement_Convert/>
<HElement_ValuesChoice1>1</HElement_ValuesChoice1>
<HElement_ValuesChoice2>2</HElement_ValuesChoice2>
<HElement_ValuesChoice3>3</HElement_ValuesChoice3>
<HElement_ValuesChoice4>4</HElement_ValuesChoice4>
<HElement_Address_Offset>0</HElement_Address_Offset>
<HElement_Start_Bit>12</HElement_Start_Bit>
<HElement_Stop_Bit>15</HElement_Stop_Bit>
<HElement_Bit_Length>4</HElement_Bit_Length>
<HElement_Write_Flag>1</HElement_Write_Flag>
<HElement_PossibleValues_Flag>1</HElement_PossibleValues_Flag>
</Header_Element>
merci pout tou
Gaetan WURTZ
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:06 UTC
webmaster@xmlfr.org
|