Project

Profile

Help

Bug #5858 » test.pyw

Pierre Dostie, 2023-01-26 17:10

 
import os

# Global Variable Path
def resource_path(relative):
return os.path.join(
os.environ.get(
"_MEIPASS2",
os.path.abspath(".")
),
relative
)

path = resource_path(relative="")


from saxonche import PySaxonProcessor
import nodekind

#stylesheet = os.path.join(path,"configs\\stylesheets\\test.xslt")
stylesheet = "test.xslt"
outfile = "out.xml"

list_xml_file = ['<Address>']
list_xml_file.append("<name>Alex</name>")
list_xml_file.append("<lastname>Mathew</lastname>")
list_xml_file.append('</Address>')
file_xml = ' '.join(map(str,list_xml_file))

proc_define = PySaxonProcessor(license=False)
xsltproc_define = proc_define.new_xslt30_processor()
executable = xsltproc_define.compile_stylesheet(stylesheet_file=stylesheet)

node = proc_define.parse_xml(xml_text=file_xml)
executable.transform_to_file(output_file=outfile, xdm_node= node)


(1-1/2)