Something like this:
<xsl:template match="author[1]">
<name-inverted>
<xsl:apply-templates/>
</name-inverted>
</xsl:template>
<xsl:template match="author[position() > 1]">
<name>
<xsl:apply-templates/>
</name>
</xsl:template>
<xsl:template match="surname">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="fname">
<given-names><xsl:value-of select="."/></given-names>
</xsl:template>
<xsl:template match="x">
<xsl:value-of select="."/>
</xsl:template>
This assumes the first author is always "inverted", and the others aren't. An alternative test that's sensitive to the actual content is
<xsl:template match="author[*[1][self::surname]]">
which tests whether the first child element is a surname element.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|