joerg 2003/11/18 10:08:55
Added: tools/src gump2blocks.properties.xsl Log: initial import: generating blocks.properties from gump.xml Revision Changes Path 1.1 cocoon-2.1/tools/src/gump2blocks.properties.xsl Index: gump2blocks.properties.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:desc="description"> <xsl:output method="text"/> <xsl:key name="status" match="project[starts-with(@name, 'cocoon-block-')]" use="@status"/> <xsl:key name="dependency" match="project[starts-with(@name, 'cocoon-block-')]/depend[starts-with(@project, 'cocoon-block-')]" use="@project"/> <desc:descs> <desc:desc name="common"> #------------------------------------------------------------------------------# # Cocoon Blocks # #------------------------------------------------------------------------------# # Remove blocks from your cocoon distribution by uncommenting the # corresponding exclude property. # NOTE: Don't modify this file directly but make a copy named # 'local.blocks.properties' and modify that. The build system will override # these properties with the ones in the 'local.blocks.properties' file. # NOTE: "[dependency]" indicates blocks that are required by other blocks. # Disabling batik, for example, will result in a RuntimeException when using # fop. On the other hand some dependencies come only from the block samples. </desc:desc> <desc:desc name="stable"> # Stable blocks ---------------------------------------------------------------- # Stable blocks are those that can be considered ready for production and # will contain components and API that will remain stable and where # developers are committed to back compatibility. In short, stuff that you # can depend on. </desc:desc> <desc:desc name="unstable"> # Unstable blocks -------------------------------------------------------------- # Unstable blocks are currently under development and do not guarantee that the # contracts they expose (API, xml schema, properties, behavior) will remain # constant in time. Developers are not committed to back-compatibility just yet. # This doesn't necessarily mean the blocks implementation is unstable or # the code can't be trusted for production, but use with care and watch # its development as things might change over time before they are marked # stable. </desc:desc> <desc:desc name="deprecated"> # Deprecated blocks ------------------------------------------------------------ # Although some of these blocks may have been stable, they are now deprecated # in favour of other blocks and therefore are excluded by default from the build </desc:desc> </desc:descs> <xsl:template match="/module"> <xsl:message> There are 2 issues this transformation does not handle at the moment: - The order of the @status sections, i.e. stable, unstable, deprecated. It depends on the first occurence of a block of one particular section. - Default exclude of a specific block. If a block is broken at any time and should be excluded, it must be done by hand afterwards. So before committing the updated blocks.properties please make a cvs diff to see what has really changed. </xsl:message> <xsl:value-of select="document('')/xsl:stylesheet/desc:descs/desc:[EMAIL PROTECTED] = 'common']"/> <xsl:apply-templates select="project[starts-with(@name, 'cocoon-block-')] [count(. | key('status', @status)[1]) = 1]" mode="group"/> </xsl:template> <xsl:template match="project" mode="group"> <xsl:value-of select="document('')/xsl:stylesheet/desc:descs/desc:[EMAIL PROTECTED] = current()/@status]"/> <!-- unfortunately key('status', @status) does not work with sorting because of a bug in Xalan: 24583 --> <xsl:apply-templates select="../project[starts-with(@name, 'cocoon-block-')[EMAIL PROTECTED] = current()/@status]"> <xsl:sort select="@name"/> </xsl:apply-templates> </xsl:template> <xsl:template match="project"> <xsl:call-template name="dependency"> <xsl:with-param name="elements" select="depend[starts-with(@project, 'cocoon-block-')]"/> <xsl:with-param name="text" select="'depends on'"/> </xsl:call-template> <xsl:call-template name="dependency"> <xsl:with-param name="elements" select="key('dependency', @name)/.."/> <xsl:with-param name="text" select="'is needed by'"/> </xsl:call-template> <!-- TODO: make this configurable externally (dependent on @status or @name) --> <xsl:if test="@status != 'deprecated'">#</xsl:if> <xsl:text>exclude.block.</xsl:text> <xsl:value-of select="substring-after(@name, 'cocoon-block-')"/> <xsl:text>=true </xsl:text> </xsl:template> <xsl:template name="dependency"> <xsl:param name="elements" select="/.."/> <xsl:param name="text" select="''"/> <xsl:if test="$elements"> <xsl:text>#-----[dependency]: "</xsl:text> <xsl:value-of select="substring-after(@name, 'cocoon-block-')"/> <xsl:text>" </xsl:text> <xsl:value-of select="$text"/> <xsl:apply-templates select="$elements" mode="dependency"> <xsl:sort select="@name | @project"/> </xsl:apply-templates> </xsl:if> </xsl:template> <xsl:template match="project | depend" mode="dependency"> <xsl:text> "</xsl:text> <xsl:value-of select="substring-after(concat(@name, @project), 'cocoon-block-')"/> <xsl:text>"</xsl:text> <xsl:choose> <xsl:when test="position() = last()">. </xsl:when> <xsl:otherwise>,</xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>