Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-08-2013, 04:06 AM   PM User | #1
freddo99
New to the CF scene

 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
freddo99 is an unknown quantity at this point
Help with Choose in xsl - newbee to xml

I have an xsl file with the following two lines

Code:
     <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

Code:
<xsl:choose>
  <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: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

Code:
<xsl:when test="350 &gt; <xsl:value-of select=<xsl:value-of-select='imagesize/@width'/>">
Can someone please help?
freddo99 is offline   Reply With Quote
Old 01-08-2013, 05:43 AM   PM User | #2
Alex Vincent
Moderator


 
Join Date: May 2002
Location: Hayward, CA
Posts: 1,427
Thanks: 1
Thanked 19 Times in 17 Posts
Alex Vincent is on a distinguished road
Can you show us the XML you're trying to apply these XSLT documents to?
__________________
"The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
June 30, 2001
author, Verbosio prototype XML Editor
author, JavaScript Developer's Dictionary
https://alexvincent.us/blog
Alex Vincent is offline   Reply With Quote
Old 01-13-2013, 09:03 PM   PM User | #3
freddo99
New to the CF scene

 
Join Date: Oct 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
freddo99 is an unknown quantity at this point
The xml file contains the following

Quote:
<template description="Holidays - Slideshow" version="1.0.1">
<home_page fname="index.htm" />
<stylesheet fname="toc.xsl" type="toc" output="toc.xml" post_transform_exe="utils\SplitHtml.exe" post_transform_args="-d %d %i" />
<stylesheet fname="single.xsl" type="image_page" output="single.xml" post_transform_exe="utils\SplitHtml.exe" post_transform_args="-d %d %i" />
...
...
</template>
The section I am trying to alter changes the width and height of slideshow images
freddo99 is offline   Reply With Quote
Old 01-14-2013, 04:05 PM   PM User | #4
Alex Vincent
Moderator


 
Join Date: May 2002
Location: Hayward, CA
Posts: 1,427
Thanks: 1
Thanked 19 Times in 17 Posts
Alex Vincent is on a distinguished road
The <stylesheet> tags make no sense. I was under the impression XSLT transformations needed to be before the document's root element, and written as <?xml-stylesheet ... ?>.
__________________
"The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
June 30, 2001
author, Verbosio prototype XML Editor
author, JavaScript Developer's Dictionary
https://alexvincent.us/blog
Alex Vincent is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:11 PM.


Advertisement
Log in to turn off these ads.