XML Pages & XSLT Processing
If you have
Python4Suite installed in your system, it is possible to save XML documents as pages. It's important to start those pages with an XML declaration "<?xml ...>" in the very first line. Also, you have to specify the stylesheet that is to be used to process the XML document to HTML. This is done using a
standard "xml-stylesheet" processing instruction, with the name of a page containing the stylesheet as the "href" parameter.
See the following example for details, which can also be found on the XsltVersion page.
Example
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="XsltVersion" type="text/xml"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/">
This Wiki is running an XSLT engine by
<xsl:value-of select="system-property('xsl:vendor')"/>
(<a href="{system-property('xsl:vendor-url')}"><xsl:value-of select="system-property('xsl:vendor-url')"/></a>)
implementing XSLT v<xsl:value-of select="system-property('xsl:version')"/>
</xsl:template>
</xsl:stylesheet>
Display
--> -->| AttributeErrorFormatter instance has no attribute 'raw_html' | Please include this information in your bug reports!: Python Python 2.3.4: /usr/bin/python Linux webserv1.linux.duke.edu 2.6.9-55.0.12.ELsmp #1 SMP Fri Nov 2 12:38:56 EDT 2007 x86_64 MoinMoin Release 1.3.5 [Revision 1.3.5 release] Thu Apr 23 17:43:03 2009 |
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
| /usr/lib/python2.3/site-packages/MoinMoin/request.py in run(self=<MoinMoin.request.RequestCGI object>) |
| 914 else: |
| 915 try: |
| 916 cgitb.Hook(file=self).handle(saved_exc) |
| 917 # was: cgitb.handler() |
| 918 except: |
| cgitb = <module 'MoinMoin.support.cgitb' from '/usr/lib/python2.3/site-packages/MoinMoin/support/cgitb.pyc'>, cgitb.Hook = <class MoinMoin.support.cgitb.Hook>, file undefined, self = <MoinMoin.request.RequestCGI object>, ).handle undefined, saved_exc = (<class exceptions.AttributeError>, <exceptions.AttributeError instance>, <traceback object>) |
| /usr/lib/python2.3/site-packages/MoinMoin/wikiaction.py in do_show(pagename=u'HelpOnXmlPages', request=<MoinMoin.request.RequestCGI object>) |
| 461 Page(request, pagename, rev=rev).send_page(request, count_hit=1) |
| 462 else: |
| 463 Page(request, pagename).send_page(request, count_hit=1) |
| 464 |
| 465 |
| global Page = <class MoinMoin.Page.Page>, request = <MoinMoin.request.RequestCGI object>, pagename = u'HelpOnXmlPages', ).send_page undefined, count_hit undefined |
| /usr/lib/python2.3/site-packages/MoinMoin/Page.py in send_page(self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestCGI object>, msg=u'<strong>Redirected from page "<a href="/AideDesP...ml?action=show">AideDesPagesXml</a>"</strong><br>', **keywords={'count_hit': 1}) |
| 1152 else: |
| 1153 # parse the text and send the page content |
| 1154 self.send_page_content(request, Parser, body, format_args=pi_formatargs, do_cache=do_cache) |
| 1155 |
| 1156 # check for pending footnotes |
| self = <MoinMoin.Page.Page instance>, self.send_page_content = <bound method Page.send_page_content of <MoinMoin.Page.Page instance>>, request = <MoinMoin.request.RequestCGI object>, Parser = <class MoinMoin.parser.wiki.Parser>, body = u'== XML Pages & XSLT Processing ==\nIf you have [h...>\n}}} \n\n=== Display ===\n[[Include(XsltVersion)]]\n', format_args undefined, pi_formatargs = u'', do_cache = 1 |
| /usr/lib/python2.3/site-packages/MoinMoin/Page.py in send_page_content(self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestCGI object>, Parser=<class MoinMoin.parser.wiki.Parser>, body=u'== XML Pages & XSLT Processing ==\nIf you have [h...>\n}}} \n\n=== Display ===\n[[Include(XsltVersion)]]\n', needsupdate=0, format_args=u'', do_cache=1) |
| 1319 self.send_page_content(request, Parser, body, needsupdate=1) |
| 1320 request.clock.start('send_page_content') |
| 1321 cache = caching.CacheEntry(request, arena, key) |
| 1322 |
| 1323 # Save my cache modification time, this info might be used by |
| cache = <MoinMoin.caching.CacheEntry instance>, global caching = <module 'MoinMoin.caching' from '/usr/lib/python2.3/site-packages/MoinMoin/caching.pyc'>, caching.CacheEntry = <class MoinMoin.caching.CacheEntry>, request = <MoinMoin.request.RequestCGI object>, arena = <MoinMoin.Page.Page instance>, key = 'text_html' |
| /srv/httpd/vhosts/dulug.dulug.duke.edu/HelpOnXmlPages |
| /usr/lib/python2.3/site-packages/MoinMoin/formatter/base.py in macro(self=<MoinMoin.formatter.text_html.Formatter instance>, macro_obj=<MoinMoin.wikimacro.Macro instance>, name=u'Include', args=u'XsltVersion') |
| 229 def macro(self, macro_obj, name, args): |
| 230 # call the macro |
| 231 return macro_obj.execute(name, args) |
| 232 |
| 233 def _get_bang_args(self, line): |
| macro_obj = <MoinMoin.wikimacro.Macro instance>, macro_obj.execute = <bound method Macro.execute of <MoinMoin.wikimacro.Macro instance>>, name = u'Include', args = u'XsltVersion' |
| /usr/lib/python2.3/site-packages/MoinMoin/wikimacro.py in execute(self=<MoinMoin.wikimacro.Macro instance>, macro_name=u'Include', args=u'XsltVersion') |
| 99 macro = wikiutil.importPlugin(self.request.cfg, 'macro', macro_name) |
| 100 if macro: |
| 101 return macro(self, args) |
| 102 |
| 103 builtins = vars(self.__class__) |
| macro = <function execute>, self = <MoinMoin.wikimacro.Macro instance>, args = u'XsltVersion' |
| /usr/lib/python2.3/site-packages/MoinMoin/macro/Include.py in execute(macro=<MoinMoin.wikimacro.Macro instance>, text=u'XsltVersion', args_re=<_sre.SRE_Pattern object>, title_re=<_sre.SRE_Pattern object>, called_by_toc=0) |
| 220 result.append(strfile.getvalue()) |
| 221 finally: |
| 222 request.redirect() |
| 223 |
| 224 # decrement or remove include marker |
| request = <MoinMoin.request.RequestCGI object>, request.redirect = <bound method RequestCGI.redirect of <MoinMoin.request.RequestCGI object>> |
| /usr/lib/python2.3/site-packages/MoinMoin/Page.py in send_page(self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestCGI object>, msg='', **keywords={'content_id': u'Include_XsltVersion', 'content_only': 1}) |
| 1152 else: |
| 1153 # parse the text and send the page content |
| 1154 self.send_page_content(request, Parser, body, format_args=pi_formatargs, do_cache=do_cache) |
| 1155 |
| 1156 # check for pending footnotes |
| self = <MoinMoin.Page.Page instance>, self.send_page_content = <bound method Page.send_page_content of <MoinMoin.Page.Page instance>>, request = <MoinMoin.request.RequestCGI object>, Parser = <class MoinMoin.parser.xslt.Parser>, body = u'<?xml version="1.0" encoding="ISO-8859-1"?>\n\n<?x...rsion\')"/>\n </xsl:template>\n\n</xsl:stylesheet>\n', format_args undefined, pi_formatargs = '', do_cache = 1 |
| /usr/lib/python2.3/site-packages/MoinMoin/Page.py in send_page_content(self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestCGI object>, Parser=<class MoinMoin.parser.xslt.Parser>, body=u'<?xml version="1.0" encoding="ISO-8859-1"?>\n\n<?x...rsion\')"/>\n </xsl:template>\n\n</xsl:stylesheet>\n', needsupdate=1, format_args='', do_cache=1) |
| 1287 request.redirect(buffer) |
| 1288 parser = Parser(body, request) |
| 1289 parser.format(formatter) |
| 1290 request.redirect() |
| 1291 text = buffer.getvalue() |
| parser = <MoinMoin.parser.xslt.Parser instance>, parser.format = <bound method Parser.format of <MoinMoin.parser.xslt.Parser instance>>, formatter = <MoinMoin.formatter.text_python.Formatter instance> |
| /usr/lib/python2.3/site-packages/MoinMoin/parser/xslt.py in format(self=<MoinMoin.parser.xslt.Parser instance>, formatter=<MoinMoin.formatter.text_python.Formatter instance>) |
| 46 # can be activated in wikiconfig.py |
| 47 from MoinMoin.parser import plain |
| 48 self.request.write(formatter.sysmsg(1) + |
| 49 formatter.raw_html(_('XSLT option disabled, please look at HelpOnConfiguration.')) + |
| 50 formatter.sysmsg(0)) |
| self = <MoinMoin.parser.xslt.Parser instance>, self.request = <MoinMoin.request.RequestCGI object>, self.request.write = <bound method RequestCGI.write of <MoinMoin.request.RequestCGI object>>, formatter = <MoinMoin.formatter.text_python.Formatter instance>, formatter.sysmsg = <bound method Formatter.sysmsg of <MoinMoin.formatter.text_html.Formatter instance>>, formatter.raw_html undefined, _ = <function <lambda>> |
| /usr/lib/python2.3/site-packages/MoinMoin/formatter/text_python.py in __getattr__(self=<MoinMoin.formatter.text_python.Formatter instance>, name='raw_html') |
| 74 """ For every thing we have no method/attribute use the formatter |
| 75 """ |
| 76 return getattr(self.formatter, name) |
| 77 |
| 78 def __insert_code(self, call): |
| getattr undefined, self = <MoinMoin.formatter.text_python.Formatter instance>, self.formatter = <MoinMoin.formatter.text_html.Formatter instance>, name = 'raw_html' |
AttributeError: Formatter instance has no attribute 'raw_html'
__doc__ =
'Attribute not found.'
__getitem__ =
<bound method AttributeError.__getitem__ of <exceptions.AttributeError instance>>
__init__ =
<bound method AttributeError.__init__ of <exceptions.AttributeError instance>>
__module__ =
'exceptions'
__str__ =
<bound method AttributeError.__str__ of <exceptions.AttributeError instance>>
args =
("Formatter instance has no attribute 'raw_html'",)
Duke University Linux Users' Group