Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The xml file contains the following

    <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

  • #4
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •