freddo99 0 Posted January 8, 2013 Report Share Posted January 8, 2013 (edited) 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 January 8, 2013 by freddo99 Quote Link to post Share on other sites
mshoulson 0 Posted January 29, 2013 Report Share Posted January 29, 2013 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.