1.1 --- a/XSLForms/Resources/WebResources.py Mon Jun 22 23:59:53 2009 +0200
1.2 +++ b/XSLForms/Resources/WebResources.py Tue Jul 07 01:14:12 2009 +0200
1.3 @@ -19,7 +19,7 @@
1.4 with this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -import WebStack.Generic
1.8 +from WebStack.Generic import EndOfResponse, ContentType
1.9 import XSLForms.Fields
1.10 import XSLForms.Prepare
1.11 import XSLForms.Output
1.12 @@ -114,6 +114,7 @@
1.13 in_page_resources = {}
1.14 init_resources = {}
1.15 transform_resources = {}
1.16 + document_resources = {}
1.17
1.18 def clean_parameters(self, parameters):
1.19
1.20 @@ -191,6 +192,22 @@
1.21 the optional 'references' to external documents.
1.22 """
1.23
1.24 + # Provide support for deficient browsers like Internet Explorer.
1.25 +
1.26 + content_type = trans.content_type
1.27 +
1.28 + # NOTE: Introduce proper content type parsing into WebStack.
1.29 +
1.30 + accept = (trans.get_header_values("Accept") or [""])[0]
1.31 + xhtml = "application/xhtml+xml"
1.32 +
1.33 + if content_type is not None and content_type.media_type == xhtml and accept.find(xhtml) == -1:
1.34 +
1.35 + # Get the conversion template.
1.36 +
1.37 + stylesheet_filenames.append(os.path.join(XSLForms.Prepare.resource_dir, "XHTMLToHTML.xsl"))
1.38 + trans.set_content_type(ContentType("text/html", content_type.charset or trans.default_encoding))
1.39 +
1.40 # Sanity check for the filenames list.
1.41
1.42 if isinstance(stylesheet_filenames, str) or isinstance(stylesheet_filenames, unicode):
1.43 @@ -346,7 +363,7 @@
1.44 self.init_document(trans, form)
1.45 self.respond_to_document(trans, form)
1.46 self.create_output(trans, form)
1.47 - raise WebStack.Generic.EndOfResponse
1.48 + raise EndOfResponse
1.49
1.50 # Modular methods for responding to requests.
1.51
1.52 @@ -444,7 +461,7 @@
1.53 else:
1.54 encoding = trans.default_charset
1.55
1.56 - content_type = content_type or WebStack.Generic.ContentType("application/xhtml+xml", encoding)
1.57 + content_type = content_type or ContentType("application/xhtml+xml", encoding)
1.58 trans.set_content_type(content_type)
1.59
1.60 # Ensure that an output stylesheet exists.
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/XSLForms/XSL/XHTMLToHTML.xsl Tue Jul 07 01:14:12 2009 +0200
2.3 @@ -0,0 +1,8 @@
2.4 +<?xml version="1.0"?>
2.5 +<stylesheet version="1.0"
2.6 + xmlns="http://www.w3.org/1999/XSL/Transform">
2.7 + <output method="html"/>
2.8 + <template match="/">
2.9 + <copy-of select="."/>
2.10 + </template>
2.11 +</stylesheet>
3.1 --- a/XSLTools/XSLOutput.py Mon Jun 22 23:59:53 2009 +0200
3.2 +++ b/XSLTools/XSLOutput.py Tue Jul 07 01:14:12 2009 +0200
3.3 @@ -37,7 +37,7 @@
3.4 class Processor:
3.5
3.6 """
3.7 - A handler which can prepare output for an XMLTools2 template.
3.8 + A handler which can prepare output for an XSLForms template.
3.9 """
3.10
3.11 def __init__(self, filenames, references=None, parameters=None, expressions=None):