What paths shloud I use in xsl files in WEB-INF directory, when I use xsl:include

Viewed 27

I have my Java web app and 'index.xsl' file in my WEB-INF directory. I can read it in my .jsp file this way:

Source resource = new StreamSource(getServletContext().getResourceAsStream("WEB-INF/xslt/index.xsl"));

But there is a problem, if my 'index.xsl' contains this row:

<xsl:include href="/xslt/folder.xsl"/>

I don't know what should be there instead of '/xslt/folder.xsl'. I tried 'folder.xsl', '/folder.xsl' etc. and nothing worked (it said C:\xslt\folder.xsl doesn't exist or something like that). Can anyone help me? Or should all the xsl files be on a different place? Thank you very much

1 Answers

You have to use relative path against the directory of the XSLT file that does the include.

If folder.xsl is in the same folder as index.xsl:

<xsl:include href="./folder.xsl"/>

Related