homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

Correct use of Choose in xsl - new to xml

5+ Year Member

Msg#: 4534174 posted 4:19 am on Jan 8, 2013 (gmt 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?



WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4534174 posted 1:57 pm on Jan 16, 2013 (gmt 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.


10+ Year Member

Msg#: 4534174 posted 7:11 pm on Jan 16, 2013 (gmt 0)

Thanks httpwebwitch

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved