Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Correct use of Choose in xsl - new to xml

4:19 am on Jan 8, 2013 (gmt 0)

New User

10+ Year Member

joined:Feb 9, 2005
posts: 9
votes: 0

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:when test="350 &gt; 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:attribute name="width"><xsl:value-of select="imagesize/@width"/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of select="imagesize/@height"/></xsl:attribute>

I have also tried

<xsl:when test="350 &gt; <xsl:value-of select=<xsl:value-of-select='imagesize/@width'/>">

Can someone please help?
1:57 pm on Jan 16, 2013 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
votes: 0

the syntax in the second example (using choose and when) looks correct to me.

Do you have an XSLT execution tool? It might tell you where the problem is or possibly offer a helpful error message.
7:11 pm on Jan 16, 2013 (gmt 0)

New User

10+ Year Member

joined:Aug 16, 2004
votes: 0

Thanks httpwebwitch

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members