XSLTools

Changeset

303:3c376dbd7cf2
2005-10-12 paulb raw files shortlog changelog graph [project @ 2005-10-12 16:30:56 by paulb] Changed to use document initialisation. Fixed template_resources collection.
examples/Common/PEP241/__init__.py (file)
     1.1 --- a/examples/Common/PEP241/__init__.py	Wed Oct 12 16:30:27 2005 +0000
     1.2 +++ b/examples/Common/PEP241/__init__.py	Wed Oct 12 16:30:56 2005 +0000
     1.3 @@ -5,7 +5,6 @@
     1.4  import WebStack.Generic
     1.5  import XSLForms.Resources
     1.6  import XSLForms.Utils
     1.7 -from XSLTools import XSLOutput
     1.8  import os
     1.9  
    1.10  # Site map imports.
    1.11 @@ -22,10 +21,10 @@
    1.12      resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
    1.13      encoding = "utf-8"
    1.14      template_resources = {
    1.15 -        "pep241" : ["pep241_template.xhtml", "pep241_output.xsl"]
    1.16 +        "pep241" : ("pep241_template.xhtml", "pep241_output.xsl")
    1.17          }
    1.18 -    transform_resources = {
    1.19 -        "categories" : ["pep241_categories.xsl"]
    1.20 +    init_resources = {
    1.21 +        "pep241" : ("pep241_template.xhtml", "pep241_input.xsl")
    1.22          }
    1.23      document_resources = {
    1.24          "categories" : "pep241_categories.xml"
    1.25 @@ -76,10 +75,9 @@
    1.26  
    1.27              # Transform, adding enumerations/ranges.
    1.28  
    1.29 -            categories_xsl = self.prepare_transform("categories")
    1.30 +            input_xsl = self.prepare_initialiser("pep241")
    1.31              categories_xml = self.prepare_document("categories")
    1.32 -            proc = XSLOutput.Processor(categories_xsl, {"categories" : categories_xml})
    1.33 -            package = proc.get_result(package)
    1.34 +            package = self.get_result([input_xsl], package, references={"category" : categories_xml})
    1.35  
    1.36              # Start the response.
    1.37  
    1.38 @@ -88,10 +86,16 @@
    1.39              # Ensure that an output stylesheet exists.
    1.40  
    1.41              trans_xsl = self.prepare_output("pep241")
    1.42 +            stylesheet_parameters = {}
    1.43  
    1.44              # Complete the response.
    1.45  
    1.46 -            self.send_output(trans, [trans_xsl], package)
    1.47 +            self.send_output(trans, [trans_xsl], package, stylesheet_parameters)
    1.48 +
    1.49 +            #from XSLTools import XSLOutput
    1.50 +            #import sys
    1.51 +            #proc = XSLOutput.Processor([trans_xsl], parameters=stylesheet_parameters)
    1.52 +            #proc.send_output(sys.stderr, "iso-8859-1", package)
    1.53  
    1.54  # Site map initialisation.
    1.55