Jump to content

Changing the value of a variable in an xsl file


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...