Jump to content

Newbee - testing with CHOOSE


freddo99
 Share

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 comment
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 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
 Share

×
×
  • Create New...