I am quite new to XSLT and I want to add unique index to elements types to transform something like this:
<item1>
<item2>
<item3></item3>
<item3></item3>
</item2>
<item2>
<item3></item3>
<item3></item3>
</item2>
</item1>
<item1>
</item1>
into:
<item1 id="1">
<item2 id="1">
<item3 id="1"></item3>
<item3 id="2"></item3>
</item2>
<item2 id="2">
<item3 id="3"></item3>
<item3 id="4"></item3>
</item2>
</item1>
<item1 id="2">
</item1>
I tried using position() but it counts based on context and not globally on document.
Thanx.
mvujica 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.