Jump to content

Changing the value of a variable in an xsl file


freddo99

Recommended Posts

I have the following code in the xsl file

<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="[email="imagesize/@width"]imagesize/@height"/[/email]>  </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 which does not work.

<IMG name="logo" border="1" vspace="20" hspace="50">  <xsl:attribute name="src"><xsl:value-of select="@fname"/>  </xsl:attribute><xsl:if test="420 > [email="imagesize/@width"]imagesize/@width[/email]">	<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 but really just change the original values of width and height if the IF test condition is meet. Can anyone help please?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...