Skip to content
Permalink
c2f21bcaef
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (26 sloc) 963 Bytes
from .xsl_lib import xslt
from django.http import HttpResponse
# from django.shortcuts import render
from aldryn_apphooks_config.utils import get_app_instance
from pathlib import Path
from django.conf import settings
from pyexistdb import db
XML_DIR = settings.XML_DIR
def render( request ):
namespace, config = get_app_instance(request)
xml_file = \
"/db/apps/eoa/xml" / (Path(config.xml_file) . relative_to( XML_DIR ))
stylesheet = \
"/db/apps/eoa/xml" / Path(config.stylesheet) . relative_to( XML_DIR )
params = []
for p in config.xslparam_set.all():
params += [ (p.key, p.value) ]
# print( f"xml_file: {xml_file}, stylesheet: {stylesheet}" )
ret_doc = \
xslt(
input = f'doc("{xml_file}")',
stylesheet = f'doc("{stylesheet}")',
params = params,
ns_prefixes = [ ("tei", "http://www.tei-c.org/ns/1.0") ]
)
return HttpResponse( ret_doc )