Jump to content

Newbee - testing with CHOOSE

Recommended Posts

I have an xsl file with the following two lines "<xsl:attribute name="width"><xsl:value-of select="imagesize/@width"/></xsl:attribute>" "<xsl:attribute name="height"><xsl:value-of select="imagesize/@height"/></xsl:attribute>" I want to test for the value of imagesize/@width and set the values of width and height if the test condition is meet. I have tried the following without success <xsl:choose> <xsl:when test="350 > imagesize/@width"> <xsl:attribute name="width"><xsl:value-of select="420"/></xsl:attribute> <xsl:attribute name="height"><xsl:value-of select="560"/></xsl:attribute> </xsl:when> <xsl:otherwise> <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:otherwise></xsl:choose> I have also tried <xsl:when test="350 > <xsl:value-of select=<xsl:value-of-select='imagesize/@width'/>"> Can someone please help?

Edited by freddo99
Link to post
Share on other sites
  • 3 weeks later...

When I tried these, they worked as written--but only when I had the selector right. My document consisted only of the <imagesize> element, and my template matched "/imagesize", and things worked when I specified "/imagesize/@width" or else just "@width". I don't know if that's your problem, not seeing the rest of the document and all, but you might want to confirm that the right stuff is being selected (e.g. do it without the xsl:if and confirm rule out unrelated problems.

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.

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.

  • Create New...