Reputation: 546
I have one XSLT file including other two xml files to generate html page, like below
<xsl:include href="xsltcache://UtilityTemplates.xml" />
<xsl:include href="xsltcache://eCertSpecificTemplates.xml" />
I do not know how to add multiple xsl sources (three files in this case) to transformer,
Source xslSource = new StreamSource(xslFile);
Transformer trasformToXml=tFactory.newTransformer(xslSource);
Upvotes: 1
Views: 769
Reputation: 163262
You are using a very specialized form of URI in the xsl:include directives, these look as if they were designed to be handled by custom URI dereferencing logic, perhaps an OASIS catalog.
The bog-standard way to do this would be to use relative URIs in the xsl:include
(for example <xsl:include href="UtilityTemplates.xsl"/>
, to put all three files in the same directory, and then to make sure that the base URI of the main file is known (which it will be if xslFile
is a File
object).
If there's some special magic to the "xsltcache" URIs then you need to find out what it is. But if you don't want to change the source, you can set a URIResolver
on the TransformerFactory
. The URIResolver
will be called when an xsl:include
declaration is encountered, and it can do anything it likes to convert the supplied URI to a Source
object containing the included module.
Upvotes: 2