<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mod="http://www.onekin.org/scripting#" xmlns:mns="http://icwe2009.webengineering.org/">
<xsl:output method="xml"/>
<xsl:template match="/*">
 <rdf:RDF xmlns:base="http://icwe2009.webengineering.org/">
  <xsl:apply-templates select=".//*[@class='paper']"/>
 </rdf:RDF>
</xsl:template>
<xsl:template match="*[@class='paper']">
 <mns:Paper rdf:ID="{generate-id(.)}">
  <xsl:call-template name="getPath"/>
  <xsl:apply-templates select=".//*[@class='author']"/>
 </mns:Paper>
</xsl:template>

<xsl:template match="*[@class='author']">
 <mns:author>
  <xsl:call-template name="getPath"/>
  <xsl:value-of select="text()"/>
 </mns:author>
</xsl:template>

<xsl:template name="getPath">
 <mod:XPath>
  <xsl:for-each select="ancestor-or-self::*">
  <xsl:text>/*[</xsl:text>
  <xsl:value-of select="1+count(preceding-sibling::*)"/>
  <xsl:text>]</xsl:text>
  </xsl:for-each>
 </mod:XPath>
</xsl:template>
</xsl:stylesheet>
