how to reassign variable

Discussion in 'XML' started by biswaranjan.rath, May 5, 2006.

  1. Can i do something like this:

    <xsl:variable name="varMaxDiffId">
    <xsl:choose>
    <xsl:when test="$varMaxDiffId == 'NULL'">
    <xsl:value-of select="-1"/>
    </xsl:when>
    <xsl:when test="$varMaxDiffId < @unique_diff_id">
    <xsl:value-of select="@unique_diff_id"/>
    </xsl:when>
    </xsl:choose>
    </xsl:variable>

    Please suggest some solution. I want to find out maximum unique_diff_id
    from the document.

    Thanks,
    Biswaranjan
     
    biswaranjan.rath, May 5, 2006
    #1
    1. Advertising

  2. XSLT variables are single-assignment, and their values may not be
    changed. Use a new variable name to hold the result of your computation.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, May 5, 2006
    #2
    1. Advertising

  3. Joe Kesselman wrote:
    > XSLT variables are single-assignment, and their values may not be
    > changed. Use a new variable name to hold the result of your computation.


    .... or use functions built into XSLT (I believe there is a max operation)

    .... or, if you really need to write a loop evaluation, reconstruct it as
    a recursion. Common solution, but look for others first.


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, May 5, 2006
    #3
  4. Could you please give an example?
     
    biswaranjan.rath, May 5, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGltOjouLg==?=

    Reassign value to private

    =?Utf-8?B?VGltOjouLg==?=, Jan 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    386
    =?Utf-8?B?VGltOjouLg==?=
    Jan 27, 2005
  2. Shailesh Humbad

    reassign keys in an STL map

    Shailesh Humbad, Oct 29, 2004, in forum: C++
    Replies:
    7
    Views:
    2,647
    Greg Schmidt
    Nov 2, 2004
  3. Bernhard Merkle

    reassign to builtin possible !?

    Bernhard Merkle, Jan 3, 2008, in forum: Python
    Replies:
    8
    Views:
    313
    Bernhard Merkle
    Jan 4, 2008
  4. Immortal Nephi

    Reassign two objects to one pointer?

    Immortal Nephi, May 19, 2009, in forum: C++
    Replies:
    1
    Views:
    323
    Bart van Ingen Schenau
    May 20, 2009
  5. John O'Hagan
    Replies:
    6
    Views:
    371
    John O'Hagan
    Feb 12, 2011
Loading...

Share This Page