I know this question will sound like a “from the past” thing but I need to do this for a homework and I can’t make it work.
The problem the following:
I have xml data, called from a database, I used xslt to render an xforms document on the browser, by the way its the old firefox 3.6 that was installed only to use the xforms extension.
It renders the xforms document correctly, but the controls doesnt work as expected, I cant submit a form and also the instance data is not filling in the inputs.
My xsl stylesheet is the following:
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xf="http://www.w3.org/2002/xforms">
<xsl:output method="xml"
indent="yes"
omit-xml-declaration="yes"
media-type="application/xhtml+xml"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" dir="ltr" lang="es">
<head>
<xf:model>
<xf:instance>
<data xmlns="">
<iCargo_Id>1</iCargo_Id>
<sCargo_Desc>lalala</sCargo_Desc>
<iConcurrencia_Id>1</iConcurrencia_Id>
</data>
</xf:instance>
<xf:submission id="prueba" action="EditarCargos.aspx" method="post"/>
</xf:model>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<title><![CDATA[Adicionar Cargos]]></title>
</head>
<body>
<div class="header"></div>
<div class="menu">
<a href="../empleados/editarempleados.aspx"><![CDATA[Empleados]]></a>
<a href="../horarios/editarhorarios.aspx"><![CDATA[Horarios]]></a>
<a href="../jornadas/editarjornadas.aspx"><![CDATA[Jornadas]]></a>
<a href="../cargos/editarcargos.aspx"><![CDATA[Cargos]]></a>
<a href="../usuarios/editarusuarios.aspx"><![CDATA[Usuarios]]></a>
<a href="../profesiones/editarprofesiones.aspx"><![CDATA[Profesiones]]></a>
<a href="../reportes/ReporteMarcaciones.aspx"><![CDATA[Rep. de Marcaciones]]></a>
<a href="../cerrarSesion.aspx"><![CDATA[Cerrar Sesión]]></a>
</div>
<div id="main">
<div class="mainTitle">
<![CDATA[Adicionar Cargos]]>
</div>
<div>
<xf:input ref="sCargo_Desc">
<xf:label><![CDATA[Cargo]]></xf:label>
</xf:input>
<div>
<xf:submit submission="prueba">
<xf:label><![CDATA[Guardar Cambios]]></xf:label>
</xf:submit>
</div>
</div>
<div>
<a class="cmdSecond" href="EditarCargos.aspx"><![CDATA[Volver]]></a>
</div>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="cargo[iCargo_Id]">
<iCargo_Id>
<xsl:value-of select="iCargo_Id"/>
</iCargo_Id>
<sCargo_Desc>
<xsl:value-of select="sCargo_Desc"/>
</sCargo_Desc>
<iConcurrencia_Id>
<xsl:value-of select="iConcurrencia_Id"/>
</iConcurrencia_Id>
</xsl:template>
<xsl:template match="cargo[not(iCargo_Id)]">
<iCargo_Id></iCargo_Id>
<sCargo_Desc></sCargo_Desc>
<iConcurrencia_Id></iConcurrencia_Id>
</xsl:template>
</xsl:stylesheet>
and my xml code look like this:
<cargo>
<iCargo_Id>1</iCargo_Id>
<sCargo_Desc>Jefe de Sistemas</sCargo_Desc>
<iConcurrencia_Id>1</iConcurrencia_Id>
</cargo>
I think the problem is the <xsl:output method="xml" attribute
, because xforms requires xhtml to render, but firefox throws an XSLT exception when I make it.
please Help! I have searched everywhere, and Ive found It has something to be with a bug in firefox but I expect there’s another way to make this work, your help will be very appreciated and sorry about my English, I’m currently learning 😀
ok, I didnt found a solution but used a workaround to make this work.
As the problem was with Firefox, I had to render the stylesheet in another way, so I used aspnet to pre-render the stylesheet on code behind (I forgot to mention that I was working with it), and then I wrote it to the Page using Response.Write and it worked like a charm using html as the xsl:output method