This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: XSLT and formatters


Hans-Guenter,

>Now: is there any solution for inserting all the surrounding
>table-formating stuff into the final HTML-output without having the
>XSLT-processor parsing all the table-formating and building a very large
>DOM-object?

Possibly.  Rather than producing all the tables using XSLT, you could just
produce a file (or files) containing the content that are then referenced
as entities within the HTML page.  To do this, your HTML page needs to be
XHTML (i.e. XML using HTML elements/attributes), but that shouldn't be a
problem.  Your XHTML file should look like:

----
<?xml verision="1.0"?>
<!-- use whatever level of XHTML (strict, transitional, framset) you want -->
<!-- insert your own reference to a local copy of the XHTML DTD -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "DTD/xhtml1-transitional.dtd" [
<!ENTITY content SYSTEM "content.html">
]>
<html>
<head><title>Document with lots of nested tables</title></head>
<body>
  <table>
    ...
    <table>
      <tr><td>&content;</td></tr>
    </table>
    ...
  </table>
</body>
</html>
----

The content in content.html will be inserted wherever you put the entity
reference (&content;).  You can then produce the content.html from the XSLT
stylesheet on your XML input, making sure it's a well-formed external
parsed text entity (see http://www.w3.org/TR/REC-xml#TextEntities).

You could use several entities if you wanted to, but the more you're using,
the more likely it is that just producing the whole file through XSLT is
the best solution.  This approach won't work well if the information that
you want to include is to be scattered around within the tables, only if
you have a few discrete chunks of generated output.

Also, the XHTML page will not be viewable properly unless you're using a
browser that recognises the HTML entities (i.e. an XML-aware browser).
That means that you will have to convert it to HTML, but I would have
thought that the standard html-formatter applied by Cocoon would be able to
do this for you.

In a flow chart, the suggested solution is sort of:

XML/XSP input --- (XSLT) --> XML content --|
                                           +-- (html formatter) --> HTML
                            XHTML format --|

I hope this is a viable solution for you,

Jeni

Dr Jeni Tennison
Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE
Telephone 0115 9061301 • Fax 0115 9061304 • Email
jeni.tennison@epistemics.co.uk



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]