xsl expand and collapse after "N" child elements



I have XML that can has variable number of child elements.

We need a way to add a expand / collapse feature when there are more than "N" number of child elements.

Example XML



<?xml version="1.0"?>
<TestXML>
<N>Test</N>
<NTList>
<NT>
<NT1>NT1 Test 1</NT1>
<NT2>NT2 Test 1</NT2>
</NT>
<NT>
<NT1>NT1 Test 2</NT1>
<NT2>NT2 Test 2</NT2>
</NT>
<NT>
<NT1>NT1 Test 3</NT1>
<NT2>NT2 Test 3</NT2>
</NT>
</NTList>
</TestXML>


So in this example we would like to add the expand / collapse if there are more than 2 "NT" inside the "NTList".



I think this is close but I can't find a way to determine when to add the expand / collapse after "N" records has been reached.



Something very basic like this for the HTML output:



N : Test
NTLIST
NT (1)
NT1 : NT1 Test 1
NT2 : NT2 Test 1
NT (2)
NT1 : NT1 Test 2
NT2 : NT2 Test 2
NT (+More) <- where this is the link to click to expand the 3rd NT.

No comments:

Post a Comment