diff options
Diffstat (limited to 'endnote-to-dbxml.xsl')
-rw-r--r-- | endnote-to-dbxml.xsl | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/endnote-to-dbxml.xsl b/endnote-to-dbxml.xsl index 24d3be3..f8880db 100644 --- a/endnote-to-dbxml.xsl +++ b/endnote-to-dbxml.xsl @@ -1,11 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl"> + + <xsl:key name="author" match="author" use="." /> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:include href="util.xsl"/> + <xsl:template match="*"> + <xsl:copy> + <xsl:copy-of select="@*"/> + <xsl:apply-templates /> + </xsl:copy> + </xsl:template> + + <xsl:template match="authors" mode="references"> + + </xsl:template> + <xsl:template match="record"> + <xsl:param name="authors"/> + <publication> <uid> <xsl:value-of select="rec-number" /> @@ -29,23 +46,52 @@ </year> <authors> - <!--<xsl:apply-templates select="authors" mode="references" />--> <xsl:for-each select="contributors/authors/author"> <xsl:if test="position() > 1"> - <xsl:text>|</xsl:text> + <xsl:text>,</xsl:text> </xsl:if> - <xsl:value-of select="." /> + <xsl:value-of select="exsl:node-set($authors)/tx_likat_pubs_domain_model_authors/author[name=current()]/uid" /> </xsl:for-each> </authors> </publication> </xsl:template> - <xsl:template match="/"> + <xsl:template match="records"> + <xsl:param name="authors"/> <tx_likat_pubs_domain_model_publications> - <xsl:apply-templates select="xml/records/record" /> + <xsl:apply-templates select="record"> + <xsl:with-param name="authors"> + <xsl:call-template name="authors" /> + </xsl:with-param> + </xsl:apply-templates> </tx_likat_pubs_domain_model_publications> </xsl:template> + <xsl:template match="author"> + <author> + <xsl:variable name="pos" select="position()"/> + <uid><xsl:value-of select="$pos"/></uid> + <name><xsl:value-of select="." /></name> + </author> + </xsl:template> + + + <xsl:template name="authors"> + <tx_likat_pubs_domain_model_authors> + <xsl:apply-templates select="//author[generate-id() = + generate-id(key('author', .)[1])]"/> + </tx_likat_pubs_domain_model_authors> + </xsl:template> + + <xsl:template match="/"> + <db> + <xsl:apply-templates select="xml/records"/> + + <xsl:call-template name="authors" /> + </db> + </xsl:template> + + <xsl:template name="string-replace-all"> <xsl:param name="text" /> <xsl:param name="replace" /> |