You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by James Cummings <Ja...@ota.ahds.ac.uk> on 2003/12/17 17:19:06 UTC

including file into xslt output...

During the XSLT transformation, is there a fairly straightforward
way to include another file into my XSL?  The transformation
produces a complete HTML file, so I don't want to get into
aggregation or anything that complex.

Let's say my sitemap has:

<map:match pattern="foo/*">
   <map:generate src="foo-files/{1}.xml"/>
   <map:transform type="xalan" src="style/xsl/foo.xsl">
   <map:parameter name="use-request-parameters" value="true"/>
   </map:transform>
   <map:serialize type="html"/>
</map:match>

and foo.xsl includes a template match like:

<xsl:template match="whatever">
<html>
<head><title>boring poor-formed html header</title></head>
<body>
<div class="header">
<!-- Want to insert contents of bar.xml here -->
</div>
<div class="main">
<xsl:apply-templates/>
</div>
</body>
</html>
</xsl:template>


xsl:import and xsl:include are meant to be top-level elements
for merging stylesheets...so aren't the right thing....

Any better suggestions?

-James

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: including file into xslt output...

Posted by Tony Collen <co...@umn.edu>.
James Cummings wrote:
> During the XSLT transformation, is there a fairly straightforward
> way to include another file into my XSL?  The transformation
> produces a complete HTML file, so I don't want to get into
> aggregation or anything that complex.

<snip/>

> xsl:import and xsl:include are meant to be top-level elements
> for merging stylesheets...so aren't the right thing....
> 
> Any better suggestions?


James,

I would suggest using the cinclude transformer after your XSLT. Simply have your XSLT insert the 
ci:include elements for the documents you wish to include, and then add <map:transform 
type="cinclude"/> after your transformer.  XSLT has the document() function, but that's not recommended.

> -James

Regards,

Tony



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org