Hi,
I have a pipeline which returns XML. In addition to displaying XForms instances, I would also like to render part of XML content directly using XSLT within the XForms view. The XML content consists of embedded HTML content/tag, for example: http://library.nesc.ed.ac.uk:8080/fedora/get/lib:5638/content (part of XML output from the pipeline). I used the following XSLT element within the XForms view: <xsl:for-each select="//rss/channel/item"> <xsl:value-of select="description" disable-output-escaping="yes"/> </xsl:for-each> Instead of formatted HTML content, I got the HTML content with tags instead, e.g: <p> You can browse a range of resources using the menu given near the top of the website. The menu is accessible from most top-level library pages except for object details (metadata and content) pages where it will be replaced by a wiki menu for editing metadata and content.</p> <p>The following is a list of resource types available for browsing: </p> <ul> <li>Article</li> <li>Assessment</li> <li>Audio</li> <li>Book</li> <li>Courses</li> <li>Exercise</li> <li>Journal</li> <li>Presentations</li> <li>Tutorials</li> <li>Videos</li> </ul> Why is the 'disable-output-escaping' not working properly in this case? Is this a bug of the currently nightly build? I understand that I can construct an XForms instance and render the content using <xforms:output ref='..' mediatype="text/html"/> (which I may resort to). But since I'm not intending to manipulate/control the embedded content per XForms se. I thought the XSLT method would be the most appropriate way and perhaps less resource/memory intensive given the embedded content can be large. Best wishes, Boon ----- -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Boon,
> Why is the 'disable-output-escaping' not working properly in this > case? Is this a bug of the currently nightly build? In XML pipelines as implemented in Orbeon, transformation is separate from serialization. What travels between two processors are SAX events, which more or less represent XML infosets. This does not include serialization options such as "disable-output-escaping". > I understand that I can construct an XForms instance and render the > content using <xforms:output ref='..' mediatype="text/html"/> (which > I may resort to). But since I'm not intending to manipulate/control > the embedded content per XForms se. I thought the XSLT method would > be the most appropriate way and perhaps less resource/memory > intensive given the embedded content can be large. You should be able to use instead the saxon:serialize() function. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Erik,
Thanks. I'm now working on the saxon:serialize() function but encounter the following issue. The function requires two parameters with the first being the data node, the second being either an xsl:output element or a string literal pointing to a named xsl:output element in the stylesheet. The content rendering is done in an XML file which is part of (via xi:include) a XSL stylesheet which in turn, specified as the parameter of the 'view' attribute of the pipeline. Sorry if this is a trivial question. How do I pass a dynamically constructed xsl:output element into the call? Because I couldn't specify and name a top level xsl:output element since the top element of the XSL view is xhtml:html (not xsl:stylesheet in a normal XSLT). I tried to construct the output element as a variable prior to calling the function as below, but to no avail :-( .... <xsl:variable name="outputElement" as="element()*"> <xsl:element name="output"> <xsl:attribute name="version">1.0</xsl:attribute> <xsl:attribute name="method">xhtml</xsl:attribute> <xsl:attribute name="encoding">utf-8</xsl:attribute> <xsl:attribute name="indent">yes</xsl:attribute> </xsl:element> </xsl:variable> <p> <xsl:value-of select="saxon:serialize(description, $outputElement" /> </p> ... I guess the $outputElement passed a empty string to the call and hence the function doesn't work. Boon On 14 Nov 2007, at 23:25, Erik Bruchez wrote: Boon, -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Boon,
> Sorry if this is a trivial question. How do I pass a dynamically > constructed xsl:output element into the call? Because I couldn't specify > and name a top level xsl:output element since the top element of the XSL > view is xhtml:html (not xsl:stylesheet in a normal XSLT). I tried to > construct the output element as a variable prior to calling the function > as below, but to no avail :-( I didn't try it, but the Saxon Documentation shows the following example: saxon:serialize($x, <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" saxon:indent-spaces="1"/>) http://www.saxonica.com/documentation/extensions/functions/serialize.html This example uses XQuery, but maybe it works also in you case. I suppose you will have to escape <, > and " with the HTML entities. HTH florian -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Florian,
I tried the following suggested call with escaped parameters: <xsl:value-of select="saxon:serialize(description, <xsl:output method="xhtml" version="1.0" encoding="utf-8" indent="yes"/>)" /> and got the following exception: XPath syntax error at char 30 on line 28 in {saxon:serialize(description, ...}: Node constructor expressions are allowed only in XQuery, not in XPath So this only works for XQuery :-( Boon On 15 Nov 2007, at 11:06, Florian Schmitt wrote: Hi Boon,Sorry if this is a trivial question. How do I pass a dynamically constructed xsl:output element into the call? Because I couldn't specify and name a top level xsl:output element since the top element of the XSL view is xhtml:html (not xsl:stylesheet in a normal XSLT). I tried to construct the output element as a variable prior to calling the function as below, but to no avail :-( -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Well, you will have to have an xsl:output element at the top level. I
don't think XSLT will allow you to pass a literal xsl:output as a parameter. -Erik On Nov 15, 2007, at 3:22 AM, Boon Low wrote: > Hi Florian, > > I tried the following suggested call with escaped parameters: > > <xsl:value-of select="saxon:serialize(description, <xsl:output > method="xhtml" version="1.0" > encoding="utf-8" indent="yes"/>)" /> > > and got the following exception: > > XPath syntax error at char 30 on line 28 in > {saxon:serialize(description, ...}: > Node constructor expressions are allowed only in XQuery, not in XPath > > So this only works for XQuery :-( > > Boon > > ----- > Boon Low > Web and System Developer, > UK National e-Science Centre > http://homepages.ed.ac.uk/boon > > > On 15 Nov 2007, at 11:06, Florian Schmitt wrote: > >> Hi Boon, >> >>> Sorry if this is a trivial question. How do I pass a dynamically >>> constructed xsl:output element into the call? Because I couldn't >>> specify and name a top level xsl:output element since the top >>> element of the XSL view is xhtml:html (not xsl:stylesheet in a >>> normal XSLT). I tried to construct the output element as a >>> variable prior to calling the function as below, but to no avail :-( >> >> I didn't try it, but the Saxon Documentation shows the following >> example: >> >> saxon:serialize($x, <xsl:output method="xml" >> omit-xml-declaration="yes" >> indent="yes" >> saxon:indent-spaces="1"/>) >> >> http://www.saxonica.com/documentation/extensions/functions/serialize.html >> >> This example uses XQuery, but maybe it works also in you case. I >> suppose you will have to escape <, > and " with the HTML entities. >> >> HTH >> florian >> >> -- >> 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 >> OW2 mailing lists service home page: http://www.ow2.org/wws > > > -- > 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 > OW2 mailing lists service home page: http://www.ow2.org/wws -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
In reply to this post by Boon Low
Ah, I see. So you were trying to render your XForms intance as HTML in the browser?
What did you mean by "XForms View" Did you solve this problem?
|
Free forum by Nabble | Edit this page |