View Single Post
Old 10-03-2012, 02:07 AM   PM User | #1
freddo99
New to the CF scene

 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
freddo99 is an unknown quantity at this point
Changing the value of a variable in the xsl

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 really just wanted to change the values of width and height but am not sure how to do this.

Can anyone help please?

Last edited by freddo99; 10-03-2012 at 02:22 AM..
freddo99 is offline   Reply With Quote