[Gambas-devel] xslt

Daniel Campos daniel.campos at ...103...
Sat Mar 12 12:18:26 CET 2005


Charlie Reinl escribió:

>Salut,
>
>send this mail, even if it is prematurity for my actual knowledge .
>Listening the started discussion about xforms etc. on the list.
>
>To know I like to work with the XML-structure, I use it to save my data, but I 
>will also use it to descript my gambas-forms.
>
>I made a project to read in gambas forms and saved it to an XML structure.
>see attached MySQLLogin-0.0.6.tar.gz and set the startup to CReadForm if not.
>
>But I'm lazy, too lazy to write a code to transform that Form.xml to a gambas 
>form.
>
>Why am I to lazy to do that? I hope to find the day where I need it, I can do 
>it with a style sheet who calls Gambia's Subs or Functions, which will do the 
>job for me, and for all Form.XML I need.
>
>I did that in VB6 with msxml 3.x  like 
>        <xsl:for-each select="BUTTONS">
>            <xsl:for-each select="./BUTTON" >
>                <xsl:value-of select="processor:SETBUTTON(.)" >
>                </xsl:value-of> 
>            </xsl:for-each>
>        </xsl:for-each>
>
>processor:SETBUTTON(.) called in an class 'preprocessor' the function/sub 
>SETBUTTON with the node (.), where all rules for Buttons, and set this on the 
>form .
>
>With am XML/XLS like that, you can design your project on an browser or in an 
>VB-project.
> 
>Actually I know the xlst from gambas can't do that.
>
>So I need from Daniel Campos informations about the lib/libs used by the 
>xlst-component , to know if that what I want is possible with th lib used.
>
>Amicalment
>Charlie
>  
>
Well, If I understood your message, you want to read a XML file and create
forms, buttons, etc with that information. This is not what XSLT does, 
it just
transform between markup file formats. I think you should wait until Benoît
releases the new Gambas developement version in which you'll be able
to create components with Gambas, and then, from your component, read
XML files and create forms, and other widgets based on the XML file
information at runtime. This will be easy than adding it to the C XSTL 
code (which
uses libxml ( http://www.xmlsoft.org ). This would be the way:

You can XmlReader (or may be XmlDocument when I finish it) to read the
XML file, and modify that XSLT file:

<xsl:for-each select="BUTTONS">
   <xsl:for-each select="./BUTTON" >
       <xsl:value-of select="processor:SETBUTTON(.)" >
           </xsl:value-of> 
       </xsl:for-each>
   </xsl:for-each>


Read and parsed by your component which receives the information from both the XSLT file and
a Form that you pass as parameter, for example:

MyClass. Parse("XslFile.xsl",MyForm)


Regards,

D. Campos 








More information about the Devel mailing list