tags:

views:

78

answers:

1

I have a bit of JSP that does this:

<c:import url="/xsl/Transformer.xsl" var="xslt" />
<x:transform doc="${actionBean.dom}" xslt="${xslt}" xsltSystemId="/xsl/">

This transforms the XML exactly as expected so long as Transformer.xsl contains no <xsl:include> tags or so long as any documents it does include do not include anything.

However, if I use an XSL which includes a document which in turn includes another document, I get the following error:

ERROR:  'Invalid URI 'NestedInclude.xsl
Could not resolve entity reference: "NestedInclude.xsl"'.'

Note that the JSP is contained in the directory below the xsl documents. If all my XSLs and JSPs are in the same directory (and I remove the xsltSystemId attribute) then everything would work fine, but I don't really want to do this.

Can anyone see anything I'm doing wrong, as it's a bit of a killer at the moment and the JSTL documentation is next to useless.

A: 

If you provide a value for the xsltSystemId attribute that starts with "/", I believe JSTL will use an EntityResolver that attempts to locate: PageContext.getServletContext().getResourceAsStream(xsltSystemId). So, you might try either xsltSystemId="/xsl/Transformer.xsl", or just leave out the attribute.

kschneid