Thanks for all your comments. The XML file I need to create was designed by
someone else and is interpreted by code which don't have access to. It has
attributes with the name "id" and increasing integer values, so this is what
I have to generate. I guess these don't use the id semantics. Using
<xsl:number/> as suggested by Ken works fine in this particular case, and is
very much easier than what I was trying to find a way of doing, which was
rather than using the sequence number of the nodes in the input file, to
work out how many nodes had been generated in the output file.
If there was no direct correspondence between the number of elements in the
input file and the number in the output file (as may become the case with
some enhancements that I'm planning), how would I calculate a value of this
sort (let's call it a sequence value rather than an id to avoid the
confusion)? E.g. if my output file needs to look something like the
following, where all the a, b, c and d elements need to have an "id"
(sequence) attribute with a steadily incrementing value through the file.
There can be all sorts of other nodes (e and f in the example) at various
levels in the tree which do not need id/sequence attributes. In this
particular system the a elements can be nested to any depth, but there can
be only one level of b, c and d elements within each sub-tree, but that's
just the way this particular system works.
How would I generate these id/sequence values, either as a second pass, or
as part of the first pass which generates this structure from the
non-hierarchical source file?
Thanks - Rowan
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>