W3C home > Mailing lists > Public > www-forms@w3.org > February 2006

AW: Stylesheet for Transforming HTML forms to XForms

From: Huditsch, Roman \(LNG-VIE\) <Roman.Huditsch@lexisnexis.at>
Date: Mon, 27 Feb 2006 10:35:51 +0100
Message-ID: <AB4D914EE3A3254CA8F439925297E4C65E6524@LNGVIEEXCP01VB.legal.regn.net>
To: "David Landwehr" <david.landwehr@solidapp.com>
Cc: <www-forms@w3.org>, "Sebastian Schnitzenbaumer" <schnitz@demaledetti.net>

Hi David,

Thanks for the very helpful input. 
I added the missing two elements for the upload control.
Maybe it would be a good idea to change the "upload" section at
"XForms for HTML Authors"[1], too.

Thanks for the hint about the javascript part. I didn't know that the action 
gets triggered when the document is parsed. 
I just decided to transform it that way, because it was the first mentioned
alternative at [2]. 
Is there an other way to transform this javascript part so that every implementation can work with it
(except leaving such javascript buttons as they are)?
If not, I will have to do it with the event listener ;)
Thanks a lot!

best regards,
Roman

[1] http://www.w3.org/MarkUp/Forms/2003/xforms-for-html-authors.html
[2] http://www.w3.org/MarkUp/Forms/2003/xforms-for-html-authors.html#Buttons 

> -----Ursprüngliche Nachricht-----
> Von: David Landwehr [mailto:david.landwehr@solidapp.com] 
> Gesendet: Montag, 27. Februar 2006 09:52
> An: Huditsch, Roman (LNG-VIE)
> Cc: www-forms@w3.org; Sebastian Schnitzenbaumer
> Betreff: Re: AW: AW: AW: Stylesheet for Transforming HTML 
> forms to XForms
> 
> Hi Roman,
> 
> The file_input.xhtml do not generate exactly what it should. 
> The upload should look like:
> <xforms:upload mediatype="text/*" style="width: 240px" ref="file">
>   <xforms:label></xforms:label>
>   <xforms:filename ref="@filename"/>
>   <xforms:mediatype ref="@mediatype"/>
> </xforms:upload>
> 
> You have to bind the filename and mediatype. I apologize that 
> I didn't answer your question about this clearly in the first place.
> 
> For button.xhtml the xhtml:script tag does not work as you 
> expect. The construction you have will execute the script 
> when the document is parsed for xhtml 1.0 (not sure what 
> happens in xhtml 2.0). Another way of specifying the 
> functionality would be to use the event listener element:
> <ev:listener event="DOMActivate" 
> handler="javascript:self.location.href='http://www.w3.org'"/>, however
> javascript: might not work in all implementations :(
> 
> Best regards,
> David
> 
> Huditsch, Roman (LNG-VIE) wrote:
> > Hi David,
> >
> > *arg* you're right. I just copied the email datatype 
> definition from 
> > the Xforms 1.1 WD and forgot to change the Schema prefexi. 
> Should do such things so early in the morning...
> > Attached is the corrected version.
> > Thanks!
> >
> > wbr,
> > Roman
> >
> >   
> >> -----Ursprüngliche Nachricht-----
> >> Von: David Landwehr [mailto:david.landwehr@solidapp.com]
> >> Gesendet: Montag, 27. Februar 2006 09:26
> >> An: Huditsch, Roman (LNG-VIE)
> >> Cc: www-forms@w3.org; Sebastian Schnitzenbaumer
> >> Betreff: Re: AW: AW: Stylesheet for Transforming HTML 
> forms to XForms
> >>
> >> And good morning to you :)
> >>
> >> It seems that the prefix xsd: is not bound for:
> >> <xs:simpleType name="email">
> >>   <xs:restriction base="xs:string">
> >>     <xsd:pattern
> >> value="[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-'\*\+
> >> \-/=\?\^_`\{-~]+)*@[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+(\.[A-Za-
> >> z0-9!#-'\*\+\-/=\?\^_`\{-~]+)*"/>
> >>
> >>   </xs:restriction>
> >> </xs:simpleType>
> >>
> >> I think you just need to rename the pattern xsd: to xs:
> >>
> >> When that is done I get an error which says that ~ is not a valid 
> >> character. That is caused by ATV, e.g. the { in the 
> datatype has to 
> >> be escaped with {{ like:
> >> <xs:pattern
> >> value="[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{{-~]+(\.[A-Za-z0-9!#-'\*\
> >> +\-/=\?\^_`\{{-~]+)*@[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{{-~]+(\.[A-
> >> Za-z0-9!#-'\*\+\-/=\?\^_`\{{-~]+)*"/>
> >>
> >>
> >> So that email type should look like:
> >> <xs:simpleType name="email">
> >>   <xs:restriction base="xs:string">
> >>     <xs:pattern
> >> value="[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{{-~]+(\.[A-Za-z0-9!#-'\*\
> >> +\-/=\?\^_`\{{-~]+)*@[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{{-~]+(\.[A-
> >> Za-z0-9!#-'\*\+\-/=\?\^_`\{{-~]+)*"/>
> >>
> >>
> >>   </xs:restriction>
> >> </xs:simpleType>
> >>
> >>
> >> I haven't look at the output yet.
> >>
> >> Best regards,
> >> David
> >>
> >> Huditsch, Roman (LNG-VIE) wrote:
> >>     
> >>> Good morning everybody,
> >>>
> >>> Thanks to Davids feedback I was able to fix some bugs in my
> >>>       
> >> stylesheet and improve my test cases a bit, too.
> >>     
> >>> Attached is a newer, stable version of my stylesheet.
> >>> Any feeback is heartily welcome.
> >>>
> >>> wbr,
> >>> Roman
> >>>
> >>>   
> >>>       
> >>>> -----Ursprüngliche Nachricht-----
> >>>> Von: David Landwehr [mailto:david.landwehr@solidapp.com]
> >>>> Gesendet: Freitag, 24. Februar 2006 07:28
> >>>> An: Huditsch, Roman (LNG-VIE)
> >>>> Cc: www-forms@w3.org
> >>>> Betreff: Re: AW: Stylesheet for Transforming HTML forms to XForms
> >>>>
> >>>> Hi Roman,
> >>>>
> >>>> Again really good work, this is fun :)
> >>>>
> >>>> I have some comments about the transformations:
> >>>>
> >>>> 1) in application_from.xhtml you make a xsi:type="xs:email". Two
> >>>> problems: xs is not a defined prefix so I cannot see 
> what the type 
> >>>> it is intended to be (a schema datatype or a xforms 
> datatype). The 
> >>>> other problem is that there is no xs:email datatype 
> define in XML 
> >>>> Schema 1.0 or in XForms 1.0. However I like the idea of 
> assign such 
> >>>> a datatype (and indeed there is one in XForms 1.1) so 
> maybe you can 
> >>>> link you own schema and assign the datatype from that 
> (you can just 
> >>>> copy the definition from XForms 1.1).
> >>>>
> >>>> 2) It may be my mistake but instance('formData1')/ should be 
> >>>> without the trailing / e.g. just instance('formData1')
> >>>>
> >>>> 3) You might know it since checkbox.xhtml does not transform 
> >>>> probably but the transformation of a checkbox should be:
> >>>> <xforms:select1 ref="zutat" appearance="full">
> >>>>   <xforms:label></xforms:label>
> >>>>   <xforms:item>
> >>>>     <xforms:label>Salami</xforms:label>
> >>>>     <xforms:value>salami</xforms:value>
> >>>>   </xforms:item>
> >>>>   ....
> >>>> </xforms:select1>
> >>>>
> >>>> 4) in file_input.xml. This is the same as for 1) the xs 
> prefix has 
> >>>> to be declared. Another thing you could do was to include a 
> >>>> mediatype and a filename element under the upload 
> element and bind 
> >>>> they values to attributes on the upload instance node. 
> E.g. making 
> >>>> the upload look like:
> >>>> <xforms:upload mediatype="text/*" style="width: 240px" 
> ref="file">
> >>>>   <xforms:label></xforms:label>
> >>>>   <xforms:mediatype ref="@mediatpype"/>
> >>>>   <xforms:filename ref="@filename"/> </xforms:upload>
> >>>>
> >>>> and in the instance
> >>>> <file mediatype="" filename="" xsi:type="xs:base64Binary"/>
> >>>>
> >>>> 5) In multiple_forms.xhtml there is a problem which is 
> entirely my 
> >>>> fault because I was fuzzy in my first mail. You should namespace 
> >>>> the transformed xhtml:form -> xforms:group with a model 
> attribute. 
> >>>> E.g. the transformed <xhtml:form> should look like <xforms:group 
> >>>> ref="instance('formData1')"
> >>>> model="model1"/> and for the next <xforms:group 
> >>>> ref="instance('formData2')" model="model2"/> Sorry about 
> that. The 
> >>>> current version will not work since you are not allow to cross 
> >>>> reference instance between models in XForms.
> >>>>
> >>>> 6) Very nice transformation in outgroup.xhtml. There is 
> a choices 
> >>>> element in XForms which will allow you to transforms <optgroup 
> >>>> label="Names starting with B"> into <xforms:choices>
> >>>>   <xforms:label>Names starting with B</xforms:label>
> >>>>   <xforms:item>
> >>>>     <xforms:label>Berta</xforms:label>
> >>>>     <xforms:value>Berta</xforms:value>
> >>>>   </xforms:item>
> >>>>   ...
> >>>> </xforms:choices>
> >>>>
> >>>> 7) For select.xhtml I like Tom Waits ;)
> >>>>
> >>>> 8) I really like the reset trigger. It is a good detail.
> >>>>
> >>>> Keep up the good work!
> >>>>
> >>>> Best regards,
> >>>> David
> >>>>
> >>>> Huditsch, Roman (LNG-VIE) wrote:
> >>>>     
> >>>>         
> >>>>> Hi,
> >>>>>
> >>>>> I did my best to include all of your suggestions :) The
> >>>>>           
> >> new version
> >>     
> >>>>> now transforms xhrml:label elements if they occur directly
> >>>>>       
> >>>>>           
> >>>> before an
> >>>>     
> >>>>         
> >>>>> xforms control or have a "for" attribute.
> >>>>> When there is a <td> parent I leave it as it is, since
> >>>>>           
> >> otherwise it
> >>     
> >>>>> may wreck any table layouts.
> >>>>> Attached is a new version of my stylesheet and some test cases.
> >>>>> Any feedback is heartly welcome.
> >>>>> Hope you enjoy it.
> >>>>>
> >>>>> all the best,
> >>>>> Roman
> >>>>>
> >>>>>   
> >>>>>       
> >>>>>           
> >>>>>> -----Ursprüngliche Nachricht-----
> >>>>>> Von: David Landwehr [mailto:david.landwehr@solidapp.com]
> >>>>>> Gesendet: Mittwoch, 22. Februar 2006 16:17
> >>>>>> An: Huditsch, Roman (LNG-VIE)
> >>>>>> Cc: www-forms@w3.org
> >>>>>> Betreff: Re: Stylesheet for Transforming HTML forms to XForms
> >>>>>>
> >>>>>> Hi Roman,
> >>>>>>
> >>>>>> Really excellent and exciting work!
> >>>>>>
> >>>>>> I have some suggestions:
> >>>>>> 1) the xhtml:form is kept in the resulting document after the 
> >>>>>> transformation. It would be great to remove the element
> >>>>>>         
> >>>>>>             
> >>>> and replace
> >>>>     
> >>>>         
> >>>>>> it with a group. The group could have ref="/instance"
> >>>>>> to remove the requirement for the child controls to have
> >>>>>>         
> >>>>>>             
> >>>> that part in
> >>>>     
> >>>>         
> >>>>>> they refs.
> >>>>>> 2) It would really be cool to create a model or instance
> >>>>>>             
> >> for each
> >>     
> >>>>>> form in the document. That would require proper model
> >>>>>>             
> >> namespacing. 
> >>     
> >>>>>> Because xhtml forms always are separated by its parent
> >>>>>>         
> >>>>>>             
> >>>> form element,
> >>>>     
> >>>>         
> >>>>>> that can simply be done using a model/ref with
> >>>>>>         
> >>>>>>             
> >>>> instance('')  on the
> >>>>     
> >>>>         
> >>>>>> transforming of  the xhtml:form element like xforms:group 
> >>>>>> ref="instance('ins1')"
> >>>>>> model="model1".
> >>>>>> 3) A nice feature would be to transform a xhtml:label like:
> >>>>>> <xhtml:label for="ctrl1">Label</xhtml:label><xhtml:input
> >>>>>>         
> >>>>>>             
> >>>> type="input" 
> >>>>     
> >>>>         
> >>>>>> name="some" value="bb" id="ctrl1"/> to <xforms:input 
> >>>>>> ref="/instance/some">
> >>>>>>   <xforms:label>Label</xforms:label>
> >>>>>> </xforms:input>
> >>>>>>
> >>>>>> 4) For input/@type="file" it does not generate a instance
> >>>>>>         
> >>>>>>             
> >>>> element to
> >>>>     
> >>>>         
> >>>>>> hold the value. It would be great if it did that and 
> additional 
> >>>>>> specified the type to be e.g. a base 64 encoding using 
> >>>>>> xsi:type="xsd:base64Binary".
> >>>>>>
> >>>>>> If you shared the html files you use to test with it
> >>>>>>             
> >> would be much
> >>     
> >>>>>> easier to provide you with feedback.
> >>>>>>
> >>>>>> Again really great work!
> >>>>>>
> >>>>>> Best regards,
> >>>>>> David
> >>>>>>
> >>>>>>
> >>>>>> Huditsch, Roman (LNG-VIE) wrote:
> >>>>>>     
> >>>>>>         
> >>>>>>             
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> I just tried to write an XSLT stylesheet for transforming
> >>>>>>>       
> >>>>>>>           
> >>>>>>>               
> >>>>>> simple HTML
> >>>>>>     
> >>>>>>         
> >>>>>>             
> >>>>>>> forms to their XForms equivalents. I hope that I have
> >>>>>>>       
> >>>>>>>           
> >>>>>>>               
> >>>>>> considered all
> >>>>>>     
> >>>>>>         
> >>>>>>             
> >>>>>>> controls mentioned by selfhtml and the "XForms for 
> HTML Authors"
> >>>>>>> document.
> >>>>>>> I would be glad to get any input on it :)
> >>>>>>>
> >>>>>>> wbr,
> >>>>>>> Roman
> >>>>>>>
> >>>>>>> _______________________________________
> >>>>>>>
> >>>>>>> Roman Huditsch
> >>>>>>> IT and Electronic Publishing
> >>>>>>> LexisNexis ARD Orac
> >>>>>>> Marxergasse 25
> >>>>>>> 1030 Vienna
> >>>>>>> Austria
> >>>>>>> ph: +43-1-534 52-1514
> >>>>>>> f: +43-1-534 52-140
> >>>>>>> e-mail roman.huditsch@lexisnexis.at www.lexisnexis.at
> >>>>>>>
> >>>>>>>   
> >>>>>>>       
> >>>>>>>           
> >>>>>>>               
> >>>>>> --
> >>>>>> --------------------------------------------
> >>>>>> David Landwehr (david.landwehr@solidapp.com) Chief
> >>>>>>         
> >>>>>>             
> >>>> Executive Officer,
> >>>>     
> >>>>         
> >>>>>> SolidApp
> >>>>>> Web: http://www.solidapp.com
> >>>>>> Office: +45 48268212
> >>>>>> Mobile: +45 24275518
> >>>>>> --------------------------------------------
> >>>>>>
> >>>>>>     
> >>>>>>         
> >>>>>>             
> >>>> --
> >>>> --------------------------------------------
> >>>> David Landwehr (david.landwehr@solidapp.com) Chief Executive 
> >>>> Officer, SolidApp
> >>>> Web: http://www.solidapp.com
> >>>> Office: +45 48268212
> >>>> Mobile: +45 24275518
> >>>> --------------------------------------------
> >>>>
> >>>>     
> >>>>         
> >> --
> >> --------------------------------------------
> >> David Landwehr (david.landwehr@solidapp.com) Chief 
> Executive Officer, 
> >> SolidApp
> >> Web: http://www.solidapp.com
> >> Office: +45 48268212
> >> Mobile: +45 24275518
> >> --------------------------------------------
> >>
> >>     
> 
> 
> --
> --------------------------------------------
> David Landwehr (david.landwehr@solidapp.com) Chief Executive 
> Officer, SolidApp
> Web: http://www.solidapp.com
> Office: +45 48268212
> Mobile: +45 24275518
> --------------------------------------------
> 
> 
Received on Monday, 27 February 2006 09:32:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:03 GMT