Thread: [Xsltforms-support] Is it possible to generate an xhtml with php, based on xsltforms?
Brought to you by:
alain-couthures
From: Lorenzo De T. <lor...@gm...> - 2009-09-10 14:09:45
|
Is it possible to generate an xhtml document with an xform with php, based on xsltforms? $xsl->importStyleSheet($doc); $doc->load($xml_filename); echo $xsl->transformToXML($doc); I have tried, but it seems it needs the <?xml-stylesheet href="../xforms/xsltforms/xsltforms.xsl" type="text/xsl"?> line to understand where are the xsltforms subfolders. Thank you for your help. -- Salta la crisi! Investi in comunicazione <http://isotype.org/?lang=it> -- Lorenzo De Tomasi ISOTYPE.org | comunica la qualità ["Multimodale" rispetto a "multimediale" vuole affermare la necessità di indagare non più sul veicolo o la tecnologia di trasmissione della comunicazione, ma sul modo in cui si veicola la comunicazione, il modo in cui la si struttura rispetto all'utente e, cioè, sul progetto.] Il portfolio illustrato dei miei lavori: http://tinyurl.com/2fgl63 Il mio curriculum vitae: http://tinyurl.com/4l2u8v Il mio blog (in costruzione): http://www.isotype.org/?lang=it ^^^^^^^^^^ Rispetta il tuo ambiente, pensa prima di stampare questa e-mail. Grazie. Please consider the environment before printing this email. Thank you. |
From: COUTHURES A. <ala...@ag...> - 2009-09-10 20:19:23
|
Hello Lorenzo, > Is it possible to generate an xhtml document with an xform with php, > based on xsltforms? > $xsl->importStyleSheet($doc); > $doc->load($xml_filename); > echo $xsl->transformToXML($doc); Yes, php might be used at server-side to perform an xslt transformation, with instructions such as : |$xsl = new XSLTProcessor(); $xsl->importStyleSheet(DOMDocument::load($xsl_filename)); echo $xsl->transformToXML(DOMDocument::load($xml_filename)); | Unfortunately, php xslt engine doesn't support namespaces very well and workarounds have to be found (add dummy attributes such as xsd:dummy="dummy" so the XSLTForms stylesheet can find the corresponding URI,...). > > I have tried, but it seems it needs the <?xml-stylesheet > href="../xforms/xsltforms/xsltforms.xsl" type="text/xsl"?> line to > understand where are the xsltforms subfolders. Usually, a processing-instruction is used only for client-side transformation but at server-side, the source document beeing loaded with the DOM API, it's also possible to have php instructions to manually read this processing-instruction to, first, locate the stylesheet. Best regards, -Alain |
From: Lorenzo De T. <lor...@gm...> - 2009-09-11 06:31:13
|
Thank you for the tips :-) I'll try! > Usually, a processing-instruction is used only for client-side transformation but at > server-side, the source document beeing loaded with the DOM API, it's also possible to have > php instructions to manually read this processing-instruction to, first, locate the stylesheet. And is it possible, with php dom, to load the xform file and re-save it with the <?xml-stylesheet href="../xforms/xsltforms/xsltforms.xsl" type="text/xsl"?> line added? How? Thank you very much. -- Salta la crisi! Investi in comunicazione <http://isotype.org/?lang=it> -- Lorenzo De Tomasi ISOTYPE.org | comunica la qualità ["Multimodale" rispetto a "multimediale" vuole affermare la necessità di indagare non più sul veicolo o la tecnologia di trasmissione della comunicazione, ma sul modo in cui si veicola la comunicazione, il modo in cui la si struttura rispetto all'utente e, cioè, sul progetto.] Il portfolio illustrato dei miei lavori: http://tinyurl.com/2fgl63 Il mio curriculum vitae: http://tinyurl.com/4l2u8v Il mio blog (in costruzione): http://www.isotype.org/?lang=it ^^^^^^^^^^ Rispetta il tuo ambiente, pensa prima di stampare questa e-mail. Grazie. Please consider the environment before printing this email. Thank you. |
From: COUTHURES A. <ala...@ag...> - 2009-09-11 08:07:55
|
Hello Lorenzo, > And is it possible, with php dom, to load the xform file and re-save > it with the <?xml-stylesheet href="../xforms/xsltforms/xsltforms.xsl" > type="text/xsl"?> line added? How? > Yes, of course. Have a look at http://www.php.net/manual/en/domdocument.createprocessinginstruction.php Best regards, -Alain |
From: Lorenzo De T. <lor...@gm...> - 2009-09-11 09:20:47
|
Ok, now it loads the xslt. In xsltforms.xsl I have changed <xsl:variable name="resourcesdir"><xsl:value-of select="substring-before($href, 'xsltforms.xsl')"/>includes/xsltforms/</xsl:variable> to <xsl:variable name="resourcesdir">includes/xsltforms/</xsl:variable> and now also the files xsltforms.css and xsltforms.js are loaded but it still shows the "Loading" box, and the form doesn't work. What can be the problem? Thank you very much. On Thu, Sep 10, 2009 at 10:06 PM, COUTHURES Alain <ala...@ag...> wrote: > Usually, a processing-instruction is used only for client-side > transformation but at server-side, the source document beeing loaded with > the DOM API, it's also possible to have php instructions to manually read > this processing-instruction to, first, locate the stylesheet. -- Salta la crisi! Investi in comunicazione <http://isotype.org/?lang=it> -- Lorenzo De Tomasi ISOTYPE.org | comunica la qualità ["Multimodale" rispetto a "multimediale" vuole affermare la necessità di indagare non più sul veicolo o la tecnologia di trasmissione della comunicazione, ma sul modo in cui si veicola la comunicazione, il modo in cui la si struttura rispetto all'utente e, cioè, sul progetto.] Il portfolio illustrato dei miei lavori: http://tinyurl.com/2fgl63 Il mio curriculum vitae: http://tinyurl.com/4l2u8v Il mio blog (in costruzione): http://www.isotype.org/?lang=it ^^^^^^^^^^ Rispetta il tuo ambiente, pensa prima di stampare questa e-mail. Grazie. Please consider the environment before printing this email. Thank you. |
From: COUTHURES A. <ala...@ag...> - 2009-09-11 09:27:43
|
> Ok, now it loads the xslt. > In xsltforms.xsl I have changed > <xsl:variable name="resourcesdir"><xsl:value-of > select="substring-before($href, > 'xsltforms.xsl')"/>includes/xsltforms/</xsl:variable> > to > <xsl:variable name="resourcesdir">includes/xsltforms/</xsl:variable> > and now also the files xsltforms.css and xsltforms.js are loaded > but it still shows the "Loading" box, and the form doesn't work. > What can be the problem? > When the "Loading" (don't hesitate to translate XSLTForms messages to Italian in a messages_it.properties file so I can add it ;-) ) box is remaining, it is usually because of a javascript error. Look at the error console of your browser and don't hesitate to use another one (Opera, Safari,...) to have more explicit error messages. -Alain |
From: Lorenzo De T. <lor...@gm...> - 2009-09-11 16:43:29
Attachments:
messages_it.properties
|
> When the "Loading" (don't hesitate to translate XSLTForms messages to > Italian in a messages_it.properties file so I can add it ;-) ) Attached :-) > box is > remaining, it is usually because of a javascript error. Look at the error > console of your browser and don't hesitate to use another one (Opera, > Safari,...) to have more explicit error messages. The errors are: - - - - - Errore: syntax error File sorgente: http://192.168.1.100/~lorenzodetomasi/sinapsi_base/?resource=contabilita/netto_da_lordo Riga: 3 Codice sorgente: <![CDATA[Core.fileName='xsltforms.js'; - - - - - Errore: init is not defined File sorgente: http://192.168.1.100/~lorenzodetomasi/sinapsi_base/?resource=contabilita/netto_da_lordo Riga: 1 - - - - - (more than one) Avviso: Proprietà sconosciuta 'box-sizing'. Dichiarazione tralasciata. File sorgente: http://192.168.1.100/~lorenzodetomasi/sinapsi_base/includes/xsltforms/xsltforms.css Riga: 513 - - - - - (more than one) Avviso: Errore durante l'interpretazione di 'filter'. Dichiarazione tralasciata. File sorgente: http://192.168.1.100/~lorenzodetomasi/sinapsi_base/includes/xsltforms/xsltforms.css Riga: 508 Thanks -- Salta la crisi! Investi in comunicazione <http://isotype.org/?lang=it> -- Lorenzo De Tomasi ISOTYPE.org | comunica la qualità ["Multimodale" rispetto a "multimediale" vuole affermare la necessità di indagare non più sul veicolo o la tecnologia di trasmissione della comunicazione, ma sul modo in cui si veicola la comunicazione, il modo in cui la si struttura rispetto all'utente e, cioè, sul progetto.] Il portfolio illustrato dei miei lavori: http://tinyurl.com/2fgl63 Il mio curriculum vitae: http://tinyurl.com/4l2u8v Il mio blog (in costruzione): http://www.isotype.org/?lang=it ^^^^^^^^^^ Rispetta il tuo ambiente, pensa prima di stampare questa e-mail. Grazie. Please consider the environment before printing this email. Thank you. |