Hi,
you need XML output, so use the XHTML one:
<input type="radio" name="tiporetorno" checked="checked"/>
Marko
At 14:00 20.11.2002 +0000, you wrote:
Hi :)
I have the following XML that represent the fields of an form:
<?xml version="1.0" encoding="ISO-8859-1"?>
<form>
<action pagina="index" method="post" name="fconsultaCoReSeguro"/>
<field>
<field type="hidden" name="pagina"
value="consultaCoReSeguro"/>
<field type="hidden" name="passo" value="1"/>
<field type="text" name="sistema" caption="* Sistema"
value=""/>
<field type="text" name="ramo" caption="* Ramo"
tamanho="1" maxchar="2" value=""/>
<field type="text" name="numeroapolice" caption="* Número
da Apólice" tamanho="6" maxchar="8" value=""/>
<field type="text" name="datasinistro" caption="* Data
Sinistro" tamanho="6" maxchar="8" value="--data--"/>
<field type="radio" name="tiporetorno"
caption="Cosseguro" value="1" status=""/>
<field type="radio" name="tiporetorno"
caption="Resseguro" value="2" status=""/>
<field type="radio" name="tiporetorno" caption="Ambos"
value="3" status="checked"/>
<field type="button" name="consulta" value="Pesquisar"
funcaoSubmit="validaFormConsultasApolice();"/>
<field type="nota" value="Os campos com * são obrigatórios"/>
<field type="nota" value="A data deve ser inserida no
formato aaaammdd"/>
</fields>
</form>
Now, I produce the form using a next XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:template match="/">
<xsl:element name="form">
<xsl:attribute name="action">
<xsl:value-of select=".//action/@pagina"/>
</xsl:attribute>
<xsl:attribute name="method">
<xsl:value-of select=".//action/@method"/>
</xsl:attribute>
<xsl:attribute name="ID">
<xsl:value-of select=".//action/@name"/>
</xsl:attribute>
<table cellspacing="0" cellpadding="0" border="0">
<xsl:for-each select=".//fields/field">
<xsl:choose>
<xsl:when test="@type='submit'">
<tr height="70px">
<td colspan="3"
align="center">
<xsl:element
name="input">
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@value"/>
</xsl:attribute>
<xsl:attribute name="class">inputButton</xsl:attribute>
</xsl:element>
</td>
</tr>
</xsl:when>
<xsl:when test="@type='button'">
<tr height="70px">
<td colspan="3"
align="center">
<xsl:element
name="input">
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@value"/>
</xsl:attribute>
<xsl:attribute name="onClick">
<xsl:value-of select="@funcaoSubmit"/>
</xsl:attribute>
<xsl:attribute
name="class">inputButton</xsl:attribute>
</xsl:element>
</td>
</tr>
</xsl:when>
<xsl:when test="@type='text'">
<tr height="30px">
<td align="right"
width="150px">
<a
class="caption"><xsl:value-of select="@caption"/></a>
</td>
<td width="20px">
</td>
<td width="150px">
<xsl:element
name="input">
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@value"/>
</xsl:attribute>
<xsl:if
test="@tamanho">
<xsl:attribute name="size">
<xsl:value-of select="@tamanho"/>
</xsl:attribute>
</xsl:if>
<xsl:if
test="@maxchar">
<xsl:attribute name="maxlength">
<xsl:value-of select="@maxchar"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">inputText</xsl:attribute>
</xsl:element>
<xsl:if
test="@value='--data--'">
<script>
getDataField(document.all.item('<xsl:value-of select="@name"/>'));
</script>
</xsl:if>
</td>
</tr>
</xsl:when>
<xsl:when test="@type='radio'">
<tr height="30px">
<td align="right"
width="150px">
<a
class="caption"><xsl:value-of select="@caption"/></a>
</td>
<td width="20px">
</td>
<td width="150px">
<xsl:element
name="input">
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:if
test="status='checked'">
<!-- WHAT I HAVE TO PUT
HERE?!?!?!-->
</xsl:if>
</xsl:element>
</td>
</tr>
</xsl:when>
<xsl:when test="@type='hidden'">
<xsl:element name="input">
<xsl:attribute
name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute
name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:attribute
name="value">
<xsl:value-of select="@value"/>
</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="@type='nota'">
<tr>
<td colspan="3" class="nota">
<xsl:value-of
select="@value"/>
</td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:element>
</xsl:template>
</xsl:transform>
When I have a radio's input type is the value of attribute "estado" in XML
is "checked" I want that radio checked. The HTML produced must be like this:
<input type="radio" name="tiporetorno" checked/>
The problem is: How I create that?! It can't be an attribute! It's only a
property. Can you help me?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list