Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •