Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* ``runtrace`` can be set to True to add tracing into the XSL output
* ``includemode`` can be set to 'document', 'esi' or 'ssi' to change the
way in which includes are processed
* ``parser`` can be set to an lxml parser instance; the default is an
HTMLParser
* ``compiler_parser``` can be set to an lxml parser instance; the default
is a XMLParser
* ``rules_parser`` can be set to an lxml parser instance; the default is a
XMLParser.
* ``xsl_params`` can be set to a dictionary of parameters that will be
known to the compiled theme transform. The keys should be the parameter
names. Values are default values.
"""
if access_control is not None:
read_network = access_control.options['read_network']
rules_doc = process_rules(
rules=rules,
theme=theme,
extra=extra,
css=css,
xinclude=xinclude,
absolute_prefix=absolute_prefix,
update=update,
trace=trace,
includemode=includemode,
parser=parser,
rules_parser=rules_parser,
read_network=read_network,
)
# Build a document with all the values to set the defaults
# for every value passed in as xsl_params
def generate_runtrace(rules, error_log, rules_parser=None):
"""Annotate a rules file with the results of a transformation"""
def condition_name(trace):
"""Generate attribute name for this entry"""
for k in trace.attrib.keys():
if(k == 'theme_xmlid'): continue
if(k.startswith('{http://namespaces.plone.org/diazo/css}')): continue
return "runtrace-"+k
rules_doc = process_rules(rules, rules_parser=rules_parser,
stop='add_identifiers')
trace_doc = etree.XML(log_to_xml_string(error_log))
for trace in trace_doc.xpath('/runtrace/runtrace'):
for el in rules_doc.xpath("id('"+trace.attrib['theme_xmlid']+"')"):
el.set(condition_name(trace),trace.text)
return rules_doc