Thread: Re: [Xsltforms-support] XSLTForms + eXist
Brought to you by:
alain-couthures
From: COUTHURES A. <ala...@ag...> - 2009-09-29 20:24:36
|
-------- Message original -------- Sujet : Getting XSLTForms to work with dynamic XForms Date : Tue, 29 Sep 2009 14:40:44 -0500 De : Dan McCreary <dan...@gm...> Répondre à : da...@da... Pour : exi...@li... Copie à : COUTHURES Alain <ala...@ag...> With very patient help from Alain Courthures I believe we have figured out a way to get XSLTForms to work when the forms are generated by an XQuery. The key is to add the following to any XQueries that dynamically generate XForms using the XSLTForms client-side libraries declare option exist:serialize "process-xsl-pi=no"; This prevents the XSL PI from executing on the server side and lets the browser do the right thing. xquery version "1.0"; declare option exist:serialize "method=xhtml media-type=application/xhtml process-xsl-pi=no"; ( <?xml-stylesheet href="http://support.syntactica.com:8080/exist/xsltforms/xsltforms.xsl" type="text/xsl"?>, <html> XForms code here... </html> ) Once again a hardy thanks to Alain! - Dan |
From: Wolfgang <wol...@ex...> - 2009-09-30 13:22:55
|
Hi Alain, I was looking into how to apply the xsltforms stylesheet on the server instead of the client. I needed to make 2 small fixes to the xsltforms.xsl stylesheet to get it to work properly: 1) two lines in the generated javascript assume that the xsltforms.js code has already been loaded: Core.fileName='xsltforms.js'; Dialog.show('statusPanel'); The assumption works sometimes, but mostly doesn't and causes the entire script to fail. Just moving the two statements *inside* the init() function fixes the issue for me. 2) location of xsltforms.js and xsltforms.css: the stylesheet determines the basedir for loading those resources by looking at the processing instruction. However, if the stylesheet is applied by a script on the server, there won't be processing instruction. I thus introduced a stylesheet parameter: <xsl:param name="baseuri"/> which is then checked to determine $resourcesdir: <xsl:variable name="resourcesdir"> <xsl:choose> <xsl:when test="$baseuri != ''"> <xsl:value-of select="$baseuri"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-before($href, 'xsltforms.xsl')"/> </xsl:otherwise> </xsl:choose> </xsl:variable> Wolfgang |
From: COUTHURES A. <ala...@ag...> - 2009-09-30 14:01:29
|
Hi Wolfgang, Thank you for looking at XSLTForms transformation on server side. I will have to test these two small fixes on my own configuration before committing them. By the way, testing with Dan McCreary, it appears that this option is also required for XSLTForms : declare option exist:serialize "indent=no"; to prevent the serializer to indent the result of the transformation. Thanks! -Alain Wolfgang a écrit : > Hi Alain, > > I was looking into how to apply the xsltforms stylesheet on the server > instead of the client. I needed to make 2 small fixes to the > xsltforms.xsl stylesheet to get it to work properly: > > 1) two lines in the generated javascript assume that the xsltforms.js > code has already been loaded: > > Core.fileName='xsltforms.js'; > > Dialog.show('statusPanel'); > > The assumption works sometimes, but mostly doesn't and causes the > entire script to fail. Just moving the two statements *inside* the > init() function fixes the issue for me. > > 2) location of xsltforms.js and xsltforms.css: the stylesheet > determines the basedir for loading those resources by looking at the > processing instruction. However, if the stylesheet is applied by a > script on the server, there won't be processing instruction. I thus > introduced a stylesheet parameter: > > <xsl:param name="baseuri"/> > > which is then checked to determine $resourcesdir: > > <xsl:variable name="resourcesdir"> > <xsl:choose> > <xsl:when test="$baseuri != ''"> > <xsl:value-of select="$baseuri"/> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select="substring-before($href, > 'xsltforms.xsl')"/> > </xsl:otherwise> > </xsl:choose> > </xsl:variable> > > Wolfgang > |
From: COUTHURES A. <ala...@ag...> - 2009-09-30 18:28:50
|
Hi Wolfgang, I have committed these two fixes. Don't hesitate to contact me again if there are still problems. Thanks again! -Alain Wolfgang a écrit : > Hi Alain, > > I was looking into how to apply the xsltforms stylesheet on the server > instead of the client. I needed to make 2 small fixes to the > xsltforms.xsl stylesheet to get it to work properly: > > 1) two lines in the generated javascript assume that the xsltforms.js > code has already been loaded: > > Core.fileName='xsltforms.js'; > > Dialog.show('statusPanel'); > > The assumption works sometimes, but mostly doesn't and causes the > entire script to fail. Just moving the two statements *inside* the > init() function fixes the issue for me. > > 2) location of xsltforms.js and xsltforms.css: the stylesheet > determines the basedir for loading those resources by looking at the > processing instruction. However, if the stylesheet is applied by a > script on the server, there won't be processing instruction. I thus > introduced a stylesheet parameter: > > <xsl:param name="baseuri"/> > > which is then checked to determine $resourcesdir: > > <xsl:variable name="resourcesdir"> > <xsl:choose> > <xsl:when test="$baseuri != ''"> > <xsl:value-of select="$baseuri"/> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select="substring-before($href, > 'xsltforms.xsl')"/> > </xsl:otherwise> > </xsl:choose> > </xsl:variable> > > Wolfgang > |
From: COUTHURES A. <ala...@ag...> - 2009-10-02 04:52:25
|
Claudius, Please send me the XForms page you're having problems with or put it on a Web site. As usual, it necessary to reproduce a problem to locate it ;-) Thanks! -Alain claud108 a écrit : > I forgot to mention that I've tested ith the latest versions of > xsltform.xsl/.js both from eXist and XSLTForms SVNs. > > Claudius > |
From: COUTHURES A. <ala...@ag...> - 2009-10-02 08:37:08
|
Claudius, Just to reassure you about XSLTForms, the acces.xml file is rendered by XSLTForms like this : -Alain |
From: COUTHURES A. <ala...@ag...> - 2009-10-02 19:11:50
|
Claudius, > Viva! > > Finally, no errors, only the "Loading" message do not disappear. > The "Loading" message (can you provide me with a Romanian version for messages.properties ;-) ) not disappearing happens when there is a Javascript error at initialization. > But it is not working with https :) > > It says > XSLTForms Exception > -------------------------- > > Error initializing : > > NS_ERROR_DOM_BAD_URI > > Access to restricted URI denied > > I would be nice to have also https. > You're now facing a cross-domain restriction : every pages have to be served by the same domain+port. URL rewriting is the solution if the pages cannot really be at the same location... Cheers, -Alain |
From: claudius t. <cla...@ya...> - 2009-10-02 20:21:28
|
Alain, Find attached the file messages_ro.properties (I don't know about calendar.initDay; should be 7 as we start week on Monday?). This cross-domain reference is due to the fact the xsltforms assumes that file messages.properties. Why this, if the page is found at https://localhost:8443. Could your script search for this file based upon host page's protocol (http or https) and ip:port? I think this could overcome cross-domain reference. If is something I don't understand, don't mind. Claudius |
From: COUTHURES A. <ala...@ag...> - 2009-10-02 20:13:08
|
Claudius, > Find attached the file messages_ro.properties (I don't know about calendar.initDay; should be 7 as we start week on Monday?). > Sorry there was no file attached with your latest message. Monday is also the first day of the week here in France so initDay = 0 > This cross-domain reference is due to the fact the xsltforms assumes that file messages.properties. > > Why this, if the page is found at https://localhost:8443. Could your script search for this file based upon host page's protocol (http or https) and ip:port? > > I think this could overcome cross-domain reference. > > If is something I don't understand, don't mind. > The messages.properties file has to be located in the same folder as xsltforms.js (the source file is scanned to find the script element with the corresponding src attribute). So, if xsltforms.js can be obtained, messages.properties should also too... Hope it helps, -Alain |
From: claudius t. <cla...@ya...> - 2009-10-02 20:59:17
Attachments:
messages_ro.properties
|
Sorry, find the file attached now. I will wait for Wolfgang to do more examples, as he said. Claudius |