Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
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
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:20 AM.


Advertisement
Log in to turn off these ads.