DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9449>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9449

Stylesheet included using setInclude can't see other templates





------- Additional Comments From [EMAIL PROTECTED]  2002-05-30 21:54 -------
Actually this is a clearer way of phrasing the same problem, courtesy of 
another user who posted this on comp.text.xml about 6 months ago.
-----------

I have the following two xsl's:
----------------------
xsl1.xsl
----------------------
<xsl:template match="/">
        <xsl:call-template name="main"/>
</xsl:template>

<xsl:template name="body">
        Hello world!
</xsl:template>
---------------------------

---------------------------
xsl2.xsl
---------------------------
<xsl:template name="main">
        <xsl:call-template name="body"/>
</xsl:template>
--------------------------------------------------

I'd like to include xsl2.xsl in xsl1.xsl using this code:

-------------------------------------------------------
TransformerFactory tf = TransformerFactory.newInstance();

Source xsl1 = new StreamSource(new FileReader(new File("xsl1.xsl")));
Source xsl2 = new StreamSource(new FileReader(new File("xsl2.xsl")));

StylesheetRoot sheet1 = (StylesheetRoot)tf.newTemplates(xsl1);
StylesheetRoot sheet2 = (StylesheetRoot)tf.newTemplates(xsl2);

sheet1.setInclude(sheet2);
sheet1.recompose();

Transformer tr = sheet1.newTransformer();
tr.transform(xml, result);
---------------------------------------------------------

When I execute this code I get:

javax.xml.transform.TransformerException: could not find template
named: body

Everything is ok if I have a static include in xsl1.xsl like this
(using just one template or directly a transformer):

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

Why doesn't the transformer see the template named 'body'?

Reply via email to