<Need Help>How to get the count of elements referencing another element 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>1000</elem1>
    <elem2>
    <subelem1>65</subelem1>
    </elem2>
    </template1>

    <template2>
    <type1>
    <tag1>1000</tag1>
    <tag2>1</tag2>
    <type1>

    <rule>
    <ref>1</ref>
    </rule>

    <rule>
    <ref>1</ref>
    </rule>

    <rule>
    <ref>1</ref>
    </rule>

    <rule>
    <ref>1</ref>
    </rule>

    <rule>
    <ref>1</ref>
    </rule>

    </template2>

    </root>

    In the above example,
    /template2/type1/tag1 references to /template1/elem1
    and /template2/rule/ref references to /template2/type1/tag2

    How can we write a XSLT rule to allow only 4 <rule> tags for every <type1> only if the corresponding /template1/elem2/subelem1 is greater than 60.

    In the above example it has to give error as (value of)tag1=elem1 and number of <rule> tags are 5 that have (value of)ref=tag2.

    Please help me in this regard.

    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. Marcel Akkerman
    Replies:
    5
    Views:
    924
    Marcel Akkerman
    Feb 22, 2004
  2. ralf321@gmx.de

    xslt: count elements...

    ralf321@gmx.de, Dec 9, 2005, in forum: XML
    Replies:
    4
    Views:
    31,862
    ralf321@gmx.de
    Dec 9, 2005
  3. hisachu
    Replies:
    0
    Views:
    1,565
    hisachu
    Sep 1, 2010
  4. Cat 22
    Replies:
    0
    Views:
    659
    Cat 22
    Oct 17, 2010
  5. libsfan01
    Replies:
    2
    Views:
    143
    libsfan01
    Jul 13, 2006
Loading...

Share This Page