freddo99 Posted January 8, 2013 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 Link to comment Share on other sites More sharing options...
mshoulson Posted January 29, 2013 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now