[ http://issues.apache.org/jira/browse/XALANJ-738?page=all ]
Brian Minchau updated XALANJ-738:
---------------------------------
Version: 2.2.0
(was: Latest Development Code)
> Problem with setInclude() and a 'ghost' template
> ------------------------------------------------
>
> Key: XALANJ-738
> URL: http://issues.apache.org/jira/browse/XALANJ-738
> Project: XalanJ2
> Type: Bug
> Components: Xalan-interpretive, parse-or-compile
> Versions: 2.2.0
> Environment: Operating System: Windows NT/2K
> Platform: PC
> Reporter: Filippo Munafò
> Assignee: Xalan Developers Mailing List
> Attachments: ElemCallTemplate.patch
>
> I have the following two xsl's
> ----------------------
> xsl1.xsl:
> ----------------------
> <xsl:template match="/">
> <xsl:call-template name="main">
> <xsl:with-param name="title">This is a title</xsl:with-param>
> </xsl:call-template>
> </xsl:template>
> <xsl:template name="body">
> Hello world!
> </xsl:template>
> ---------------------------
> ---------------------------
> xsl2.xsl
> ---------------------------
> <xsl:template name="main">
> <xsl:param name="title"/>
> <html>
> <head>
> <title>
> <xsl:value-of select="$title"/>
> </title>
> </head>
> <body>
> <xsl:call-template name="body"/>
> </body>
> </html>
> </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 the transformer doesn't see the template named 'body'?
> I need this kind of dynamic inclusion.
> Filippo Munafò
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]