You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Simeon Walker <si...@bangor.ac.uk> on 2002/01/11 11:19:08 UTC

Namespace in DirectoryGenerator elements

Hi,
    I'm trying to use the directory generator in Cocoon 2 but the
elements are created with the namespace URI as the prefix, i.e.
'http://apache.org/cocoon/2.0/directory' instead of 'dir'.

Here's the bit of my sitemap where the generator is setup:

     <map:generator  name="directory"
       src="org.apache.cocoon.generation.DirectoryGenerator" label="content"/>

which is just like the distributed sitemap.

Later on this bit calls a filter on the elements from the generator:

	<map:match pattern="teaching/module/*/materials.xml">
		<map:generate type="directory"
		              src="docs/teaching/module/materials/"/>
		<map:transform src="stylesheets/filters/directory.xsl">
			<map:parameter name="module" value="{1}"/>
		</map:transform>
		<map:serialize type="xml"/>
	</map:match>

The filter contains the following:

	<?xml version="1.0"?>
		<xsl:stylesheet
			version="1.0"
			xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
			xmlns:dir="http://apache.org/cocoon/2.0/directory">

		<xsl:param name="module"/>
		<xsl:template match="/">
			<xsl:for-each select="*">
				<title>
					<xsl:value-of select="name(.)"/>
					<xsl:value-of select="@name"/>
				</title>
			</xsl:for-each>
		</xsl:template>
	</xsl:stylesheet>

I may then output xml to the browser to avoid any further xslt
processing or use the simple-xml2html.xsl stylesheet provided
with cocoon. Either way I get directory elements with the namespace
URI instead of the prefix.

Since no one else has mentioned this I guess I must be doing
something wrong, but I can't find it.. Any suggestions will be
appreciated.

Regards,
Simeon

-- 
Simeon Walker,                      email: simeon@sbs.bangor.ac.uk
School of Biological Sciences,      phone: +44 (0)1248 383702
University of Wales, Bangor,        fax: +44 (0)1248 382569
Gwynedd, LL57 2UW, UK.              www: http://biology.bangor.ac.uk/



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