Vadim Gritsenko wrote:
>>But - hopefully - we have other solution: X/Cinclude mechanism
>>which is perfectly suitable in this case:
>>
>><map:match pattern="documents_pdf/documentation.pdf">
>> <map:generate type="directory" src="docs/xdocs"/>
>> <map:transform src="filter-xml-files.xsl"/>
>> <map:transform src="xml-file-to-xinclude.xsl"/>
>> <map:transform type="xinclude"/>
>> <!-- here you have all xdocs in one stream -->
>> ....
>></map:match>
>>
This way worked perfectly for aggregating XML news articles in a
directory subtree, I used
<map:match pattern="collection/news-overview.xml">
<map:generate type="directory" src="repository/news/current">
<map:parameter name="root" value="repository"/>
<map:parameter name="depth" value="2"/>
</map:generate>
<map:transform src="stylesheets/directory-to-xinclude.xsl"/>
<map:transform type="xinclude"/>
<map:serialize type="xml"/>
</map:match>
for generating a collection document containing all current news in the
repository which in turn can then be aggregated to the pages in need for
news. I attached the directory-to-xinclude.xsl I wrote; a drawback of
this solution is that the DirectoryGenerator does not provide caching of
its results.
Best regards,
Michael
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dir="http://apache.org/cocoon/directory/2.0" xmlns:xinclude="http://www.w3.org/1999/XML/xinclude" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="dir java">
<xsl:template match="/">
<news-collection>
<xsl:apply-templates/>
</news-collection>
</xsl:template>
<xsl:template match="dir:directory">
<!-- get the path parameter -->
<xsl:param name="path"/>
<!-- add @name attribute to path parameter -->
<xsl:variable name="addedPath"><xsl:value-of select="$path"/><xsl:value-of select="@name"/>/</xsl:variable>
<!-- pass path parameter on to all directory entries -->
<xsl:apply-templates select="dir:directory">
<xsl:with-param name="path"><xsl:value-of select="$addedPath"/></xsl:with-param>
</xsl:apply-templates>
<!-- pass path parameter on to all file entries -->
<xsl:apply-templates select="dir:file">
<xsl:with-param name="path"><xsl:value-of select="$addedPath"/></xsl:with-param>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="dir:file">
<!-- grab "path" parameter -->
<xsl:param name="path"/>
<!-- generate XInclude-statements -->
<xinclude:include parse="xml"><xsl:attribute name="href">file:<xsl:value-of select="$path"/><xsl:value-of select="@name"/></xsl:attribute></xinclude:include>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]