You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Evgeniy Strokin <ev...@yahoo.com> on 2002/03/19 21:54:25 UTC

inserting result of transformation into other transformation

Hi,

I�m not sure it�s possible, but maybe it is:

I have XSL:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java">

                <xsl:import href="../head.xsl"/>

                <xsl:import href="../header.xsl"/>

                <xsl:template match="/">

                                <html>

<xsl:call-template name="head"/>

                                                <body>

                                                                <xsl:call-template name="header">

                                                                                <xsl:with-param name="message">Test Page</xsl:with-param>

                                                                                <xsl:with-param name="mlns_page" select="$mlns_page"/>

                                                                </xsl:call-template>

!!!!!!!!!

!!! Here I need insert HTML, which comes from another XSL transformation (it use different XSL file and XML file too). Is it possible to do that?

!!!!!!!!!

                                                                <p>test</p>

                                                </body>

                                </html>

                </xsl:template>

</xsl:stylesheet>

 

Thanks,

Jenya



---------------------------------
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage

Re: inserting result of transformation into other transformation

Posted by "Frank E. Weiss" <fr...@well.com>.
The easiest way to do it would be to perform the inner transformation separately. Use xsl:output method="xml" and save
the first transformation to a file named first.xml. Then in the second transformation use

<xsl:copy-of select="document('first.xml')/*"/>

to insert the result of the first transformation. There are currently no Xalan functions, as far as I know, that are
like document() but also perform a transformation. It would be fairly simple to write an extension function for that
purpose, but you might run into some interesting problems nesting a transformation.

It may also be possible to do this in one tranformation. You'd use both stylesheets by using <xsl:include/> and then use
<xsl:apply-templates select="document('input1.xml')"/>. The trick here is to avoid name collisions between the two
stylesheets by using appropriate namespaces and force the input1.xml document's elements to only match the correct
stylesheet templates. I'm thinking that's what namespaces are for, but I haven't tried this particular solution. Good
Luck!