D
David Schwartz
I need to create unique id's for DIVs for each instance of <foo>
within each instance of <bar> as follows. I iterate through both the
bars and foos via <apply-templates/>. I've tried to use position() but
that reflects the current <bar>, not the current <foo>.
========= sample xml ================
<!-- note the there may be other peer elements to the FOOs -->
<root>
<bar>
<foo>blah, blah, blah</foo>
<foo>bebop, smooth, cool, swing, super cool</foo>
</bar>
<bar>
<foo>baroque, classical, modern</foo>
<foo>chicago, delta</foo>
</bar>
</root>
==================================
========= sample html ================
page generated for the first <bar> instance:
<html>
<body>
<div id="foo1">blah, blah, blah</div>
<div id="foo2">bebop, smooth, cool, swing, super cool</div>
</body>
</html>
page generated for the second <bar> instance:
<html>
<body>
<div id="foo1">baroque, classical, modern</div>
<div id="foo2">chicago, delta</div>
</body>
</html>
=================================
within each instance of <bar> as follows. I iterate through both the
bars and foos via <apply-templates/>. I've tried to use position() but
that reflects the current <bar>, not the current <foo>.
========= sample xml ================
<!-- note the there may be other peer elements to the FOOs -->
<root>
<bar>
<foo>blah, blah, blah</foo>
<foo>bebop, smooth, cool, swing, super cool</foo>
</bar>
<bar>
<foo>baroque, classical, modern</foo>
<foo>chicago, delta</foo>
</bar>
</root>
==================================
========= sample html ================
page generated for the first <bar> instance:
<html>
<body>
<div id="foo1">blah, blah, blah</div>
<div id="foo2">bebop, smooth, cool, swing, super cool</div>
</body>
</html>
page generated for the second <bar> instance:
<html>
<body>
<div id="foo1">baroque, classical, modern</div>
<div id="foo2">chicago, delta</div>
</body>
</html>
=================================