Document-to-text conversion parameters

Certain methods accept Document_to_text_conversion_parameters hash.

These parameters are identical to attributes of
<xsl:output … />.
except
doctype-public and doctype-system, which cannot be specified this way.
So far,
cdata-section-elements are also excluded.

By default text rendered in
$request:charset, but in XML-header or in meta element for HTML-method Parser specifies $response:charset. This behaviour can be altered by specifying the charset in <xsl:output … /> or corresponding conversion parameter.

While creating object of class
file one can also specify parameter media-type: when new response body body is generated, response header content-type will be assigned the value of this parameter.

Example
# output document as HTML without indents and xml-declaration
^document
.string[
   $.method[html]
   $.indent[no]
   $.omit-xml-declaration[yes]
   $.encoding[windows-1252]
#   $.charset[windows-1252]      [3.4.2] the option can not be used with an option $.encoding[] together
]

Outputting XHTML
If you need an XHTML output, you must specify these attributes for <xsl:stylesheet … /> element:

<xsl:stylesheet version="1.0"
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

Note
xmlns without prefix specification, this should be done for all created in template prefixless elements to get to xhtml name space. It is necessary to specify xmlns without prefix in each .xsl file, because this parameter does not influence included files.

Also these attributes for
<xsl:output … /> must be set:
<xsl:output 
   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
   doctype-system="DTD/xhtml1-strict.dtd"
   />

Note: do not specify method attribute. XHTML is an xml with a certain difference in rendering, it switches on when any of these doctypes are used:
   -//W3C//DTD XHTML 1.0 Strict//EN
   -//W3C//DTD XHTML 1.0 Frameset//EN
   -//W3C//DTD XHTML 1.0 Transitional//EN



Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 18.06.2012