<Need Help>How to read an element based on condition in XSLT?

Discussion in 'XML' started by njsimha, Sep 12, 2008.

  1. njsimha

    njsimha

    Joined:
    Sep 12, 2008
    Messages:
    3
    Hi,
    I have the following question:

    XML snippet:

    <root>

    <template1>
    <elem1>10</elem1>
    <elem2>20</elem2>
    <elem3>
    <subelem1>65</subelem1>
    <subelem2>65</subelem2>
    </elem3>
    </template1>

    <template1>
    <elem1>10</elem1>
    <elem2>20</elem2>
    <elem3>
    <subelem1>45</subelem1>
    <subelem2>15</subelem2>
    </elem3>
    <elem4>100</elem4>
    </template1>

    </root>

    I want to check that elem4 must be present under template1 only if the value of subelem1 is < 60.If this condition fails then a error message has to be displayed.

    I did the template match as follows:
    <xsl:template match="/root/template1/elem3/subelem[. >60 ]/> but how to check the existense of elem4?

    Please reply me how to achieve this in XSLT?

    Thanks.
     
    njsimha, Sep 12, 2008
    #1
    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. -
    Replies:
    12
    Views:
    719
    Remon van Vliet
    Jun 15, 2005
  2. Igor
    Replies:
    1
    Views:
    5,031
    Dimitre Novatchev
    Jul 20, 2003
  3. vaibhav
    Replies:
    3
    Views:
    1,182
    vaibhav
    Aug 14, 2006
  4. vishnu
    Replies:
    3
    Views:
    491
    vishnu
    Dec 1, 2006
  5. Bill W.
    Replies:
    13
    Views:
    319
    Phillip Gawlowski
    May 9, 2011
Loading...

Share This Page