M
marty.gagnon
I have a xsl file that references a xml file using the document()
function.
I'm having trouble specifying the URI in the document() function of a
xls stylesheet.
I'm using java to transform the stylesheet, and when it evaluates the
document() function, it cannot find the specified file.
This is how I reference the xml file I'm having trouble with
<xsl:value-of select="document('glcodes.xml',//)/glcodes/code"/>
I'm using JRun as the web server and I get the following error
SystemId Unknown; Line 1; Column -1; Can not load requested doc:
C:\JRun4\bin\glcodes.xml (The system cannot find the file specified)
I may understand what is going on. The document() function loads the
file (in this case "glcodes.xml") relative to the xml file used when
the xsl file is transformed. So in my below code, the "xmlSource" is
loaded into memory and used. I guess since JRun is doing the
transformation in memory the relative path is starting at the location
where the Xalan processor has this file in memory which would be
...\JRun4\bin. The question is, how do I modify the URI in the
document() fuction so it's relative to where the xml file is loaded
from.
javax.xml.transform.Transformer transformer =
tFactory.newTransformer(xslSS);
ByteArrayInputStream baais = new
ByteArrayInputStream(xmlByteArray);
BufferedInputStream biis = new BufferedInputStream(baais);
StreamSource xmlSource = new StreamSource(biis);
transformer.transform(xmlSource, result);
Thanks
Marty
function.
I'm having trouble specifying the URI in the document() function of a
xls stylesheet.
I'm using java to transform the stylesheet, and when it evaluates the
document() function, it cannot find the specified file.
This is how I reference the xml file I'm having trouble with
<xsl:value-of select="document('glcodes.xml',//)/glcodes/code"/>
I'm using JRun as the web server and I get the following error
SystemId Unknown; Line 1; Column -1; Can not load requested doc:
C:\JRun4\bin\glcodes.xml (The system cannot find the file specified)
I may understand what is going on. The document() function loads the
file (in this case "glcodes.xml") relative to the xml file used when
the xsl file is transformed. So in my below code, the "xmlSource" is
loaded into memory and used. I guess since JRun is doing the
transformation in memory the relative path is starting at the location
where the Xalan processor has this file in memory which would be
...\JRun4\bin. The question is, how do I modify the URI in the
document() fuction so it's relative to where the xml file is loaded
from.
javax.xml.transform.Transformer transformer =
tFactory.newTransformer(xslSS);
ByteArrayInputStream baais = new
ByteArrayInputStream(xmlByteArray);
BufferedInputStream biis = new BufferedInputStream(baais);
StreamSource xmlSource = new StreamSource(biis);
transformer.transform(xmlSource, result);
Thanks
Marty