Help to select FIXED/VERIFIED/CLOSED

Discussion in 'XML' started by Petterson Mikael, Aug 21, 2006.

  1. Hi,

    I want to use Xpath to select the last activity if <newvalue> is set to
    FIXED, VERIFIED or CLOSED.

    cheers,

    //mikael
    XSL template
    ============
    .........
    <xsl:template name="issue_date">
    <xsl:param name="issue-id"/>
    <xsl:for-each select="//issue">
    <xsl:if test="./issue_id = $issue-id">
    <div class="issue-type">
    <xsl:value-of
    select="substring(./activity[last()]/when ,1,11)"/>
    </div>
    </xsl:if>
    </xsl:for-each>
    </xsl:template>
    ..........


    XML issues
    ===========

    .......
    <activity>
    <user>jacekrad</user>
    <when>2006-04-01 12:48:30</when>
    <field_name>resolution</field_name>
    <field_desc>Resolution</field_desc>
    <oldvalue></oldvalue>
    <newvalue>FIXED</newvalue>
    </activity>
    Petterson Mikael, Aug 21, 2006
    #1
    1. Advertising

  2. Petterson Mikael wrote:
    > Hi,
    >
    > I want to use Xpath to select the last activity if <newvalue> is set to
    > FIXED, VERIFIED or CLOSED.


    Assuming you mean "the last activity which has a newvalue set to one of
    these", one of several ways to express that would be

    select="substring(./activity[newvalue="FIXED" or newvalue="VERIFIED" or
    newvalue="CLOSED"][last()]/when ,1,11)"/>

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Aug 21, 2006
    #2
    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. Grzegorz
    Replies:
    3
    Views:
    603
    Grzegorz
    Jan 19, 2007
  2. Replies:
    2
    Views:
    579
  3. Replies:
    0
    Views:
    421
  4. Cambridge Ray
    Replies:
    7
    Views:
    1,002
    Peter Flynn
    Aug 14, 2011
  5. adev
    Replies:
    0
    Views:
    195
Loading...

Share This Page