Python appengine外部名称空间中的lxml
有没有一种方法可以配置lxml来获取appengine中的外部xsl模板 我目前在prod中得到错误Python appengine外部名称空间中的lxml,python,xslt,lxml,Python,Xslt,Lxml,有没有一种方法可以配置lxml来获取appengine中的外部xsl模板 我目前在prod中得到错误 XSLTParseError: Cannot resolve URI http://... 即使它在开发中起作用 我像这样从本地文件系统加载XSL def transformXml(xml_content) xsl = file(os.path.join(os.path.split(__file__)[0], 'filename.xslt'),'rb').read() xs
XSLTParseError: Cannot resolve URI http://...
即使它在开发中起作用
我像这样从本地文件系统加载XSL
def transformXml(xml_content)
xsl = file(os.path.join(os.path.split(__file__)[0], 'filename.xslt'),'rb').read()
xslt_root = etree.XML(xsl)
transform = etree.XSLT(xslt_root)
return unicode(transform(xml_content))
<xsl:include href="http://../name1.xslt"/>
<xsl:include href="http://../name2.xslt"/>
<xsl:include href="http://../name3.xslt"/>
xsl文件包含一些外部xsl文件,这些文件可以像下面这样在线使用
def transformXml(xml_content)
xsl = file(os.path.join(os.path.split(__file__)[0], 'filename.xslt'),'rb').read()
xslt_root = etree.XML(xsl)
transform = etree.XSLT(xslt_root)
return unicode(transform(xml_content))
<xsl:include href="http://../name1.xslt"/>
<xsl:include href="http://../name2.xslt"/>
<xsl:include href="http://../name3.xslt"/>
请为上下文显示更多代码。另外:您从本地文件系统获取外部样式表的确切位置?外部xsl文件可在线下载,将包含的样式表下载到Python脚本所在的目录中。然后,将href
路径更改为本地路径。让我知道这是否有效。我无法让它发挥作用。目前,我在openshift中创建了一个WS,它可以进行我需要的转换,并从中获得结果。我会继续努力使它在appengine中发挥作用