Hi
I notice if you try and call xforms:serialize on xml tags with empty content (i.e. <br/> or <img src=".."/> then the output, after being passed through the serialize function, is <br> or <img src="..">. This is causing me quite a headache as I am looking to pass around xhtml as serialized parts of an xml document and i was wondering if there was a way of forcing the function to output valid xhtml? Chris. For an example, look at the html output produced by: <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"> <xhtml:head> <xhtml:title>XForms example</xhtml:title> <xforms:model id="main-model"> <xforms:instance id="formatted"> <data/> </xforms:instance> <xforms:instance id="serialized"> <data/> </xforms:instance> <xforms:instance id="test"> <data> <br/> <b>here is a test</b> <img src="http://www.google.co.uk/intl/en_uk/images/logo.gif" alt="google logo"/> </data> </xforms:instance> <xforms:bind nodeset="instance('serialized')" calculate="xxforms:serialize(instance('test'), 'html')"/> </xforms:model> </xhtml:head> <xhtml:body> Serialized data: <xhtml:br/> <xforms:output ref="instance('serialized')" mediatype="text/html"/> (view html produced) </xhtml:body> </xhtml:html> -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Chris,
your using xxforms:serialize(instance('test'), 'html'), so it is creating valid *html* not xhtml, use xxforms:serialize(instance('test'), 'xhtml') to do that :-) Ryan Ryan Puddephatt Software Engineer Teleflex Group - IT UK 1 Michaelson Square Livingston West Lothian Scotland EH54 7DP e> [hidden email] t> +44(0)1506 407 110 f> +44(0)1506 407 108 >-----Original Message----- >From: [hidden email] [mailto:[hidden email]] >Sent: 07 December 2006 11:47 >To: [hidden email] >Subject: [ops-users] xforms:serialize function produces invalid xhtml > >Hi > >I notice if you try and call xforms:serialize on xml tags with >empty content (i.e. <br/> or <img src=".."/> then the output, >after being passed through the serialize function, is <br> or ><img src="..">. > >This is causing me quite a headache as I am looking to pass >around xhtml as serialized parts of an xml document and i was >wondering if there was a way of forcing the function to output >valid xhtml? > >Chris. > > >For an example, look at the html output produced by: ><xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"> > > <xhtml:head> > <xhtml:title>XForms example</xhtml:title> > <xforms:model id="main-model"> > <xforms:instance id="formatted"> > <data/> > </xforms:instance> > <xforms:instance id="serialized"> > <data/> > </xforms:instance> > <xforms:instance id="test"> > <data> > <br/> > <b>here is a test</b> > <img >src="http://www.google.co.uk/intl/en_uk/images/logo.gif" >alt="google logo"/> > </data> > </xforms:instance> > > <xforms:bind >nodeset="instance('serialized')" >calculate="xxforms:serialize(instance('test'), 'html')"/> > > > </xforms:model> > </xhtml:head> > <xhtml:body> > Serialized data: > <xhtml:br/> > <xforms:output ref="instance('serialized')" >mediatype="text/html"/> (view html produced) > </xhtml:body> ></xhtml:html> > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Ah thanks Ryan. I guess I was being a bit dim as I missed the documentation
"allows you to serialize an XML node to XML, HTML, XHTML or text" in <http://www.orbeon.com/ops/doc/reference-xforms-ng#xxforms-serialize> Chris. --On 07 December 2006 12:56 +0000 Ryan Puddephatt <[hidden email]> wrote: > Chris, > your using xxforms:serialize(instance('test'), 'html'), so it is > creating valid *html* not xhtml, use xxforms:serialize(instance('test'), > 'xhtml') to do that :-) > > Ryan > > Ryan Puddephatt > Software Engineer > > Teleflex Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotland > EH54 7DP > > e> [hidden email] > t> +44(0)1506 407 110 > f> +44(0)1506 407 108 > > > >> -----Original Message----- >> From: [hidden email] [mailto:[hidden email]] >> Sent: 07 December 2006 11:47 >> To: [hidden email] >> Subject: [ops-users] xforms:serialize function produces invalid xhtml >> >> Hi >> >> I notice if you try and call xforms:serialize on xml tags with >> empty content (i.e. <br/> or <img src=".."/> then the output, >> after being passed through the serialize function, is <br> or >> <img src="..">. >> >> This is causing me quite a headache as I am looking to pass >> around xhtml as serialized parts of an xml document and i was >> wondering if there was a way of forcing the function to output >> valid xhtml? >> >> Chris. >> >> >> For an example, look at the html output produced by: >> <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" >> xmlns:xhtml="http://www.w3.org/1999/xhtml" >> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"> >> >> <xhtml:head> >> <xhtml:title>XForms example</xhtml:title> >> <xforms:model id="main-model"> >> <xforms:instance id="formatted"> >> <data/> >> </xforms:instance> >> <xforms:instance id="serialized"> >> <data/> >> </xforms:instance> >> <xforms:instance id="test"> >> <data> >> <br/> >> <b>here is a test</b> >> <img >> src="http://www.google.co.uk/intl/en_uk/images/logo.gif" >> alt="google logo"/> >> </data> >> </xforms:instance> >> >> <xforms:bind >> nodeset="instance('serialized')" >> calculate="xxforms:serialize(instance('test'), 'html')"/> >> >> >> </xforms:model> >> </xhtml:head> >> <xhtml:body> >> Serialized data: >> <xhtml:br/> >> <xforms:output ref="instance('serialized')" >> mediatype="text/html"/> (view html produced) >> </xhtml:body> >> </xhtml:html> >> >> > > -- ---------------------- Chris Bailey [hidden email] -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |