xsl-list
[Top] [All Lists]

Re: [xsl] sequential numbering in xslt

2010-01-04 11:32:38


Also, position() does not increment is that correct? Will it not be
always 1?

if you are processing a sequence of items then position() returns the
number of the item in the current sequence.

Ken's suggestion was that if (as is usually the case) you are starting
with a sequence of documents, then position() will return the number of
the current document.

 I use saxon to read a directory of files,

if you mean using the built in "all files in a directory" feature, then
(I think) essentially you are running a separate transform on each input
with no connection between them, so instead use the collection()
function (perhaps with one of the saxon-specific query uri forms to refer
to all the xml files in the directory) then iterate over the collection
with
<xsl:for-each select="collection(.......)">
this is document: <xsl:value-of select="position()"/>



failed because of the xsl:variable limitations.
Declarative programming languages in which variables hold values (rather
than memory locations) have the same expressive power as imperative
languages, so it's misleading to call this a limitation.

David




--~------------------------------------------------------------------
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>
--~--