htmlFragmentFile( fname, e... )

Renders the specified XML elements e... as a fragment of an HTML document to a file fname, returning a URL object for the written page.

There are only a few differences between a full document and a fragment, which are explained below:

  • A fragment can contain multiple top level elements, a full document can only contain one - the <html /> element.
  • A fragment does not have a document type - the fragment is designed to be included within a full document.
Otherwise the rules regarding the filename, fname, and the way the document is rendered as HTML are the same as for the htmlFile function. e.g.
:-) htmlFragmentFile( "sample", <table/><table/> );
About to render to .../output/sample.html
There is 1 result
/sample.html
:-) htmlFile( "sample.wml", <table/><table/> );
About to render to .../output/sample.wml
There is 1 result
/sample.wml
:-)
:-) folder.addLast( "parent" );
There are 0 results
:-) htmlFragmentFile(
:-)   "sample",
:-)   <head><title>"Sample page"</title></head>
:-)   <body><h1>"Sample Page"</h1></body>
:-) );
About to render to .../output/parent/sample.html
There is 1 result
/parent/sample.html
      
Finally, as with the htmlFile, after writing the HTML page the htmlFile function returns a URL object for the written page. This could then be used for creating links to the page, etc.

Notes

If you use the same URL object multiple times, each successive use will replace the previously written file. See newURL for details.