Skip to content

Commit

Permalink
more sophisticated processing of paragraphs, fixes #136
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Oct 14, 2016
1 parent 78f24ac commit a35cd21
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
22 changes: 22 additions & 0 deletions xsl/common_main.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,28 @@
<xsl:text>T</xsl:text>
</xsl:element>
</xsl:template>

<xsl:template match="tei:p">
<xsl:variable name="inlineEnd" as="xs:string?">
<xsl:if test="following-sibling::node()[1][name() = 'closer'][@rend='inline']">
<xsl:text>inlineEnd</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:for-each-group select="node()" group-ending-with="tei:list">
<xsl:if test="count(current-group()[not(self::tei:list)]) gt 1 or current-group()[not(self::tei:list)][matches(., '\S')]">
<xsl:element name="p">
<xsl:if test="position() eq 1">
<xsl:apply-templates select="parent::tei:p/@xml:id"/>
</xsl:if>
<xsl:if test="$inlineEnd">
<xsl:attribute name="class" select="$inlineEnd"/>
</xsl:if>
<xsl:apply-templates select="current-group()[not(self::tei:list)]"/>
</xsl:element>
</xsl:if>
<xsl:apply-templates select="current-group()[self::tei:list]"/>
</xsl:for-each-group>
</xsl:template>

<!-- Default template for TEI elements -->
<!-- will be turned into html:span with class tei_elementName_attributeRendValue -->
Expand Down
7 changes: 0 additions & 7 deletions xsl/document.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@
</xsl:element>
</xsl:template>

<xsl:template match="tei:p">
<xsl:element name="p">
<xsl:apply-templates select="@xml:id"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

<xsl:template match="tei:head[parent::tei:div]" priority="1">
<xsl:variable name="minHeadLevel" as="xs:integer" select="2"/>
<xsl:variable name="increments" as="xs:integer">
Expand Down
7 changes: 0 additions & 7 deletions xsl/editorial.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,6 @@
</xsl:element>
</xsl:template>

<xsl:template match="tei:p">
<xsl:element name="p">
<xsl:apply-templates select="@xml:id"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

<!--<xsl:template match="tei:biblStruct[parent::tei:listBibl]">
<xsl:sequence select="wega:printCitation(., 'li', $lang)"/>
</xsl:template>-->
Expand Down
8 changes: 4 additions & 4 deletions xsl/letters.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@
</xsl:element>
</xsl:template>

<xsl:template match="tei:p">
<!--<xsl:template match="tei:p">
<xsl:element name="p">
<xsl:apply-templates select="@xml:id"/>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="following-sibling::node()[1][name() = 'closer'][@rend='inline']">
<xsl:text>inlineParagraph</xsl:text>
</xsl:when>
<!--<xsl:when test="following-sibling::node()[name() = 'closer' or name() = 'p'][1][@rend='inline'] or ./@rend='inline' or (. = ../tei:p[position()=last() and ])">
<!-\-<xsl:when test="following-sibling::node()[name() = 'closer' or name() = 'p'][1][@rend='inline'] or ./@rend='inline' or (. = ../tei:p[position()=last() and ])">
<xsl:text>inlineParagraph</xsl:text>
<xsl:if test="not(./@rend='inline') and not(. = ../tei:p[position()=1])">
<xsl:text> indented</xsl:text>
</xsl:if>
</xsl:when>-->
</xsl:when>-\->
<xsl:otherwise>
<xsl:text>blockParagraph</xsl:text>
</xsl:otherwise>
Expand All @@ -92,7 +92,7 @@
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:template>-->

<xsl:template match="tei:opener">
<xsl:element name="div">
Expand Down
7 changes: 0 additions & 7 deletions xsl/persons.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
<xsl:include href="common_main.xsl"/>
<xsl:include href="common_link.xsl"/>

<xsl:template match="tei:p">
<xsl:element name="p">
<xsl:apply-templates select="@xml:id"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

<xsl:template match="tei:note[parent::document-node()]" priority="1">
<xsl:element name="div">
<xsl:apply-templates select="@xml:id"/>
Expand Down
7 changes: 0 additions & 7 deletions xsl/var.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@
</xsl:element>
</xsl:template>

<xsl:template match="tei:p">
<xsl:element name="p">
<xsl:apply-templates select="@xml:id"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

<xsl:template match="tei:eg">
<xsl:element name="div">
<xsl:apply-templates select="@xml:id"/>
Expand Down

0 comments on commit a35cd21

Please sign in to comment.