Subject: HELP ME PLEASE!!! XML to XSLT FORM GEN
Posted By: elysio Post Date: 11/15/2003 2:59:29 PM
Hello every body!

I having a problem with catch information from my XML File...
My XML file structure is:
<?xml version="1.0" encoding="iso-8859-1" ?>
<resultadoConsultaForm>
 <formulario nome="form">
  <parametro nome="xsl_file" valor="rel_objeto_juridico.xsl" />
  <parametro nome="proc_name" valor="pkg_relatorio.ExecutaRelFormulario" />
  <parametro nome="ora_piID" valor="" />
  <parametro nome="ora_piItem" valor="" />
  <parametro nome="ora_piTotalItem" valor="170" />
  <parametro nome="ora_psQueryID" valor="AAAZcxAAVAAAEHqAAA" />
  <parametro nome="ora_psRelatorio" valor="OBJETO_JURIDICO" />
  <parametro nome="ora_psValClob" valor="" />
  <parametro nome="ora_psProxRelatorio" valor="OBJETO_JURIDICO" />
 </formulario>
 <formulario nome="pagina">
  <parametro nome="xsl_file" valor="rel_objeto_juridico.xsl" />
  <parametro nome="proc_name" "pkg_relatorio.ExecutaRelFormulario" />
  <parametro nome="ora_psQueryID" valor="AAAZcxAAVAAAEHqAAA" />
  <parametro nome="ora_piPagina" valor="" />
  <parametro nome="ora_piRegistrosPagina" valor="40" />
  <parametro nome="ora_psRelatorio" valor="OBJETO_JURIDICO" />
  <parametro nome="ora_psProxRelatorio" valor="OBJETO_JURIDICO" />
  <parametro nome="ora_psValClob" valor="" />
 </formulario>
 <formulario nome="doc">
  <parametro nome="xsl_file" valor="exibe_ato.xsl" />
  <parametro nome="xsl_nota" valor="2" />
  <parametro nome="proc_name" valor="pkg_textual.ExibeDocumento" />
  <parametro nome="ora_piID" valor="" />
 </formulario>
<resultadoConsultaForm>
Translating to english the name of parameters:
Formulário = form
nome = name
parametro = parameter
valor = value

So with this information I would like do transform this XML in a HTML FORM.
My doubts are how to get the values of /formulario/@nome/
I´m trying to solve my problem with:
<xsl:for-each select="/resultadoConsultaForm/formulario/">
   <form action="get_xslt.php" method="post" name="{@nome}">
   <xsl:for-each select="/resultadoConsultaForm/formulario/parametro/">
    <input type="hidden" name="{@nome}" value="{@valor}" />
   </xsl:for-each>
   </form>
</xsl:for-each>

but the Sablotron Returns to me that the parent is null.

How can I solve this?!

Thank´s for Helping...




Reply By: planoie Reply Date: 11/15/2003 4:37:47 PM
I think the problem you are having has to do with the context of the second XPath query.

The first for-each gets you to "/resultadoConsultaForm/formulario/" so the next for-each should only need to query "parametro/" because it will query it based on the context of the formulario node that it's current in (in the outter loop).

<xsl:for-each select="/resultadoConsultaForm/formulario/">
    <form action="get_xslt.php" method="post" name="{@nome}">
        <xsl:for-each select="parametro/">
            <input type="hidden" name="{@nome}" value="{@valor}" />
        </xsl:for-each>
    </form>
</xsl:for-each>

Peter
------------------------------------------------------
Work smarter, not harder.

Go to topic 6532

Return to index page 1004
Return to index page 1003
Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997
Return to index page 996
Return to index page 995