Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2003, 03:59 PM
Registered User
 
Join Date: Nov 2003
Location: Brasília, DF, Brazil.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to elysio Send a message via MSN to elysio Send a message via Yahoo to elysio
Default HELP ME PLEASE!!! XML to XSLT FORM GEN

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...




 
Old November 15th, 2003, 05:37 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Expanding on chapter 6 and the movie site in gen newbreed65 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 September 27th, 2008 11:56 AM
How to Query XML Data from XSLT Form kwilliams XSLT 1 December 3rd, 2005 06:14 AM
xml and xsl templates as input to xslt gives xml rameshnarayan XSLT 5 August 3rd, 2005 01:58 AM
XSLT for complicated xml to xml transf. required doug@sirvisetti XSLT 3 June 17th, 2005 04:26 PM
dynamic rs gen image with javascript binuacs Classic ASP Basics 1 June 5th, 2003 03:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.