Bibl2struct.xslt

Summary
Transforms TEI s into  bibliographies. Ignores all other content. Produces a .

Required Input
This document will take any XML file, not just TEI XML, and processes all complete bibliographies into equivalent s.

The transform differentiates five major cases from the (non)-existence of s of certain @level (a,j,m,s). The level in parens, e.g. (a) means 'level a or without/blank level'.
 * has (a)+m+s titles ==> excerpt from work in series
 * has  (m)+s titles ==> work in series
 * has  (a)+j titles ==> journal article
 * has  (a)+m titles ==> excerpt from monograph
 * has    (m) titles ==> monograph

When an element contains @corresp the text is taken from that id. When the document contains a , we build that bibl and process it like the others.

Expected Output
a 

Known Restrictions or Problems
See TODO in the stylesheet.

Please add any comments to the 'discussion' tab. For payed support, please mail the author (address within stylesheet).

Stylesheet






 href="eb-bib.css" type="text/css"    

</xsl:template> </xsl:template> </xsl:template> </xsl:template> </xsl:template> </xsl:template> </xsl:template> </xsl:template> </xsl:template> </xsl:template> </xsl:template>







 <xsl:variable name='joint'> <xsl:call-template name='chomp-targets-recursively'> <xsl:with-param name='idstr'> <xsl:value-of select='@targets' /> </xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:apply-templates select='exsl:node-set($joint)//bibl' /> </xsl:template>

 <xsl:param name='idstr' /> <xsl:variable name="first"> <xsl:variable name="first0" select="substring-before($idstr,' ')"/> <xsl:choose> <xsl:when test="$first0"> <xsl:copy-of select="$first0"/> </xsl:when> <xsl:otherwise> <xsl:copy-of select="$idstr"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="string-length($first)"> <xsl:call-template name='chomp-targets-recursively'> <xsl:with-param name="idstr"> <xsl:value-of select="substring-after($idstr,' ')"/> </xsl:with-param> </xsl:call-template> <xsl:copy-of select='//*[@id=$first]' /> </xsl:if> </xsl:template>

 <xsl:variable name='tmp1'> <xsl:apply-templates select='*' /> </xsl:variable> <xsl:apply-templates select='exsl:node-set($tmp1)//bibl' /> </xsl:template>

<xsl:template match='bibl[(title[@level="a"] or title[@level=""] or title[not(@level)]) and title[@level="m"] and title[@level="s"]]'> <biblStruct> <xsl:apply-templates select='author' /> <xsl:apply-templates select='title[(@level="a" or @level="" or not(@level))]' /> <xsl:apply-templates select='editor' /> <xsl:apply-templates select='title[@level="m"]' /> <xsl:apply-templates select='editor' /> <xsl:apply-templates select='title[@level="s"]' /> <xsl:if test='date|edition|publisher|pubPlace|biblScope'> <xsl:apply-templates select='publisher' /> <xsl:apply-templates select='pubPlace' /> <xsl:apply-templates select='edition' /> <xsl:apply-templates select='date' /> <xsl:apply-templates select='biblScope' /> </xsl:if> <xsl:apply-templates select='note' /> </biblStruct> </xsl:template>

<xsl:template match='bibl[not(title[@level="a"]) and (title[@level="m"] or title[@level=""] or title[not(@level)]) and title[@level="s"]]'> <biblStruct> <xsl:apply-templates select='author' /> <xsl:apply-templates select='title[@level="m" or @level="" or not(@level)]' /> <xsl:if test='date|edition|publisher|pubPlace|biblScope'> <xsl:apply-templates select='publisher' /> <xsl:apply-templates select='pubPlace' /> <xsl:apply-templates select='edition' /> <xsl:apply-templates select='date' /> <xsl:apply-templates select='biblScope' /> </xsl:if> <xsl:apply-templates select='editor' /> <xsl:apply-templates select='title[@level="s"]' /> <xsl:apply-templates select='note' /> </biblStruct> </xsl:template>

<xsl:template match='bibl[not(title[@level="m"]) and not(title[@level="s"]) and title[@level="j"]]'> <biblStruct> <xsl:apply-templates select='author' /> <xsl:apply-templates select='title[not(@level) or @level="a"]' /> <xsl:apply-templates select='title[@level="j"]' /> <xsl:if test='date|publisher|pubPlace|biblScope'> <xsl:apply-templates select='publisher' /> <xsl:apply-templates select='pubPlace' /> <xsl:apply-templates select='date' /> <xsl:apply-templates select='biblScope' /> </xsl:if> <xsl:apply-templates select='editor' /> <xsl:apply-templates select='note' /> </biblStruct> </xsl:template>

<xsl:template match='bibl[title[not(@level) or @level="a"] and title[@level="m"]]'> <biblStruct> <xsl:apply-templates select='author' /> <xsl:apply-templates select='title[not(@level) or @level="a"]' /> <xsl:apply-templates select='editor' /> <xsl:apply-templates select='title[@level="m"]' /> <xsl:if test='date|edition|publisher|pubPlace|biblScope'> <xsl:apply-templates select='publisher' /> <xsl:apply-templates select='pubPlace' /> <xsl:apply-templates select='edition' /> <xsl:apply-templates select='date' /> <xsl:apply-templates select='biblScope' /> </xsl:if> <xsl:apply-templates select='note' /> </biblStruct> </xsl:template>

<xsl:template match='bibl[(not(title[@level="a"]) and not(title[@level="j"]) and not(title[@level="s"])) and ((title[@level="m"] and not(title[not(@level)])) or (not(title[@level="m"]) and title[not(@level)]))]'> <biblStruct> <xsl:apply-templates select='author' /> <xsl:apply-templates select='title' /> <xsl:apply-templates select='editor' /> <xsl:if test='date|edition|publisher|pubPlace|biblScope'> <xsl:apply-templates select='publisher' /> <xsl:apply-templates select='pubPlace' /> <xsl:apply-templates select='edition' /> <xsl:apply-templates select='date' /> <xsl:apply-templates select='biblScope' /> </xsl:if> <xsl:apply-templates select='note' /> </biblStruct> </xsl:template>

<xsl:template match="@* | author | title [ancestor::bibl] | editor |      biblScope | edition | date[ancestor::bibl] | publisher | pubPlace |       note[ancestor::bibl] | corr | name[ancestor::bibl]"> <xsl:choose> <xsl:when test='@corresp'> <xsl:variable name='tmp'> <xsl:copy> <xsl:copy-of select='id(@corresp)/@*' /> <xsl:copy-of select='id(@corresp)/node' /> </xsl:copy> </xsl:variable> <xsl:apply-templates select='exsl:node-set($tmp)//bibl/*' /> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:apply-templates select="@*[not(name='TEIform')]|node|text"/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template>

<xsl:template match='bibl/series'> <xsl:text>seriesabc</xsl:text> <xsl:copy-of select='*/node' /> </xsl:template>

<xsl:template match="bibl/text | author/text | editor/text |      //bibl//title/text | biblScope/text | //bibl//date/text |       edition/text | pubPlace/text | publisher/text | //bibl//note/text       | //bibl//corr/text | //bibl//name/text"> <xsl:copy /> </xsl:template>

</xsl:stylesheet>