To count the total number of specific element in xml using xsl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • radhakrishnanrs
    New Member
    • Nov 2008
    • 5

    #1

    To count the total number of specific element in xml using xsl

    Hi,

    Is there any option to count the total number of specific element using XSL?

    XML File:

    <root>
    <child>Name:
    <child1>Text1 </child>
    <child1>Text2 </child>
    <child1>Text3 </child>
    </child>
    </root>

    I need to count the total number of element <child1> to be calculated and the value to be inserted using the other new element using XSL.

    Output:

    <root>
    <child>Name:
    <child1>Text1 </child>
    <child1>Text2 </child>
    <child1>Text3 </child>
    <NEWCHILD2>3</NEWCHILD2>
    </child>
    </root>

    Thanks in Advance,
    Radhakrishnan.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    yup, use the count() function.

    regards

    Comment

    Working...