Subject: RE: Including a document containing static HTML From: "Evan Lenz" <elenz@xxxxxxxxxxx> Date: Mon, 16 Oct 2000 10:31:39 -0700 |
I wrote a similar application that allows users to upload HTML in order to generate custom XSLT stylesheets for our search engine interface (this feature hasn't been released yet). I wrote a Java servlet that uses JTidy (http://www3.sympatico.ca/ac.quick/) to turn the HTML into well-formed XML and then used a stylesheet with the document() function to include and transform the input (X)HTML to ultimately generate the custom stylesheet. If you want to simply copy an HTML fragment into the result, you'll want to use <xsl:copy-of select="document(@file_name)"/> rather than <xsl:value-of/> which always copies the string value of the node (which in this case would be all the text content of your HTML fragment, concatenated together). I encourage you to try Tidy (http://www.w3.org/People/Raggett/tidy/) to see if you can't convert the input to well-formed XML first. disable-output-escaping only works for <xsl:value-of/> and <xsl:text/>. In other words, XSLT will not allow you to process non-well-balanced markup, whether you intend to escape it or not. The only alternative that *might* work (in a very hackish way, mind you) would be too escape all of the HTML tags before inputting it as just a string, in which case <xsl:value-of/> and disable-output-escaping may work, depending on the processor. Hope this helps, Evan Lenz elenz@xxxxxxxxxxx http://www.xyzfind.com XYZFind, the search engine *designed* for XML Download our free beta software: http://www.xyzfind.com/beta -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Steve Sent: Monday, October 16, 2000 8:36 AM To: xsl-list@xxxxxxxxxxxxxxxx Subject: Including a document containing static HTML (sorry if this is covered in archive/FAQ - after a few hours of searching, I haven't found what I need) I have an application which generates XML, then uses XSL to convert that into HTML. One of the functions has users uploading blocks of html code to then be included in the output. First: How to include the file? Imagine the xml is of the form <user_info_node file_name="XXX"/> I have tried the following without success (no error given - just nothing included in the output html): <xsl:value-of select="document(@file_name)" disable-output-escaping="yes"/> Second: Will the disable-output-escaping="yes" save me from potentially non-perfectly-formed HTML (by XML standards)? For example, any <br>'s with no closing to </br> that are contained in the uploaded HTML block? How have other people dealt with this type of problem? Thanks in advance XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Including a document containing sta, Steve | Thread | RE: Including a document containing, Kay Michael |
RE: grouping by child element, Kay Michael | Date | Re: Visual editing, Terje Norderhaug |
Month |