I have the following code in the xsl file

Code:
<IMG name="logo" border="1" vspace="20" hspace="50">
  <xsl:attribute name="src">
	<xsl:value-of select="@fname"/>
  </xsl:attribute>

  <xsl:attribute name="width"> 
	<xsl:value-of select="imagesize/@width"/>
  </xsl:attribute>

  <xsl:attribute name="height">
	<xsl:value-of select="imagesize/@height"/>
  </xsl:attribute>

  <xsl:attribute name="alt">
	<xsl:value-of select="title"/>
  </xsl:attribute>
</IMG>
and want to be able to test for the value of width and change both the value of width and height if the test is meet. I have tried the following

Code:
<IMG name="logo" border="1" vspace="20" hspace="50">
  <xsl:attribute name="src">
	<xsl:value-of select="@fname"/>
  </xsl:attribute>

<xsl:if test="420 > imagesize/@width">
 	  <pwidth>420</pwidth>
 	  <pheight>560/pheight>
</xsl:if>

  <xsl:attribute name="width"> 
	<xsl:value-of select="pwidth"/>
  </xsl:attribute>

  <xsl:attribute name="height">
	<xsl:value-of select="pheight"/>
  </xsl:attribute>

  <xsl:attribute name="alt">
	<xsl:value-of select="title"/>
  </xsl:attribute>
</IMG>
I was not sure how to replace the existing values of width and height so tried to create new variables.

Can anyone help please?