
\setupcolors[state=start]

\starttext

\startXML
      <xsl:for-each select="PRIMITIVE[@type='CIRC']">
	<xsl:choose>
	  <xsl:when test="boolean(PROPERTIES/ATTR[@name='RATI'])">
	    <xsl:variable name="ratio" select="PROPERTIES/ATTR[@name='RATI']"/>
	    <ellipse>
	      <xsl:attribute name="rx">
		<xsl:value-of select="PROPERTIES/ATTR[@name='RADI']"/>
	      </xsl:attribute>
	      <xsl:attribute name="ry">
		<xsl:value-of select="PROPERTIES/ATTR[@name='RADI']*$ratio"/>
	      </xsl:attribute>
	      <xsl:attribute name="cx">
		<xsl:value-of select="PROPERTIES/ATTR[@name='POSN']/X"/>
	      </xsl:attribute>
	      <xsl:attribute name="cy">
		<xsl:value-of select="PROPERTIES/ATTR[@name='POSN']/Y"/>
	      </xsl:attribute>
	      <xsl:attribute name="stroke">
		<xsl:text>black</xsl:text>
	      </xsl:attribute>
	      <xsl:attribute name="stroke-width">
		<xsl:value-of select="PROPERTIES/ATTR[@name='WIDT']"/>
	      </xsl:attribute>
	      <xsl:attribute name="fill">
		<xsl:text>none</xsl:text>
	      </xsl:attribute>
	    </ellipse>
	  </xsl:when>
	  <xsl:otherwise>
	    <circle>
	      <xsl:attribute name="r">
		<xsl:value-of select="PROPERTIES/ATTR[@name='RADI']"/>
	      </xsl:attribute>
	      <xsl:attribute name="cx">
		<xsl:value-of select="PROPERTIES/ATTR[@name='POSN']/X"/>
	      </xsl:attribute>
	      <xsl:attribute name="cy">
		<xsl:value-of select="PROPERTIES/ATTR[@name='POSN']/Y"/>
	      </xsl:attribute>
	      <xsl:attribute name="stroke">
		<xsl:text>black</xsl:text>
	      </xsl:attribute>
	      <xsl:attribute name="stroke-width">
		<xsl:value-of select="PROPERTIES/ATTR[@name='WIDT']"/>
	      </xsl:attribute>
	      <xsl:attribute name="fill">
		<xsl:text>none</xsl:text>
	      </xsl:attribute>
	    </circle>
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:for-each>

\stopXML

\input knuth

\stoptext
