Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 在WebLogic中使用相对路径调用xslt document()函数_Xml_Weblogic_Xslt - Fatal编程技术网

Xml 在WebLogic中使用相对路径调用xslt document()函数

Xml 在WebLogic中使用相对路径调用xslt document()函数,xml,weblogic,xslt,Xml,Weblogic,Xslt,在XSL样式表中,我尝试使用document()函数和XML文件的相对路径。我试图加载的XML文件与样式表位于同一文件夹中。后端中的代码正在使用transformer调用XSLT Java代码 TransformerFactory tFactory = TransformerFactory.newInstance(); InputStream inXSL = getClass().getResourceAsStream("/input.xsl"); Transformer

在XSL样式表中,我尝试使用document()函数和XML文件的相对路径。我试图加载的XML文件与样式表位于同一文件夹中。后端中的代码正在使用transformer调用XSLT

Java代码

    TransformerFactory tFactory = TransformerFactory.newInstance();
    InputStream inXSL = getClass().getResourceAsStream("/input.xsl");
    Transformer transformer = tFactory.newTransformer(new StreamSource(inXSL));
    transformer.transform(new StreamSource(inXMLStream), new StreamResult(outStream));
XSL


但是由于某种原因,它似乎没有加载文件,它给出了以下错误:, FODC0005:java.io.FileNotFoundException:D:\Applications\weblogic\u domain\config.xml
XSL似乎在寻找WebLogic域文件夹中的文件,而不是web应用程序路径

因为您提供了StreamSource并且没有设置systemId,所以XSLT处理器不知道样式表是从哪里加载的,所以它无法智能地解析相对URI。使用StreamSource上的setSystemId()方法为样式表设置基本URI

    <xsl:variable name="configXml" select="document('config.xml')" />