root / tmp / org.txm.oriflamms.rcp / res / oriflamms-patch-words-with-lb.xsl @ 476
History | View | Annotate | Download (2.2 kB)
1 |
<?xml version="1.0"?> |
---|---|
2 |
<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times" |
3 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" |
4 |
exclude-result-prefixes="tei edate" version="2.0"> |
5 |
|
6 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> |
7 |
|
8 |
<xsl:template match="node()|@*"> |
9 |
<!-- Copy the current node --> |
10 |
<xsl:copy> |
11 |
<!-- Including any attributes it has and any child nodes --> |
12 |
<xsl:apply-templates select="@*|node()"/> |
13 |
</xsl:copy> |
14 |
</xsl:template> |
15 |
|
16 |
<xsl:template name="wp1"> |
17 |
<xsl:for-each select="child::node()[not(self::tei:pb or self::tei:cb or self::tei:milestone) and following-sibling::*[descendant-or-self::tei:lb]]"> |
18 |
<xsl:apply-templates select="."/> |
19 |
</xsl:for-each> |
20 |
<xsl:for-each select="child::*[descendant::tei:lb]"> |
21 |
<xsl:copy> |
22 |
<xsl:apply-templates select="@*"/> |
23 |
<xsl:call-template name="wp1"/> |
24 |
</xsl:copy> |
25 |
</xsl:for-each> |
26 |
</xsl:template> |
27 |
|
28 |
<xsl:template name="wp2"> |
29 |
<xsl:for-each select="child::*[descendant::tei:lb]"> |
30 |
<xsl:copy> |
31 |
<xsl:apply-templates select="@*"/> |
32 |
<xsl:call-template name="wp2"/> |
33 |
</xsl:copy> |
34 |
</xsl:for-each> |
35 |
<xsl:for-each select="child::node()[not(self::tei:pb or self::tei:cb or self::tei:milestone) and preceding-sibling::*[descendant-or-self::tei:lb]]"> |
36 |
<xsl:apply-templates select="."/> |
37 |
</xsl:for-each> |
38 |
</xsl:template> |
39 |
|
40 |
<xsl:template match="tei:w[not(ancestor::tei:w or ancestor::tei:pc)]"> |
41 |
<xsl:copy> |
42 |
<xsl:apply-templates select="@*"/> |
43 |
<xsl:choose> |
44 |
<xsl:when test="descendant::tei:lb and not(descendant::tei:seg[@type='wp'])"> |
45 |
<seg xmlns="http://www.tei-c.org/ns/1.0" type="wp" part="I"> |
46 |
<xsl:call-template name="wp1"/> |
47 |
</seg> |
48 |
<xsl:apply-templates select="descendant::tei:milestone|descendant::tei:pb|descendant::tei:cb|descendant::tei:lb"/> |
49 |
<seg xmlns="http://www.tei-c.org/ns/1.0" type="wp" part="F"> |
50 |
<xsl:call-template name="wp2"/> |
51 |
</seg> |
52 |
</xsl:when> |
53 |
<xsl:otherwise><xsl:apply-templates/></xsl:otherwise> |
54 |
</xsl:choose> |
55 |
</xsl:copy> |
56 |
</xsl:template> |
57 |
|
58 |
<!-- on supprime les w et pc imbriqués --> |
59 |
<xsl:template match="tei:w[ancestor::tei:w or ancestor::tei:pc]|tei:pc[ancestor::tei:w or ancestor::tei:pc]"> |
60 |
<xsl:apply-templates/> |
61 |
</xsl:template> |
62 |
|
63 |
</xsl:stylesheet> |