Newer
Older
XML / modules / obsolete.xml
<?xml version="1.0" encoding="utf-8"?>

<!--
	Any obsolete items for which we want to display an appropriate error message (e.g., to point authors to the correct way to do things). This is pretty much a grab bag of all sorts of random stuff mixed together.
	
	Note that we want the error messages to be generated regardless of the output format, so all code is common to all formats.
-->

<stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


	<!--
		A utility template to parameterise error messages for obsolete items.
		
		$obsolete-item: A string describing the obsolete item(s).
		
		$new-item: A string describing the item(s) that replace the obsolete ones.
	-->
	<template name="generate-obsolete-error">
		<common>
			<xsl:param name="obsolete-item" />
			<xsl:param name="new-item" />
			
			<xsl:message terminate="yes">
				<xsl:text>Use of OBSOLETE </xsl:text>
				<xsl:value-of select="$obsolete-item" />
				<xsl:text>. Please use </xsl:text>
				<xsl:value-of select="$new-item" />
				<xsl:text> instead.</xsl:text>
			</xsl:message>
		</common>
	</template>
	
	
	<!-- Generate a LaTeX \input{} macro. Replaced by the more general "include-document" template. -->
	<template name="latex-input" match="latex-input">
		<common>
			<xsl:call-template name="generate-obsolete-error">
				<xsl:with-param name="obsolete-item">
					<xsl:text>element "</xsl:text>
					<xsl:value-of select="node-name(.)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="new-item">
					<xsl:text>"include-document"</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</common>
	</template>
	
	
	<!-- Document metadata. Moved to attributes of the top-level document element. -->
	<template name="metadata" match="metadata">
		<common>
			<xsl:call-template name="generate-obsolete-error">
				<xsl:with-param name="obsolete-item">
					<xsl:text>element "</xsl:text>
					<xsl:value-of select="node-name(.)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="new-item">
					<xsl:text>attributes of the top-level "document" element</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</common>
	</template>


	<!-- Label/id elements for figures. Moved to the @label attribute of figure/table. -->
	<template match="figure/id|table/id|figure/label|table/label">
		<common>
			<xsl:call-template name="generate-obsolete-error">
				<xsl:with-param name="obsolete-item">
					<xsl:text>element "</xsl:text>
					<xsl:value-of select="node-name(.)" />
					<xsl:text>" inside "</xsl:text>
					<xsl:value-of select="node-name(..)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="new-item">
					<xsl:text>the @label attribute of "</xsl:text>
					<xsl:value-of select="node-name(..)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</common>
	</template>
	
	
	<!-- Scaling of images for LaTeX using "latex-scaling". Subsumed by the @latex-options attribute of "image". -->
	<template match="image/latex-scaling">
		<common>
			<xsl:call-template name="generate-obsolete-error">
				<xsl:with-param name="obsolete-item">
					<xsl:text>element "</xsl:text>
					<xsl:value-of select="node-name(.)" />
					<xsl:text>" inside "</xsl:text>
					<xsl:value-of select="node-name(..)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="new-item">
					<xsl:text>the @latex-options attribute of "</xsl:text>
					<xsl:value-of select="node-name(..)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</common>
	</template>
	
	
	<!-- Various obsolete elements inside images. Replaced by attributes of the same name within "image". -->
	<template match="image/basename|image/format">
		<common>
			<xsl:call-template name="generate-obsolete-error">
				<xsl:with-param name="obsolete-item">
					<xsl:text>element "</xsl:text>
					<xsl:value-of select="node-name(.)" />
					<xsl:text>" inside "</xsl:text>
					<xsl:value-of select="node-name(..)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="new-item">
					<xsl:text>the @</xsl:text>
					<xsl:value-of select="node-name(.)" />
					<xsl:text> attribute of "</xsl:text>
					<xsl:value-of select="node-name(..)" />
					<xsl:text>"</xsl:text>
				</xsl:with-param>
			</xsl:call-template>
		</common>
	</template>
	
	
</stylesheet>