<xsl:template match="*[contains(@class,' ut-d/imagemap ')]" name="topic.ut-d.imagemap">
<xsl:variable name="flagrules">
<xsl:call-template name="getrules"/>
</xsl:variable>
<div>
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="gen-style">
<xsl:with-param name="flagrules" select="$flagrules"/>
</xsl:call-template>
<xsl:call-template name="setidaname"/>
<xsl:call-template name="start-flagit">
<xsl:with-param name="flagrules" select="$flagrules"/>
</xsl:call-template>
<xsl:call-template name="start-revflag">
<xsl:with-param name="flagrules" select="$flagrules"/>
</xsl:call-template>
<!-- the image -->
<xsl:element name="img">
<xsl:attribute name="usemap">#<xsl:value-of select="generate-id(.)"/></xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
<!-- Process the 'normal' image attributes, using this special mode -->
<xsl:apply-templates select="*[contains(@class,' topic/image ')]" mode="imagemap-image"/>
</xsl:element>
<xsl:value-of select="$newline"/>
<map name="{generate-id(.)}" id="{generate-id(.)}">
<xsl:for-each select="*[contains(@class,' ut-d/area ')]">
<xsl:value-of select="$newline"/>
<xsl:element name="area">
<!-- if no xref/@href - error -->
<xsl:choose>
<xsl:when test="*[contains(@class,' topic/xref ')]/@href">
<!-- special call to have the XREF/@HREF processor do the work -->
<xsl:apply-templates select="*[contains(@class, ' topic/xref ')]" mode="imagemap-xref"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="output-message">
<xsl:with-param name="msgnum">044</xsl:with-param>
<xsl:with-param name="msgsev">E</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- create ALT text from XREF content-->
<!-- if no XREF content, use @HREF, & put out a warning -->
<xsl:choose>
<xsl:when test="*[contains(@class, ' topic/xref ')]">
<xsl:variable name="alttext">
<xsl:apply-templates select="*[contains(@class, ' topic/xref ')]" mode="text-only"/>
</xsl:variable>
<xsl:attribute name="alt">
<xsl:value-of select="normalize-space($alttext)"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="normalize-space($alttext)"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="output-message">
<xsl:with-param name="msgnum">045</xsl:with-param>
<xsl:with-param name="msgsev">W</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- if not valid shape (blank, rect, circle, poly); Warning, pass thru the value -->
<xsl:variable name="shapeval">
<xsl:value-of select="*[contains(@class,' ut-d/shape ')]"/>
</xsl:variable>
<xsl:attribute name="shape">
<xsl:value-of select="$shapeval"/>
</xsl:attribute>
<xsl:variable name="shapetest">
<xsl:value-of select="concat('-',$shapeval,'-')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains('--rect-circle-poly-default-',$shapetest)"/>
<xsl:otherwise>
<xsl:call-template name="output-message">
<xsl:with-param name="msgnum">046</xsl:with-param>
<xsl:with-param name="msgsev">W</xsl:with-param>
<xsl:with-param name="msgparams">%1=<xsl:value-of select="$shapeval"/></xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- if no coords & shape<>'default'; Warning, pass thru the value -->
<xsl:variable name="coordval">
<xsl:value-of select="*[contains(@class,' ut-d/coords ')]"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($coordval)>0 and not($shapeval='default')">
<xsl:attribute name="coords">
<xsl:value-of select="$coordval"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="output-message">
<xsl:with-param name="msgnum">047</xsl:with-param>
<xsl:with-param name="msgsev">W</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:for-each>
<xsl:value-of select="$newline"/>
</map>
<xsl:call-template name="end-revflag">
<xsl:with-param name="flagrules" select="$flagrules"/>
</xsl:call-template>
<xsl:call-template name="end-flagit">
<xsl:with-param name="flagrules" select="$flagrules"/>
</xsl:call-template>
</div>
</xsl:template> |