For specific requirements of the desired algorithm, I should prepare the input in a table-like format in which it is not possible to have cells with more than one data item. Simply, for doc as follows (this is a fragment of complete doc):
<Articles>
<article>
<author>Frank Manola</author>
<title>title1</title>
<journal>GTE</journal>
<month>December</month>
<year>1991</year>
</article>
<article>
<author>Frank Manola</author>
<author>Sandra Heiler</author>
<title>title2</title>
<journal>ASF</journal>
<month>August</month>
<year>1993</year>
</article>
</Articles>
the desired output is such as follows:
Frank Manola, title1, GTE, December, 1991
Frank Manola, title2, ASF, August, 1993
Sandra Heiler, title2, ASF, August, 1993
In fact, for those records that have more than one authors (author tag) (there are instances with 4 or more ones), each one should be retrieved in a separate line.
How to do that using XSLT?
Update: This is a solution that is close to what I want:
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*">(<xsl:apply-templates select=".//text()"/>)<xsl:if test="position() != last()">, </xsl:if>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:template>
</xsl:transform>