xml - Opening a document outside a jar in xsl -


i have xsl file in jar. have xml file named language.xml located next jar.

in xsl, want load xml document. how trying achieve this:

<xsl:variable name="strs" select="document('../language.xml')/languagefile/strings"/> 

but xml file never loaded. possible have 1 file in jar , other outside or must both inside/outside jar ??

the call document function attempts resolve uri reference ../language.xml relative uri of stylesheet itself. if stylesheet in jar file, stylesheet uri of form jar:file:/path/to/your.jar!/stylesheet.xsl.

you cannot reference jar file or directory such uri resolving relative reference; need programmatically.

probably easiest way refer xml file use file uri instead.

if know full path of file:

document('file:/path/to/language.xml') 

alternatively, if full path not known , fixed can control current working directory, reference file relative current working directory:

document('file:language.xml') 

Comments