<map name="{$mapname}">
<xsl:for-each select="../../areaspec//area">
- <xsl:variable name="units">
- <xsl:choose>
- <xsl:when test="@units">
- <xsl:value-of select="@units"/>
- </xsl:when>
- <xsl:when test="../@units">
- <xsl:value-of select="../@units"/>
- </xsl:when>
- <xsl:otherwise>calspair</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$units = 'calspair'">
- <xsl:variable name="coords" select="normalize-space(@coords)"/>
- <xsl:variable name="p1"
- select="substring-before($coords, ' ')"/>
- <xsl:variable name="p2"
- select="substring-after($coords, ' ')"/>
-
- <xsl:variable name="x1" select="substring-before($p1,',')"/>
- <xsl:variable name="y1" select="substring-after($p1,',')"/>
- <xsl:variable name="x2" select="substring-before($p2,',')"/>
- <xsl:variable name="y2" select="substring-after($p2,',')"/>
-
- <xsl:variable name="x1p" select="$x1 div 100.0"/>
- <xsl:variable name="y1p" select="$y1 div 100.0"/>
- <xsl:variable name="x2p" select="$x2 div 100.0"/>
- <xsl:variable name="y2p" select="$y2 div 100.0"/>
-
-<!--
- <xsl:message>
- <xsl:text>units: </xsl:text>
- <xsl:value-of select="$units"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$x1p"/><xsl:text>, </xsl:text>
- <xsl:value-of select="$y1p"/><xsl:text>, </xsl:text>
- <xsl:value-of select="$x2p"/><xsl:text>, </xsl:text>
- <xsl:value-of select="$y2p"/><xsl:text>, </xsl:text>
- </xsl:message>
-
- <xsl:message>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$intrinsicwidth"/>
- <xsl:text>, </xsl:text>
- <xsl:value-of select="$intrinsicdepth"/>
- </xsl:message>
-
- <xsl:message>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$units"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="round($x1p * $intrinsicwidth div 100.0)"/>
- <xsl:text>,</xsl:text>
- <xsl:value-of select="round($intrinsicdepth
- - ($y2p * $intrinsicdepth div 100.0))"/>
- <xsl:text>,</xsl:text>
- <xsl:value-of select="round($x2p * $intrinsicwidth div 100.0)"/>
- <xsl:text>,</xsl:text>
- <xsl:value-of select="round($intrinsicdepth
- - ($y1p * $intrinsicdepth div 100.0))"/>
- </xsl:message>
--->
+ <xsl:variable name="units">
+ <xsl:choose>
+ <xsl:when test="@units = 'other' and @otherunits">
+ <xsl:value-of select="@otherunits"/>
+ </xsl:when>
+ <xsl:when test="@units">
+ <xsl:value-of select="@units"/>
+ </xsl:when>
+ <!-- areaspec|areaset/area -->
+ <xsl:when test="../@units = 'other' and ../@otherunits">
+ <xsl:value-of select="../@otherunits"/>
+ </xsl:when>
+ <xsl:when test="../@units">
+ <xsl:value-of select="../@units"/>
+ </xsl:when>
+ <!-- areaspec/areaset/area -->
+ <xsl:when test="../../@units = 'other' and ../../@otherunits">
+ <xsl:value-of select="../@otherunits"/>
+ </xsl:when>
+ <xsl:when test="../../@units">
+ <xsl:value-of select="../../@units"/>
+ </xsl:when>
+ <xsl:otherwise>calspair</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$units = 'calspair' or
+ $units = 'imagemap'">
+ <xsl:variable name="coords" select="normalize-space(@coords)"/>
- <area shape="rect">
- <xsl:variable name="linkends">
- <xsl:choose>
- <xsl:when test="@linkends">
- <xsl:value-of select="normalize-space(@linkends)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="normalize-space(../@linkends)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="href">
- <xsl:choose>
- <xsl:when test="@xlink:href">
- <xsl:value-of select="@xlink:href"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="../@xlink:href"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$linkends != ''">
- <xsl:variable name="linkend">
- <xsl:choose>
- <xsl:when test="contains($linkends, ' ')">
- <xsl:value-of select="substring-before($linkends, ' ')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$linkends"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
+ <area shape="rect">
+ <xsl:variable name="linkends">
+ <xsl:choose>
+ <xsl:when test="@linkends">
+ <xsl:value-of select="normalize-space(@linkends)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space(../@linkends)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="href">
+ <xsl:choose>
+ <xsl:when test="@xlink:href">
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../@xlink:href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$linkends != ''">
+ <xsl:variable name="linkend">
+ <xsl:choose>
+ <xsl:when test="contains($linkends, ' ')">
+ <xsl:value-of select="substring-before($linkends, ' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$linkends"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="target" select="key('id', $linkend)[1]"/>
- <xsl:variable name="target" select="key('id', $linkend)[1]"/>
-
- <xsl:if test="$target">
- <xsl:attribute name="href">
- <xsl:call-template name="href.target">
- <xsl:with-param name="object" select="$target"/>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:if>
- </xsl:when>
- <xsl:when test="$href != ''">
- <xsl:attribute name="href">
- <xsl:value-of select="$href"/>
- </xsl:attribute>
- </xsl:when>
- </xsl:choose>
-
- <xsl:if test="alt">
- <xsl:attribute name="alt">
- <xsl:value-of select="alt[1]"/>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:attribute name="coords">
- <xsl:value-of select="round($x1p * $intrinsicwidth div 100.0)"/>
- <xsl:text>,</xsl:text>
- <xsl:value-of select="round($intrinsicdepth
+ <xsl:if test="$target">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$target"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$href != ''">
+ <xsl:attribute name="href">
+ <xsl:value-of select="$href"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:if test="alt">
+ <xsl:attribute name="alt">
+ <xsl:value-of select="alt[1]"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:attribute name="coords">
+ <xsl:choose>
+ <xsl:when test="$units = 'calspair'">
+
+ <xsl:variable name="p1"
+ select="substring-before($coords, ' ')"/>
+ <xsl:variable name="p2"
+ select="substring-after($coords, ' ')"/>
+
+ <xsl:variable name="x1" select="substring-before($p1,',')"/>
+ <xsl:variable name="y1" select="substring-after($p1,',')"/>
+ <xsl:variable name="x2" select="substring-before($p2,',')"/>
+ <xsl:variable name="y2" select="substring-after($p2,',')"/>
+
+ <xsl:variable name="x1p" select="$x1 div 100.0"/>
+ <xsl:variable name="y1p" select="$y1 div 100.0"/>
+ <xsl:variable name="x2p" select="$x2 div 100.0"/>
+ <xsl:variable name="y2p" select="$y2 div 100.0"/>
+
+ <!--
+ <xsl:message>
+ <xsl:text>units: </xsl:text>
+ <xsl:value-of select="$units"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$x1p"/><xsl:text>, </xsl:text>
+ <xsl:value-of select="$y1p"/><xsl:text>, </xsl:text>
+ <xsl:value-of select="$x2p"/><xsl:text>, </xsl:text>
+ <xsl:value-of select="$y2p"/><xsl:text>, </xsl:text>
+ </xsl:message>
+
+ <xsl:message>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$intrinsicwidth"/>
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="$intrinsicdepth"/>
+ </xsl:message>
+
+ <xsl:message>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$units"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of
+ select="round($x1p * $intrinsicwidth div 100.0)"/>
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="round($intrinsicdepth
- ($y2p * $intrinsicdepth div 100.0))"/>
- <xsl:text>,</xsl:text>
- <xsl:value-of select="round($x2p * $intrinsicwidth div 100.0)"/>
- <xsl:text>,</xsl:text>
- <xsl:value-of select="round($intrinsicdepth
- - ($y1p * $intrinsicdepth div 100.0))"/>
- </xsl:attribute>
- </area>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>
- <xsl:text>Warning: only calspair supported </xsl:text>
- <xsl:text>in imageobjectco</xsl:text>
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="round($x2p *
+ $intrinsicwidth div 100.0)"/>
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="round($intrinsicdepth
+ - ($y1p * $intrinsicdepth div 100.0))"/>
+ </xsl:message>
+ -->
+ <xsl:value-of
+ select="round($x1p * $intrinsicwidth div 100.0)"/>
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="round($intrinsicdepth
+ - ($y2p * $intrinsicdepth div 100.0))"/>
+ <xsl:text>,</xsl:text>
+ <xsl:value-of
+ select="round($x2p * $intrinsicwidth div 100.0)"/>
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="round($intrinsicdepth
+ - ($y1p * $intrinsicdepth div 100.0))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$coords"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </area>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>Warning: only calspair or </xsl:text>
+ <xsl:text>otherunits='imagemap' supported </xsl:text>
+ <xsl:text>in imageobjectco</xsl:text>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:for-each>
</map>
</xsl:if>