Outils pour utilisateurs

Outils du site


public:perseus_201707_plato

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
public:perseus_201707_plato [2017/12/01 17:27]
benedicte.pincemin@ens-lyon.fr
public:perseus_201707_plato [2018/06/12 10:48] (Version actuelle)
benedicte.pincemin@ens-lyon.fr
Ligne 1: Ligne 1:
 ====== PLATO170720 corpus : how we put 29 Perseus texts from Plato into TXM corpus analysis software ====== ====== PLATO170720 corpus : how we put 29 Perseus texts from Plato into TXM corpus analysis software ======
 +
 +**[[public:​perseus|>>>​ Back to TXM Perseus Projects main page]]**
  
 ===== Project presentation ===== ===== Project presentation =====
Ligne 19: Ligne 21:
  
 All these XML-TEI files of Plato'​s texts are then grouped into one directory named plato170720 (that is, the name we have choosen to give to the TXM corpus). All these XML-TEI files of Plato'​s texts are then grouped into one directory named plato170720 (that is, the name we have choosen to give to the TXM corpus).
 +
 +<​note>​
 +Ready for use data :
 +  * An archive with all the [[https://​sharedocs.huma-num.fr/​wl/?​id=3ExkP0bcvYQmqqNegPVeciFY05ObrP6i|data (texts, metadada and stylesheets) ready for TXM import]] (command: file > **import** > XML-XTZ + CSV) as it was done in July 2017.
 +  * A [[https://​sharedocs.huma-num.fr/​wl/?​id=ZEaqCxsOI0AJqGjKBteQkj6FQpXWWOQw|binary corpus (.txm file) which can be directly loaded into TXM]] (command: file > **load**). This is a way to skip the technical stages of the import process and to focus on textometric analysis.
 +</​note>​
  
 ===== Principles and choices ===== ===== Principles and choices =====
Ligne 58: Ligne 66:
 </​note>​ </​note>​
  
-We can take into account edition pages : in all the files of our corpus the information is available in <​milestone unit="​page">​ element, with @n attribute. Solution : during XTZ import, at the 2-front stage, the xsl stylesheet adds <pb> elements which can be used by TXM.+We can take into account edition pages : in all the files of our corpus the information is available in <​milestone unit="​page">​ element, with @n attribute. Solution : during XTZ import, at the 2-front stage, the [[public:​perseus_201707_plato#​txm-front-teiperseus-xtzxsl|txm-front-teiperseus-xtz.xsl]] stylesheet adds <pb> elements which can be used by TXM.
  
 ==== Speech turns ==== ==== Speech turns ====
Ligne 92: Ligne 100:
   * Solution :   * Solution :
     * declare <​bibl>​ as note element in TXM XTZ import parameters ;     * declare <​bibl>​ as note element in TXM XTZ import parameters ;
-    * display its content in gray characters (defined in CSS stylesheet for edition).+    * display its content in gray characters (defined in [[public:​perseus_201707_plato#​perseuscss|perseus.css]] ​stylesheet for edition).
  
  
Ligne 98: Ligne 106:
 **Versified text** (encoded with <l> elements) should be distinguished in TXM text edition. **Versified text** (encoded with <l> elements) should be distinguished in TXM text edition.
   * Solution :   * Solution :
-    * process it as blocks in CSS.+    * process it as blocks in [[public:​perseus_201707_plato#​perseuscss|perseus.css]].
  
  
Ligne 110: Ligne 118:
   * a copy of every XML file for greek texts of Plato downloaded from Perseus DL.   * a copy of every XML file for greek texts of Plato downloaded from Perseus DL.
   * //​(optional)//​ a file named "​import.xml"​ //(This file is automatically created or updated during the import processing, it records all the parameters values used for the import, see below.)//   * //​(optional)//​ a file named "​import.xml"​ //(This file is automatically created or updated during the import processing, it records all the parameters values used for the import, see below.)//
-  * //​(optional)//​ a file named "metadata.csv", which brings additional information to describe texts (i.e. normalized titles, normalized edition date, etc.)+  * //​(optional)//​ a file named [[public:​perseus_201707_plato#​content_of_the_metadatacsv_file_used_for_this_import|metadata.csv]], which brings additional information to describe texts (i.e. normalized titles, normalized edition date, etc.)
   * a directory named "​css",​ which includes :   * a directory named "​css",​ which includes :
-    * perseus.css+    * [[public:​perseus_201707_plato#​perseuscss|perseus.css]]
   * a directory named "​xsl",​ which includes :   * a directory named "​xsl",​ which includes :
     * //​(depending on your TXM version, see [[public:​perseus_201707_plato#​note_about_the_1-split-merge_directory|note]] below)// a subdirectory named "​1-split-merge",​ which includes :     * //​(depending on your TXM version, see [[public:​perseus_201707_plato#​note_about_the_1-split-merge_directory|note]] below)// a subdirectory named "​1-split-merge",​ which includes :
-      * rename-no-dots.xsl+      * [[public:​perseus_201707_plato#​rename-no-dotsxsl|rename-no-dots.xsl]]
     * a subdirectory named "​2-front",​ which includes :     * a subdirectory named "​2-front",​ which includes :
-      * p4top5.xsl +      * [[public:​perseus_201707_plato#​p4top5xsl|p4top5.xsl]] 
-      * txm-front-teiperseus-xtz.xsl+      * [[public:​perseus_201707_plato#​txm-front-teiperseus-xtzxsl|txm-front-teiperseus-xtz.xsl]]
     * a subdirectory named "​3-posttok",​ which includes :     * a subdirectory named "​3-posttok",​ which includes :
-      * txm-posttok-addRef-perseus.xsl+      * [[public:​perseus_201707_plato#​txm-posttok-addRef-perseusxsl|txm-posttok-addRef-perseus.xsl]]
     * a subdirectory named "​4-edition",​ which includes :     * a subdirectory named "​4-edition",​ which includes :
-      * 1-default-html.xsl +      * [[public:​perseus_201707_plato#​1-default-htmlxsl|1-default-html.xsl]] 
-      * 2-default-pager.xsl+      * [[public:​perseus_201707_plato#​2-default-pagerxsl|2-default-pager.xsl]]
  
 ==== Note about the 1-split-merge directory ==== ==== Note about the 1-split-merge directory ====
  
-<​note>​+<​note ​important>
 About the 1-split-merge directory : About the 1-split-merge directory :
   * A bug in the TXM 0.7.8 version that we had in July 2017 prevented us from keeping dots in filenames, the rename-no-dots.xsl stylesheet is a solution to this bug : dots are replaced by underscores at the first stage of the import.   * A bug in the TXM 0.7.8 version that we had in July 2017 prevented us from keeping dots in filenames, the rename-no-dots.xsl stylesheet is a solution to this bug : dots are replaced by underscores at the first stage of the import.
Ligne 160: Ligne 168:
 The import parameters are read from, and saved in, the import.xml file included in the copus directory (here "​plato"​ directory). So if you have already imported the corpus, you recover your previous settings for this corpus. You can update or modify it before the new import. This file is edited through the graphical user interface (XML-XTZ + CSV import form). The import parameters are read from, and saved in, the import.xml file included in the copus directory (here "​plato"​ directory). So if you have already imported the corpus, you recover your previous settings for this corpus. You can update or modify it before the new import. This file is edited through the graphical user interface (XML-XTZ + CSV import form).
 </​note>​ </​note>​
 +
 +**[[public:​perseus|>>>​ Back to TXM Perseus Projects main page]]**
  
 ===== Content of the metadata.csv file used for this import ===== ===== Content of the metadata.csv file used for this import =====
Ligne 211: Ligne 221:
  
 <​note>​ <​note>​
-Note that the filenames (in the first column, which is entitled "​id"​) are adjusted : the dots have been replaced by underscores,​ because of the bug of early TXM 0.7.8 versions described above. When the bug will be fixed, the directory "​1-split-merge"​ should be removed and real names (with original dots) can be used everywhere (in metadata.csv and for original XML source files in the import directory).+Note that the filenames (in the first column, which is entitled "​id"​) are adjusted : the dots have been replaced by underscores,​ because of the bug of early TXM 0.7.8 versions described ​[[public:​perseus_201707_plato#​note_about_the_1-split-merge_directory|above]]. When the bug will be fixed, the directory "​1-split-merge"​ should be removed and real names (with original dots) can be used everywhere (in metadata.csv and for original XML source files in the import directory).
 </​note>​ </​note>​
  
Ligne 1081: Ligne 1091:
  
 <code XML> <code XML>
 +<?xml version="​1.0"?>​
 +<​xsl:​stylesheet
 +  xmlns:​xd="​http://​www.pnp-software.com/​XSLTdoc"​
 +  xmlns:​edate="​http://​exslt.org/​dates-and-times"​
 +  xmlns:​xsl="​http://​www.w3.org/​1999/​XSL/​Transform"​ xmlns:​tei="​http://​www.tei-c.org/​ns/​1.0"​
 +  exclude-result-prefixes="#​all"​ version="​2.0">​
 +  ​
 +  <xd:doc type="​stylesheet">​
 +    <​xd:​short>​
 +      A stylesheet to prepare PERSEUS XML-TEI texts to TXM import.
 +    </​xd:​short>​
 +    <​xd:​detail>​
 +      This stylesheet is free software; you can redistribute it and/or
 +      modify it under the terms of the GNU Lesser General Public
 +      License as published by the Free Software Foundation; either
 +      version 3 of the License, or (at your option) any later version.
 +      ​
 +      This stylesheet is distributed in the hope that it will be useful,
 +      but WITHOUT ANY WARRANTY; without even the implied warranty of
 +      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ​ See the GNU
 +      Lesser General Public License for more details.
 +      ​
 +      You should have received a copy of GNU Lesser Public License with
 +      this stylesheet. If not, see http://​www.gnu.org/​licenses/​lgpl.html
 +    </​xd:​detail>​
 +    <​xd:​author>​Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</​xd:​author>​
 +    <​xd:​copyright>​2017,​ CNRS / IHRIM (Groupe CACTUS)</​xd:​copyright>​
 +  </​xd:​doc>​
 +  ​
 +
 +  <​xsl:​output method="​xml"​ encoding="​utf-8"​ omit-xml-declaration="​no"/>​
 +  ​
 +  <​xsl:​template match="​node()|@*">​
 +    <!-- Copy the current node -->
 +    <​xsl:​copy>​
 +      <!-- Including any attributes it has and any child nodes -->
 +      <​xsl:​apply-templates select="​@*|node()"/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +  ​
 +<!-- This template automatically extracts information from teiHeader to use them as metadata information associated with each text. It had better be commented if one uses a metadata file with the same information (same metadata labels) : -->
 +  <​xsl:​template match="/​tei:​TEI/​tei:​text">​
 +    <​xsl:​variable name="​changes"​ as="​element()">​
 +      <​changes>​
 +        <​xsl:​choose>​
 +          <​xsl:​when test="​ancestor::​*:​TEI/​*:​teiHeader/​*:​revisionDesc//​*:​change[@when]">​
 +            <​xsl:​for-each select="​ancestor::​*:​TEI/​*:​teiHeader/​*:​revisionDesc//​*:​change">​
 +              <​xsl:​sort order="​descending"​ select="​@when"/>​
 +              <​change><​xsl:​value-of select="​@when"/></​change>​
 +            </​xsl:​for-each>​
 +          </​xsl:​when>​
 +          <​xsl:​when test="/​*:​TEI/​*:​teiHeader/​*:​revisionDesc//​*:​change/​*:​date">​
 +            <​change><​xsl:​value-of select="/​*:​TEI/​*:​teiHeader/​*:​revisionDesc//​*:​change[not(following-sibling::​*:​change)]/​*:​date"/></​change>​
 +          </​xsl:​when>​
 +          <​xsl:​otherwise>​
 +            <​change>​unknown</​change>​
 +          </​xsl:​otherwise>​
 +        </​xsl:​choose>​
 +      </​changes>​
 +    </​xsl:​variable>​
 +    <​xsl:​copy>​
 +      <​xsl:​copy-of select="​@*"/>​
 +      <​xsl:​attribute name="​author"><​xsl:​value-of select="​normalize-space(//​tei:​teiHeader/​tei:​fileDesc/​tei:​titleStmt/​tei:​author[1])"/></​xsl:​attribute>​
 +      <​xsl:​attribute name="​title"><​xsl:​value-of select="​replace(normalize-space(/​tei:​TEI/​tei:​teiHeader[1]/​tei:​fileDesc[1]/​tei:​titleStmt[1]/​tei:​title[1]),'​^([^.,​\(:;​]*[^.,​\(:;​\s]+)\s*.*$','​$1'​)"/></​xsl:​attribute>​
 +      <​xsl:​attribute name="​editor"><​xsl:​value-of select="​normalize-space(//​tei:​teiHeader/​tei:​fileDesc/​tei:​titleStmt/​tei:​editor[1])"/></​xsl:​attribute>​
 +      <​xsl:​attribute name="​lastchange"><​xsl:​value-of select="​normalize-space($changes//​change[1])"/></​xsl:​attribute>​
 +      <​xsl:​apply-templates/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +
 +<!-- Texts in a text group are renamed as subtext (texts cannot be nested for TXM processing) -->
 +<​xsl:​template match="​tei:​group/​tei:​text">​
 +  <​xsl:​element name="​subtext">​
 +    <​xsl:​apply-templates select="​@*|node()"/>​
 +  </​xsl:​element>​
 +</​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​tei:​pb">​
 +    <​xsl:​copy>​
 +      <​xsl:​attribute name="​n">​
 +        <​xsl:​choose>​
 +          <​xsl:​when test="​@n"><​xsl:​value-of select="​@n"/></​xsl:​when>​
 +          <​xsl:​when test="​@*:​id">​
 +            <​xsl:​value-of select="​replace(@*:​id,'​^p\.',''​)"/>​
 +          </​xsl:​when>​
 +          <​xsl:​otherwise><​xsl:​text>​[s.n.]</​xsl:​text></​xsl:​otherwise>​
 +        </​xsl:​choose>​
 +      </​xsl:​attribute>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +
 +<!-- The CQP search engine used by TXM doesn'​t work well with structures both numbered and nested, it gets confused ; so numbered div elements are converted to simple nested div elements. -->
 +<​xsl:​template match="​tei:​div1|tei:​div2|tei:​div3|tei:​div4|tei:​div5|tei:​div6|tei:​div7">​
 +  <​xsl:​element name="​div"​ namespace="​http://​www.tei-c.org/​ns/​1.0">​
 +    <​xsl:​apply-templates select="​@*|node()"/>​
 +  </​xsl:​element>​
 +</​xsl:​template>​
 +
 +<!-- Some texts of our selection (Plato, taken from github on 2017, July 3rd) are in a transitory edition state, with no milestone element for section encoding : sections are defined only through div elements. This template adds milestones for sections when missing, as to get a uniform encoding of the information in the corpus.-->​
 +  <​xsl:​template match="​tei:​div[@type='​section'​ or @subtype='​section'​]">​
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*"/>​
 +      <​!--<​xsl:​if test="​not(//​tei:​milestone[@unit='​page'​]) and (matches(@n,'​a$'​))">​
 +        <pb xmlns="​http://​www.tei-c.org/​ns/​1.0"​ n="​{replace(@n,'​a$',''​)}"/>​
 +      </​xsl:​if>​-->​
 +      <xsl:if test="​not(//​tei:​milestone[@unit='​section'​])">​
 +        <​milestone unit="​section"​ xmlns="​http://​www.tei-c.org/​ns/​1.0"​ n="​{@n}"></​milestone>​
 +      </​xsl:​if>​
 +      <​xsl:​apply-templates/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +
 +<!-- Milestones for pages are converted into pb elements (easier to process in TXM import) -->  ​
 +  <​xsl:​template match="​tei:​milestone[@unit='​page'​]">​
 +    <pb xmlns="​http://​www.tei-c.org/​ns/​1.0"​ n="​{replace(@n,'​a$',''​)}"/>​
 +  </​xsl:​template>​
 +
 +<​xsl:​template match="​tei:​choice">​
 +  <​xsl:​apply-templates select="​tei:​expan|tei:​corr|tei:​reg"/>​
 +</​xsl:​template>​
 +
 +<​xsl:​template match="​tei:​choice/​tei:​expan">​
 +  <w xmlns="​http://​www.tei-c.org/​ns/​1.0">​
 +    <​xsl:​attribute name="​abbr"><​xsl:​value-of select="​normalize-space(parent::​tei:​choice/​tei:​abbr)"/></​xsl:​attribute>​
 +    <​xsl:​apply-templates select="​@*|node()"/>​
 +  </w>
 +</​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​tei:​choice/​tei:​corr">​
 +    <​xsl:​copy>​
 +      <​xsl:​attribute name="​sic"><​xsl:​value-of select="​normalize-space(parent::​tei:​choice/​tei:​sic)"/></​xsl:​attribute>​
 +      <​xsl:​apply-templates select="​@*|node()"/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​tei:​choice/​tei:​reg">​
 +    <​xsl:​copy>​
 +      <​xsl:​attribute name="​orig"><​xsl:​value-of select="​normalize-space(parent::​tei:​choice/​tei:​orig)"/></​xsl:​attribute>​
 +      <​xsl:​apply-templates select="​@*|node()"/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +
 +<!-- Dialogs'​ processing : the following templates unify encoding in the corpus (Plato, taken from github on 2017, July 3rd) so as to have clear editions (a speech turn looks like a paragraph introduced by the speaker'​s name). -->
 +  <​xsl:​template match="​tei:​said">​
 +    <​xsl:​choose>​
 +      <​xsl:​when test="​not(ancestor::​tei:​p or descendant::​tei:​p)">​
 +        <p xmlns="​http://​www.tei-c.org/​ns/​1.0">​
 +          <​xsl:​call-template name="​process-said"/>​
 +        </p>
 +      </​xsl:​when>​
 +      <​xsl:​otherwise>​
 +        <​xsl:​call-template name="​process-said"/>​
 +      </​xsl:​otherwise>​
 +    </​xsl:​choose>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template name="​process-said">​
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*"/>​
 +      <xsl:if test="​@who and not(descendant::​tei:​label) and not(ancestor::​tei:​said)">​
 +<​!-- ​       <emph xmlns="​http://​www.tei-c.org/​ns/​1.0">​-->​
 +          <label xmlns="​http://​www.tei-c.org/​ns/​1.0">​
 +            <​xsl:​value-of select="​replace(@who,'​^#',''​)"/>​
 +            <​xsl:​text>​.</​xsl:​text>​
 +          </​label>​
 +        <​!--</​emph>​-->​
 +        <​xsl:​text>​ </​xsl:​text>​
 +      </​xsl:​if>​
 +      <​xsl:​apply-templates/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +
 +<!-- The following processing has been moved in a later stage --> ​
 +  <!-- <​xsl:​template match="​tei:​label|tei:​speaker">​
 +
 +    <emph xmlns="​http://​www.tei-c.org/​ns/​1.0">​
 +
 +      <​xsl:​copy>​
 +
 +        <​xsl:​apply-templates select="​@*|node()"/>​
 +
 +      </​xsl:​copy>​
 +    </​emph>​
 +  </​xsl:​template>​-->​
 +    ​
 +
 +
 +<!-- Temporary patch for TXM indexing quote elements in notes -->
 +
 +  <​xsl:​template match="​tei:​note//​tei:​quote">​
 +    <​quote-note>​
 +      <​xsl:​apply-templates select="​@*|node()"/>​
 +    </​quote-note>​
 +  </​xsl:​template>​
 +
 +<!-- following are examples of :
 +(i) adding an <​emph>​ element in order to point out some elements'​ content (e.g. foreign, title) in TXM edition ;
 +(ii) adding a <w> element to prevent tokenisation from analysing some content (e.g. foreign, num) 
 +(iii) adding emph element inside all elements with @rend containing '​italic'​ for automatic styling in TXM editions -->
 +
 +<​xsl:​template match="​tei:​foreign[not(ancestor::​tei:​note)]">​
 +<​!--<​emph rend="​italic"​ xmlns="​http://​www.tei-c.org/​ns/​1.0">​-->​
 +  <​xsl:​copy>​
 +    <w xmlns="​http://​www.tei-c.org/​ns/​1.0">  ​
 +    <​xsl:​apply-templates select="​@*|node()"/>​
 +    </​w>  ​
 +  </​xsl:​copy>​
 +<​!--</​emph>​-->​
 +</​xsl:​template>​
 +
 +<​!--<​xsl:​template match="​tei:​title">​
 +<emph rend="​italic"​ xmlns="​http://​www.tei-c.org/​ns/​1.0">​
 +  <​xsl:​copy>​
 +    <​xsl:​apply-templates select="​@*|node()"/>​
 +  </​xsl:​copy>​
 +</​emph>​
 +</​xsl:​template>​-->​
 +  ​
 +
 +<!-- Temporary patch to get the correct rendering for <hi @rend="​italic">​ content in TXM editions : must use <​emph>​ instead of <hi> -->
 +
 +<​!--<​xsl:​template match="​tei:​hi[matches(@rend,'​italic'​)]"​ priority="​1">​
 +  <​xsl:​element name="​emph"​ namespace="​http://​www.tei-c.org/​ns/​1.0">​
 +    <​xsl:​apply-templates select="​@*|node()"/>​
 +  </​xsl:​element>​
 +</​xsl:​template>​-->​
 +
 +
 +<!-- The problem with the following first attempt is that bold is kept, it should be replaced :
 +
 +  <​xsl:​template match="​*[matches(@rend,'​italic','​i'​)]">​
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*"/>​
 +      <​emph>​
 +        <​xsl:​apply-templates/>​
 +      </​emph>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +-->  ​
 +
 +<!-- not relevant in current TXM version as only hi and emph elements'​ @rend are used in editions -->
 +
 +  <​!--<​xsl:​template match="​@rend">​
 +    <​xsl:​copy>​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​matches(.,'​italics','​i'​)">​
 +          <​xsl:​value-of select="​replace(.,'​italics','​italic','​i'​)"/>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​
 +          <​xsl:​value-of select="​."/>​
 +        </​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​-->​
 +
 +
 +<!-- Not relevant because numerals are composed with underscores and not dot separators, so there is no problem with tokenisation :
 +
 +<​xsl:​template match="​tei:​num">​
 +  <​xsl:​copy>​
 +    <w xmlns="​http://​www.tei-c.org/​ns/​1.0">​
 +    <​xsl:​apply-templates select="​@*|node()"/>​
 +    </w>
 +  </​xsl:​copy>​
 +</​xsl:​template>​
 +-->
 +
 +<!-- This template is relevant for latin texts with greek fragments not to be indexed, not for greek ones. But doesn'​t work well anyway -> to be fixed.
 +
 +<​xsl:​template match="​*[@xml:​lang='​greek'​]">​
 +  <​xsl:​copy>​
 +  <​xsl:​apply-templates select="​@*"/>​
 +  <foreign xml:​lang="​greek"​ xmlns="​http://​www.tei-c.org/​ns/​1.0">​
 +    <​xsl:​apply-templates/>​
 +  </​foreign>​
 +  </​xsl:​copy>​
 +</​xsl:​template>​
 +-->
 +
 +<!-- Verse quotations temporary processing (replaced by a post-processing dedicated to HTML edition preparing - XSLT 4th stage in TXM XML-TEI-XTZ import) --> ​   ​
 +
 +    <​!--<​xsl:​template match="​tei:​l">​
 +
 +      <lb xmlns="​http://​www.tei-c.org/​ns/​1.0"/>​
 +
 +      <​xsl:​copy>​
 +
 +        <​xsl:​apply-templates select="​@*|node()"/>​
 +      </​xsl:​copy>​
 +    </​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​tei:​bibl">​
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*|node()"/>​
 +    </​xsl:​copy>​
 +    <lb xmlns="​http://​www.tei-c.org/​ns/​1.0"/>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​tei:​quote[descendant::​tei:​l and not(following-sibling::​tei:​quote[1][descendant::​tei:​l]) and not(following-sibling::​*[1][self::​tei:​bibl])]">​
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*|node()"/>​
 +    </​xsl:​copy>​
 +    <lb xmlns="​http://​www.tei-c.org/​ns/​1.0"/>​
 +  </​xsl:​template>​-->​
 +
 +
 +</​xsl:​stylesheet>​
 </​code>​ </​code>​
  
Ligne 1088: Ligne 1405:
  
 <code XML> <code XML>
 +<?xml version="​1.0"?>​
 +<​xsl:​stylesheet xmlns:​edate="​http://​exslt.org/​dates-and-times"​
 +  xmlns:​xsl="​http://​www.w3.org/​1999/​XSL/​Transform"​ xmlns:​tei="​http://​www.tei-c.org/​ns/​1.0"​
 +  xmlns:​txm="​http://​textometrie.org/​ns/​1.0"​
 +  exclude-result-prefixes="​tei edate" xpath-default-namespace="​http://​www.tei-c.org/​ns/​1.0"​ version="​2.0">​
 +
 +  <!--
 +This software is dual-licensed:​
 +
 +1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
 +Unported License http://​creativecommons.org/​licenses/​by-sa/​3.0/ ​
 +
 +2. http://​www.opensource.org/​licenses/​BSD-2-Clause
 +
 +All rights reserved.
 +
 +Redistribution and use in source and binary forms, with or without
 +modification,​ are permitted provided that the following conditions are
 +met:
 +
 +* Redistributions of source code must retain the above copyright
 +notice, this list of conditions and the following disclaimer.
 +
 +* Redistributions in binary form must reproduce the above copyright
 +notice, this list of conditions and the following disclaimer in the
 +documentation and/or other materials provided with the distribution.
 +
 +This software is provided by the copyright holders and contributors
 +"as is" and any express or implied warranties, including, but not
 +limited to, the implied warranties of merchantability and fitness for
 +a particular purpose are disclaimed. In no event shall the copyright
 +holder or contributors be liable for any direct, indirect, incidental,
 +special, exemplary, or consequential damages (including, but not
 +limited to, procurement of substitute goods or services; loss of use,
 +data, or profits; or business interruption) however caused and on any
 +theory of liability, whether in contract, strict liability, or tort
 +(including negligence or otherwise) arising in any way out of the use
 +of this software, even if advised of the possibility of such damage.
 +
 +     
 +This stylesheet adds a ref attribute to w elements that will be used for
 +references in TXM concordances. Can be used with TXM XTZ import module.
 +
 +Written by Alexei Lavrentiev, UMR 5317 IHRIM, 2017
 +  -->
 +
 +<!-- Modified version of the stylesheet : customization for an experiment on Plato'​s texts, July 2017, B. Pincemin & S. Marchand -->
 +
 +  <​xsl:​output method="​xml"​ encoding="​utf-8"​ omit-xml-declaration="​no"/> ​
 +  ​
 +  ​
 +  <!-- General patterns: all elements, attributes, comments and processing instructions are copied -->
 +  ​
 +  <​xsl:​template match="​*"> ​     ​
 +        <​xsl:​copy>​
 +          <​xsl:​apply-templates select="​*|@*|processing-instruction()|comment()|text()"/>​
 +        </​xsl:​copy> ​   ​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​*"​ mode="​position"><​xsl:​value-of select="​count(preceding-sibling::​*)"/></​xsl:​template>​
 +
 +  <​xsl:​template match="​@*|comment()|processing-instruction()">​
 +    <​xsl:​copy/>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​variable name="​filename">​
 +    <​xsl:​analyze-string select="​document-uri(.)"​ regex="​^(.*)/​([^/​]+)\.xml$">​
 +      <​xsl:​matching-substring>​
 +        <​xsl:​value-of select="​regex-group(2)"/>​
 +      </​xsl:​matching-substring>​
 +    </​xsl:​analyze-string>​
 +  </​xsl:​variable>​
 +    ​
 +  <​xsl:​template match="​tei:​w">​
 +
 +    <​xsl:​variable name="​ctsurn">​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​ancestor::​tei:​text/​@*:​id">​
 +          <​xsl:​value-of select="​ancestor::​tei:​text[1]/​@*:​id[1]"/>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​
 +          <​xsl:​value-of select="​$filename"/>​
 +        </​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +      <xsl:if test="​preceding::​tei:​milestone[@unit='​section'​][1][@n]">​
 +        <​xsl:​text>:</​xsl:​text>​
 +        <​xsl:​value-of select="​preceding::​tei:​milestone[@unit='​section'​][1]/​@n"/>​
 +      </​xsl:​if>​
 +    </​xsl:​variable>​
 +
 +    <​xsl:​variable name="​currentsection">​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​preceding::​tei:​milestone[@unit='​section'​][1][@n]">​
 +          <​xsl:​analyze-string select="​preceding::​tei:​milestone[@unit='​section'​][1]/​@n"​ regex="​^(\d+)(.*)$">​
 +            <​xsl:​matching-substring>​
 +              <​xsl:​value-of select="​concat(format-number(number(regex-group(1)),'​0000'​),​regex-group(2))"></​xsl:​value-of>​
 +            </​xsl:​matching-substring>​
 +            <​xsl:​non-matching-substring><​xsl:​value-of select="​."/></​xsl:​non-matching-substring>​
 +          </​xsl:​analyze-string>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​SN</​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +    </​xsl:​variable>​
 +
 +    <​xsl:​variable name="​ref">​
 +      <​xsl:​choose>​
 +<!-- Following condition to be fixed : this doesn'​t catch the title1 attribute value -->
 +        <​!--<​xsl:​when test="​ancestor::​tei:​text/​@*:​title1">​
 +          <​xsl:​value-of select="​ancestor::​tei:​text[1]/​@*:​title1[1]"/>​
 +        </​xsl:​when>​-->​
 +        <​!--<​xsl:​when test="/​tei:​TEI/​tei:​teiHeader[1]/​tei:​fileDesc[1]/​tei:​titleStmt[1]/​tei:​title[1]">​-->​
 +        <​xsl:​when test="/​tei:​TEI/​tei:​text[1]/​@title">​
 +          <​!--<​xsl:​value-of select="​replace(normalize-space(/​tei:​TEI/​tei:​teiHeader[1]/​tei:​fileDesc[1]/​tei:​titleStmt[1]/​tei:​title[1]),'​^([^.,​\(:;​]*[^.,​\(:;​\s]+)\s*.*$','​$1'​)"/>​-->​
 +          <​xsl:​value-of select="/​tei:​TEI/​tei:​text[1]/​@title"/>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​
 +          <​xsl:​value-of select="​$filename"/>​
 +        </​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +      <xsl:if test="​preceding::​tei:​milestone[@unit='​section'​][1][@n]">​
 +        <​xsl:​text>,​ s. </​xsl:​text>​
 +        <​!--<​xsl:​value-of select="​preceding::​tei:​milestone[@unit='​section'​][1]/​@n"/>​-->​
 +        <​xsl:​value-of select="​$currentsection"/>​
 +      </​xsl:​if>​
 +    </​xsl:​variable>​
 +
 +    <​xsl:​variable name="​ctsurn5">​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​ancestor::​tei:​text/​@*:​id">​
 +          <​xsl:​value-of select="​ancestor::​tei:​text[1]/​@*:​id[1]"/>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​
 +          <​xsl:​value-of select="​$filename"/>​
 +        </​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +      <xsl:if test="​preceding::​tei:​milestone[@unit='​section'​][1][@n]">​
 +        <​xsl:​text>:</​xsl:​text>​
 +        <​xsl:​value-of select="​$currentsection"/>​
 +      </​xsl:​if>​
 +    </​xsl:​variable> ​
 +
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*"/>​
 +      <​xsl:​attribute name="​ctsurn"><​xsl:​value-of select="​$ctsurn"/></​xsl:​attribute>​
 +      <​xsl:​attribute name="​ctsurn5"><​xsl:​value-of select="​$ctsurn5"/></​xsl:​attribute>​
 +      <​xsl:​attribute name="​ref"><​xsl:​value-of select="​$ref"/></​xsl:​attribute>​
 +      <​xsl:​attribute name="​section"><​xsl:​value-of select="​$currentsection"/></​xsl:​attribute>​
 +      <​xsl:​apply-templates select="​*|processing-instruction()|comment()|text()"/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +
 +</​xsl:​stylesheet>​
 </​code>​ </​code>​
  
Ligne 1095: Ligne 1564:
  
 <code XML> <code XML>
 +<?xml version="​1.0"?>​
 +<​xsl:​stylesheet xmlns:​edate="​http://​exslt.org/​dates-and-times"​
 + xmlns:​xsl="​http://​www.w3.org/​1999/​XSL/​Transform" ​
 + xmlns:​tei="​http://​www.tei-c.org/​ns/​1.0" ​
 + xmlns:​txm="​http://​textometrie.org/​1.0"​
 + xmlns:​xs="​http://​www.w3.org/​2001/​XMLSchema"​
 +                exclude-result-prefixes="#​all"​ version="​2.0">​
 +                ​
 + <​xsl:​output method="​xml"​ encoding="​UTF-8"​ omit-xml-declaration="​no"​ indent="​no"/>​
 +
 + <!-- <​xsl:​output method="​xml"​ encoding="​UTF-8"​ omit-xml-declaration="​no"​ indent="​no" ​ doctype-public="​-//​W3C//​DTD XHTML 1.0 Transitional//​EN"​ doctype-system="​http://​www.w3.org/​TR/​xhtml1/​DTD/​xhtml1-transitional.dtd"/>​ -->
 +
 +                ​
 +                <​xsl:​strip-space elements="​*"/>​
 +                ​
 + <​xsl:​param name="​pagination-element">​pb</​xsl:​param>​
 +
 + <​xsl:​variable name="​word-element">​
 + <​xsl:​choose>​
 + <​xsl:​when test="//​tei:​c//​txm:​form">​c</​xsl:​when>​
 + <​xsl:​otherwise>​w</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 +
 + <​xsl:​variable name="​page-number-adjust"​ as="​xs:​integer">​
 + <​xsl:​choose>​
 + <​xsl:​when test="//​tei:​c//​txm:​form">​1</​xsl:​when>​
 + <​xsl:​otherwise>​2</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 +
 +
 +                <​xsl:​variable name="​inputtype">​
 +                <​xsl:​choose>​
 +                <​xsl:​when test="//​tei:​w//​txm:​form">​xmltxm</​xsl:​when>​
 +                <​xsl:​otherwise>​xmlw</​xsl:​otherwise>​
 +                </​xsl:​choose>​
 +                </​xsl:​variable>​
 +
 + <​xsl:​variable name="​filename">​
 + <​xsl:​analyze-string select="​document-uri(.)"​ regex="​^(.*)/​([^/​]+)\.[^/​.]+$">​
 + <​xsl:​matching-substring>​
 + <​xsl:​value-of select="​regex-group(2)"/>​
 + </​xsl:​matching-substring>​
 + </​xsl:​analyze-string>​
 + </​xsl:​variable>​
 +                ​
 +                <​xsl:​template match="/">​
 +                <​html>​
 +                <​head>​
 +                <​title><​xsl:​choose>​
 +                <​xsl:​when test="//​tei:​text/​@id"><​xsl:​value-of select="//​tei:​text[1]/​@id"/></​xsl:​when>​
 +                <​xsl:​otherwise><​xsl:​value-of select="​$filename"/></​xsl:​otherwise>​
 +                </​xsl:​choose></​title>​
 +                <meta http-equiv="​Content-Type"​ content="​text/​html;​charset=UTF-8"/>​
 +                <link rel="​stylesheet"​ media="​all"​ type="​text/​css"​ href="​css/​txm.css"​ />
 +                </​head>​
 +                <​xsl:​apply-templates select="​descendant::​tei:​text"/>​
 +                </​html>​
 +                </​xsl:​template>​
 +
 + <​xsl:​template match="​tei:​text">​
 + <​body>​
 + <​xsl:​if test="​$word-element='​w'">​
 + <a class="​txm-page"​ title="​1" ​ next-word-id="​w_0"/>​
 + <div class="​metadata-page">​
 + <​h1><​xsl:​value-of select="​@id"></​xsl:​value-of></​h1>​
 + <​br/>​
 + <​table>​
 + <​xsl:​for-each select="​@*">​
 + <​tr>​
 + <​td><​xsl:​value-of select="​name()"/></​td>​
 + <​td><​xsl:​value-of select="​."/></​td>​
 + </​tr>​
 + </​xsl:​for-each>​
 + </​table>​
 + </​div>​
 +
 + </​xsl:​if>​
 + <​xsl:​apply-templates/>​
 + </​body>​
 + </​xsl:​template>​
 +
 +                <​xsl:​template match="​*">​
 +                                <​xsl:​choose>​
 +                                <​xsl:​when test="​descendant::​tei:​p|descendant::​tei:​ab">​
 +                                <​div>​
 +                                <​xsl:​call-template name="​addClass"/>​
 +                                <​xsl:​apply-templates/></​div>​
 +                                <​xsl:​text>&#​xa;</​xsl:​text>​
 +                                </​xsl:​when>​
 +                                <​xsl:​otherwise><​span>​
 +                                <​xsl:​call-template name="​addClass"/>​
 +                                <​xsl:​if test="​self::​tei:​add[@del]">​
 +                                <​xsl:​attribute name="​title"><​xsl:​value-of select="​@del"/></​xsl:​attribute>​
 +                                </​xsl:​if>​
 +                                <​xsl:​apply-templates/></​span>​
 +                                <​xsl:​call-template name="​spacing"/>​
 +                                </​xsl:​otherwise>​
 +                                </​xsl:​choose>​
 +                </​xsl:​template>​
 +                ​
 +                <​xsl:​template match="​@*|processing-instruction()|comment()">​
 +                                <​!--<​xsl:​copy/>​-->​
 +                </​xsl:​template>​
 +                ​
 +<​!-- ​               <​xsl:​template match="​comment()">​
 +                                <​xsl:​copy/>​
 +                </​xsl:​template>​
 +--> ​               ​
 +                <​xsl:​template match="​text()">​
 +                                <​xsl:​value-of select="​normalize-space(.)"/>​
 +                </​xsl:​template>​
 +                ​
 +                <​xsl:​template name="​addClass">​
 +                <​xsl:​attribute name="​class">​
 +                <​xsl:​value-of select="​local-name(.)"/>​
 +                <​xsl:​if test="​@type"><​xsl:​value-of select="​concat('​-',​@type)"/></​xsl:​if>​
 +                <​xsl:​if test="​@subtype"><​xsl:​value-of select="​concat('​-',​@subtype)"/></​xsl:​if>​
 +                <​xsl:​if test="​@rend"><​xsl:​value-of select="​concat('​-',​@rend)"/></​xsl:​if>​
 +                </​xsl:​attribute> ​              
 +                </​xsl:​template>​
 +                ​
 +                <​xsl:​template match="​tei:​p|tei:​ab|tei:​lg">​
 +                <p>
 +                <​xsl:​call-template name="​addClass"/>​
 +                <​xsl:​apply-templates/>​
 +                </p>
 +                <​xsl:​text>&#​xa;</​xsl:​text>​
 +                </​xsl:​template>​
 +
 + <​xsl:​template match="​tei:​head">​
 + <​h2>​
 + <​xsl:​call-template name="​addClass"/>​
 + <​xsl:​apply-templates/>​
 + </​h2>​
 + </​xsl:​template>​
 +
 + <​xsl:​template match="​tei:​gap">​
 + <span class="​gap">​
 + <​xsl:​if test="​@quantity and @unit">​
 + <​xsl:​attribute name="​title"><​xsl:​value-of select="​concat(@quantity,'​ ',​@unit)"/></​xsl:​attribute>​
 + </​xsl:​if>​
 + <​xsl:​text>​[...]</​xsl:​text>​
 + </​span>​
 + <​xsl:​call-template name="​spacing"/>​
 + </​xsl:​template>​
 +                ​
 + <​xsl:​template match="//​tei:​lb">​
 + <​xsl:​variable name="​lbcount">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​ancestor::​tei:​ab"><​xsl:​number from="​tei:​ab"​ level="​any"/></​xsl:​when>​
 + <​xsl:​when test="​ancestor::​tei:​p"><​xsl:​number from="​tei:​p"​ level="​any"/></​xsl:​when>​
 + <​xsl:​otherwise>​999</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 + <​xsl:​if test="​@rend='​hyphen(-)'"><​span class="​hyphen">​-</​span></​xsl:​if>​
 + <​xsl:​if test="​@rend='​hyphen(=)'"><​span class="​hyphen">​=</​span></​xsl:​if>​
 + <​xsl:​if test="​ancestor::​tei:​w and not(contains(@rend,'​hyphen'​))"><​span class="​hyphen-added">​-</​span></​xsl:​if>​
 + <​xsl:​if test="​not($lbcount=1) or preceding-sibling::​node()[matches(.,'​\S'​)]"><​br/><​xsl:​text>&#​xa;</​xsl:​text></​xsl:​if>​
 + <​xsl:​if test="​@n and not(@rend='​prose'​)">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​matches(@n,'​^[0-9]*[05]$'​)">​
 + <​!--<​a title="​{@n}"​ class="​verseline"​ style="​position:​relative">​ </​a>​-->​
 + <​!--<​span class="​verseline"><​span class="​verselinenumber"><​xsl:​value-of select="​@n"/></​span></​span>​-->​
 + <​span class="​verselinenumber"><​xsl:​value-of select="​@n"/></​span>​
 +
 + </​xsl:​when>​
 + <​xsl:​when test="​matches(@n,'​[^0-9]'​)">​
 + <​!--<​a title="​{@n}"​ class="​verseline"​ style="​position:​relative">​ </​a>​-->​
 + <​!--<​span class="​verseline"><​span class="​verselinenumber"><​xsl:​value-of select="​@n"/></​span></​span>​-->​
 + <​span class="​verselinenumber"><​xsl:​value-of select="​@n"/></​span>​
 + </​xsl:​when>​
 + <​xsl:​otherwise>​
 + </​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​if>​
 + </​xsl:​template>​
 +
 + <!-- Page breaks --> ​               ​
 + <​xsl:​template match="//​*[local-name()=$pagination-element]">​
 +
 + <​xsl:​variable name="​next-word-position"​ as="​xs:​integer">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​following::​*[local-name()=$word-element]">​
 + <​xsl:​value-of select="​count(following::​*[local-name()=$word-element][1]/​preceding::​*[local-name()=$word-element])"/>​
 + </​xsl:​when>​
 + <​xsl:​otherwise>​0</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 + <​xsl:​variable name="​next-pb-position"​ as="​xs:​integer">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​following::​*[local-name()=$pagination-element]">​
 + <​xsl:​value-of select="​count(following::​*[local-name()=$pagination-element][1]/​preceding::​*[local-name()=$word-element])"/>​
 + </​xsl:​when>​
 + <​xsl:​otherwise>​999999999</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 + <​xsl:​variable name="​next-word-id">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​$next-pb-position - $next-word-position = 999999999">​w_0</​xsl:​when>​
 + <​xsl:​when test="​$next-pb-position &gt; $next-word-position"><​xsl:​value-of select="​following::​*[local-name()=$word-element][1]/​@id"/></​xsl:​when>​
 + <​xsl:​otherwise>​w_0</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 +
 +
 + <​xsl:​variable name="​editionpagetype">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​ancestor::​tei:​ab">​editionpageverse</​xsl:​when>​
 + <​xsl:​otherwise>​editionpage</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 + <​xsl:​variable name="​pagenumber">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​@n"><​xsl:​value-of select="​@n"/></​xsl:​when>​
 + <​xsl:​when test="​@facs"><​xsl:​value-of select="​substring-before(@facs,'​.'​)"/></​xsl:​when>​
 + <​xsl:​otherwise>​[NN]</​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 +
 + <​xsl:​variable name="​page_id"><​xsl:​value-of select="​count(preceding::​*[local-name()=$pagination-element])"/></​xsl:​variable>​
 +
 + <​xsl:​if test="//​tei:​note[not(@place='​inline'​) and not(matches(@type,'​intern|auto'​))][following::​*[local-name()=$pagination-element][1][count(preceding::​*[local-name()=$pagination-element]) = $page_id]]">​
 + <​xsl:​text>&#​xa;</​xsl:​text>​
 + <​br/>​
 + <​br/>​
 + <span style="​display:​block;​border-top-style:​solid;​border-top-width:​1px;​border-top-color:​gray;​padding-top:​5px"> ​                                               ​
 + <​xsl:​for-each select="//​tei:​note[not(@place='​inline'​) and not(matches(@type,'​intern|auto'​))][following::​*[local-name()=$pagination-element][1][count(preceding::​*[local-name()=$pagination-element]) = $page_id]]">​
 + <​xsl:​variable name="​note_count"><​xsl:​value-of select="​count(preceding::​tei:​note[matches(@type,'​^(apparat|identification|zoologique)$'​)]) + 1"/></​xsl:​variable>​
 + <​!--<​p><​xsl:​value-of select="​$note_count"/>​. <a href="#​noteref_{$note_count}"​ name="​note_{$note_count}">​[<​xsl:​value-of select="​preceding::​tei:​cb[1]/​@xml:​id"/>,​ l. <​xsl:​value-of select="​preceding::​tei:​lb[1]/​@n"/>​]</​a><​xsl:​text>​ </​xsl:​text>​ <​xsl:​value-of select="​."/></​p>​-->​
 + <​span class="​note">​
 + <​span style="​position:​absolute;​left:​-30px"><​a href="#​noteref_{$note_count}"​ name="​note_{$note_count}"><​xsl:​value-of select="​$note_count"/></​a>​. </​span>​
 + <​xsl:​apply-templates mode="#​current"/>​
 + </​span> ​                                                               ​
 + </​xsl:​for-each></​span><​xsl:​text>&#​xa;</​xsl:​text> ​                                                               ​
 +
 + </​xsl:​if>​
 +
 +
 + <​xsl:​text>&#​xa;</​xsl:​text>​
 + <​br/><​xsl:​text>&#​xa;</​xsl:​text>​
 +
 + <a class="​txm-page"​ title="​{count(preceding::​*[local-name()=$pagination-element]) + $page-number-adjust}"​ next-word-id="​{$next-word-id}"/>​
 +
 + <span class="​{$editionpagetype}">​ &​lt;<​xsl:​value-of select="​$pagenumber"/>&​gt;​ </​span><​br/><​xsl:​text>&#​xa;</​xsl:​text>​
 + </​xsl:​template>​
 +
 + <!-- Notes -->
 + <​xsl:​template match="​tei:​note">​
 + <​!--<​span style="​color:​violet">​ [<​b>​Note :</b> <​xsl:​apply-templates/>​] </​span>​-->​
 + <​xsl:​variable name="​note_count"><​xsl:​value-of select="​count(preceding::​tei:​note[matches(@type,'​^(apparat|identification|zoologique)$'​)]) + 1"/></​xsl:​variable>​
 + <​xsl:​variable name="​note_content">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​descendant::​txm:​form">​
 + <​xsl:​for-each select="​descendant::​txm:​form">​
 + <​xsl:​value-of select="​."/>​
 + <​xsl:​if test="​not(matches(following::​txm:​form[1],'​^[.,​\)]'​)) and not(matches(.,'​^\S+[''​’]$|^[‘\(]$'​))">​
 + <​xsl:​text>​ </​xsl:​text>​
 + </​xsl:​if>​
 + </​xsl:​for-each>​
 + </​xsl:​when>​
 + <​xsl:​otherwise><​xsl:​value-of select="​normalize-space(.)"/></​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​variable>​
 + <​xsl:​choose>​
 + <​xsl:​when test="​matches(@type,'​intern|auto'​)"></​xsl:​when>​
 + <​xsl:​when test="​@place='​inline'"><​span class="​note">​ (Note : <​xsl:​value-of select="​$note_content"/>​)</​span></​xsl:​when>​
 + <​xsl:​when test="​not(@place='​inline'​) and not(matches(@type,'​intern|auto'​))">​
 + <a title="​{$note_content}"​ style="​font-size:​75%;​position:​relative;​top:​-5px"​ href="#​note_{$note_count}"​ name="​noteref_{$note_count}">​[<​xsl:​value-of select="​$note_count"/>​]</​a>​
 + </​xsl:​when>​
 + <​xsl:​otherwise><​span class="​noteref"​ title="​{$note_content}">​[•]</​span></​xsl:​otherwise>​
 + </​xsl:​choose>​
 + <​xsl:​call-template name="​spacing"/> ​                               ​
 + </​xsl:​template>​
 +
 + <​!--<​xsl:​template match="​tei:​bibl">​
 + <span class="​noteref"​ title="​{normalize-space(.)}">​[•]</​span>​
 + </​xsl:​template>​-->​
 +
 + <​xsl:​template match="​a[@class='​txmpageref'​]">​
 + <​xsl:​copy-of select="​."/>​
 + </​xsl:​template>​
 +
 + <​!--<​xsl:​template match="​tei:​note[@place='​inline'​]">​
 + <span class="​noteinline">​
 + <​xsl:​apply-templates/>​
 + </​span>​
 + </​xsl:​template>​
 +   ​--> ​            
 +                <​xsl:​template match="//​tei:​w"><​span class="​w">​
 +                <​xsl:​choose>​
 +                <​xsl:​when test="​descendant::​tei:​c//​txm:​form">​
 +                <​xsl:​apply-templates select="​descendant::​tei:​c"/>​
 +                </​xsl:​when>​
 +                <​xsl:​otherwise>​
 +                <​xsl:​if test="​@*:​id">​
 +                <​xsl:​attribute name="​id"><​xsl:​value-of select="​@*:​id"/></​xsl:​attribute>​
 +                </​xsl:​if>​
 +                <​xsl:​attribute name="​title">​
 +                <​xsl:​for-each select="​@*[not(matches(local-name(.),'​id'​))]">​
 +                <​xsl:​value-of select="​concat(name(.),'​ : ',​.,'​ ; '​)"/>​
 +                </​xsl:​for-each>​
 +                <​xsl:​if test="​descendant::​txm:​ana">​
 +                <​xsl:​for-each select="​descendant::​txm:​ana">​
 +                <​xsl:​value-of select="​concat(substring-after(@type,'#'​),'​ : ',​.,'​ ; '​)"/>​
 +                </​xsl:​for-each>​
 +                </​xsl:​if>​
 +                </​xsl:​attribute>​
 +                <​xsl:​choose>​
 +                <​xsl:​when test="​descendant::​txm:​form">​
 +                <​xsl:​apply-templates select="​txm:​form"/>​
 +                </​xsl:​when>​
 +                <​xsl:​otherwise><​xsl:​apply-templates/></​xsl:​otherwise>​
 +                </​xsl:​choose>​
 +                </​xsl:​otherwise>​
 +                </​xsl:​choose>​
 +                                </​span><​xsl:​call-template name="​spacing"/></​xsl:​template>​
 +                ​
 +<​!-- ​               <​xsl:​template match="//​txm:​form">​
 +                                <​xsl:​apply-templates/>​
 +                </​xsl:​template>​
 +--> ​               ​
 +
 +
 + <​xsl:​template name="​spacing">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​$inputtype='​xmltxm'">​
 + <​xsl:​call-template name="​spacing-xmltxm"/>​
 + </​xsl:​when>​
 + <​xsl:​otherwise>​
 + <​xsl:​call-template name="​spacing-xmlw"/>​
 + </​xsl:​otherwise>​
 + </​xsl:​choose>​
 + </​xsl:​template>​
 +
 + <​xsl:​template name="​spacing-xmlw">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​ancestor::​tei:​w"/>​
 + <​xsl:​when test="​following::​tei:​w[1][matches(.,'​^\s*[.,​)\]]+\s*$'​)]"/>​
 + <​xsl:​when test="​matches(.,'​^\s*[(\[‘]+$|\w(''​|’)\s*$'​)"></​xsl:​when>​
 + <​xsl:​when test="​position()=last() and (ancestor::​tei:​choice or ancestor::​tei:​supplied[not(@rend='​multi_s'​)])"></​xsl:​when>​
 + <​xsl:​when test="​following-sibling::​*[1][self::​tei:​note]"></​xsl:​when>​
 + <​xsl:​when test="​following::​tei:​w[1][matches(.,'​^\s*[:;​!?​]+\s*$'​)]">​
 + <​xsl:​text>&#​xa0;</​xsl:​text>​
 + </​xsl:​when>​
 + <​xsl:​otherwise>​
 + <​xsl:​text>​ </​xsl:​text>​
 + </​xsl:​otherwise>​
 + </​xsl:​choose> ​               ​
 + </​xsl:​template>​
 +
 + <​xsl:​template name="​spacing-xmltxm">​
 + <​xsl:​choose>​
 + <​xsl:​when test="​ancestor::​tei:​w"/>​
 + <​xsl:​when test="​following::​tei:​w[1][matches(descendant::​txm:​form[1],'​^[.,​)\]]+$'​)]"/>​
 + <​xsl:​when test="​matches(descendant::​txm:​form[1],'​^[(\[‘]+$|\w(''​|’)$'​)"></​xsl:​when>​
 + <​xsl:​when test="​position()=last() and (ancestor::​tei:​choice or ancestor::​tei:​supplied[not(@rend='​multi_s'​)])"></​xsl:​when>​
 + <​xsl:​when test="​following-sibling::​*[1][self::​tei:​note]"></​xsl:​when>​
 + <​xsl:​when test="​following::​tei:​w[1][matches(descendant::​txm:​form[1],'​^[:;​!?​]+$'​)]">​
 + <​xsl:​text>&#​xa0;</​xsl:​text>​
 + </​xsl:​when>​
 + <​xsl:​otherwise>​
 + <​xsl:​text>​ </​xsl:​text>​
 + </​xsl:​otherwise>​
 + </​xsl:​choose> ​               ​
 + </​xsl:​template>​
 +
 +                ​
 +</​xsl:​stylesheet>​
 </​code>​ </​code>​
  
Ligne 1102: Ligne 1941:
  
 <code XML> <code XML>
 +<?xml version="​1.0"​ encoding="​utf-8"?>​
 +<​xsl:​stylesheet exclude-result-prefixes="#​all"​
 +  xmlns:​xsl="​http://​www.w3.org/​1999/​XSL/​Transform"​
 +  xmlns:​xs="​http://​www.w3.org/​2001/​XMLSchema"​
 +  version="​2.0">​
 +  <!--
 +This software is dual-licensed:​
 +
 +1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
 +Unported License http://​creativecommons.org/​licenses/​by-sa/​3.0/ ​
 +
 +2. http://​www.opensource.org/​licenses/​BSD-2-Clause
 +
 +All rights reserved.
 +
 +Redistribution and use in source and binary forms, with or without
 +modification,​ are permitted provided that the following conditions are
 +met:
 +
 +* Redistributions of source code must retain the above copyright
 +notice, this list of conditions and the following disclaimer.
 +
 +* Redistributions in binary form must reproduce the above copyright
 +notice, this list of conditions and the following disclaimer in the
 +documentation and/or other materials provided with the distribution.
 +
 +This software is provided by the copyright holders and contributors
 +"as is" and any express or implied warranties, including, but not
 +limited to, the implied warranties of merchantability and fitness for
 +a particular purpose are disclaimed. In no event shall the copyright
 +holder or contributors be liable for any direct, indirect, incidental,
 +special, exemplary, or consequential damages (including, but not
 +limited to, procurement of substitute goods or services; loss of use,
 +data, or profits; or business interruption) however caused and on any
 +theory of liability, whether in contract, strict liability, or tort
 +(including negligence or otherwise) arising in any way out of the use
 +of this software, even if advised of the possibility of such damage.
 +
 +     $Id$
 +     
 +This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz 
 +available at 
 +https://​github.com/​TEIC/​Stylesheets/​blob/​master/​tools/​processpb.xsl ​
 +and is adapted by Alexei Lavrentiev to split an HTML edition for 
 +TXM platform.
 +
 +  -->
 +  <​xsl:​output indent="​no"​ method="​html"/>​
 +  ​
 +  <​xsl:​param name="​css-name-txm">​txm</​xsl:​param>​
 +  <​xsl:​param name="​css-name"><​!--<​xsl:​value-of select="​$current-corpus-name"/>​-->​perseus</​xsl:​param>​
 +  <​xsl:​param name="​edition-name">​default</​xsl:​param>​
 +  <​xsl:​param name="​number-words-per-page">​999999</​xsl:​param>​
 +  <​xsl:​param name="​pagination-element">​a[@class='​txm-page'​]</​xsl:​param>​
 +  <​xsl:​param name="​output-directory"><​xsl:​value-of select="​concat($current-file-directory,'/',​$edition-name)"/></​xsl:​param>​
 +  ​
 +  <​xsl:​variable name="​current-file-name">​
 +    <​xsl:​analyze-string select="​document-uri(.)"​ regex="​^(.*)/​([^/​]+)\.[^/​]+$">​
 +      <​xsl:​matching-substring>​
 +        <​xsl:​value-of select="​regex-group(2)"/>​
 +      </​xsl:​matching-substring>​
 +    </​xsl:​analyze-string>​
 +  </​xsl:​variable>​
 +  ​
 +  <​xsl:​variable name="​current-file-directory">​
 +    <​xsl:​analyze-string select="​document-uri(.)"​ regex="​^(.*)/​([^/​]+)\.[^/​]+$">​
 +      <​xsl:​matching-substring>​
 +        <​xsl:​value-of select="​regex-group(1)"/>​
 +      </​xsl:​matching-substring>​
 +    </​xsl:​analyze-string>​
 +  </​xsl:​variable>​
 +  ​
 +  <​xsl:​variable name="​current-corpus-name">​
 +    <​xsl:​analyze-string select="​$current-file-directory"​ regex="​^(.*)/​([^/​]+)$">​
 +      <​xsl:​matching-substring>​
 +        <​xsl:​value-of select="​regex-group(2)"/>​
 +      </​xsl:​matching-substring>​
 +    </​xsl:​analyze-string>​
 +  </​xsl:​variable>​
 +  ​
 +  ​
 +  <​xsl:​template match="​html/​body">​
 +    <​xsl:​variable name="​pages">​
 +      <​xsl:​copy>​
 +        <​xsl:​apply-templates select="​@*"/>​
 +        <​xsl:​apply-templates
 +          select="​*|processing-instruction()|comment()|text()"/>​
 +      </​xsl:​copy>​
 +    </​xsl:​variable>​
 +    <​xsl:​for-each select="​$pages">​
 +      <​xsl:​apply-templates ​ mode="​pass2"/>​
 +    </​xsl:​for-each>​
 +    <!-- creating title page with metadata -->
 +  </​xsl:​template>​
 +  ​
 +  ​
 +  <!-- first (recursive) pass. look for <pb> elements and group on them -->
 +  <​xsl:​template match="​comment()|@*|processing-instruction()|text()">​
 +    <​xsl:​copy-of select="​."/>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​*">​
 +    <​xsl:​call-template name="​checkpb">​
 +      <​xsl:​with-param name="​eName"​ select="​local-name()"/>​
 +    </​xsl:​call-template>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​a[@class='​txm-page'​]">​
 +    ​
 +    <​!-- ​   <​xsl:​variable name="​next-word-position"​ as="​xs:​integer">​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​following::​span[@class='​w'​]">​
 +          <​xsl:​value-of select="​count(following::​span[@class='​w'​][1]/​preceding::​span[@class='​w'​])"/>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​20</​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +    </​xsl:​variable>​
 +    <​xsl:​variable name="​next-pb-position"​ as="​xs:​integer">​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​following::​a[@class='​txm-page'​]">​
 +          <​xsl:​value-of select="​count(following::​a[@class='​txm-page'​][1]/​preceding::​span[@class='​w'​])"/>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​999999999</​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +    </​xsl:​variable>​
 +    <​!-\-<​xsl:​value-of select="​count(following::​a[@class='​txm-page'​][1]/​preceding::​a[@class='​w'​])"/>​-\->​
 +    <​xsl:​variable name="​next-word-id">​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​$next-pb-position - $next-word-position = 999999999"><​!-\-w_0-\-><​xsl:​value-of select="​concat($next-pb-position,'​ - ',​$next-word-position)"/></​xsl:​when>​
 +        <​xsl:​when test="​$next-pb-position &gt; $next-word-position"><​xsl:​value-of select="​following::​*:​span[@class='​w'​][1]/​@id"/></​xsl:​when>​
 +        <​xsl:​otherwise><​!-\- w_0 -\-><​xsl:​value-of select="​concat($next-pb-position,'​ - ',​$next-word-position)"/></​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +    </​xsl:​variable>​-->​
 +    ​
 +    ​
 +    <​!-- ​ <a xmlns="​http://​www.w3.org/​1999/​xhtml"> ​ -->
 +    ​
 +    <a>
 +      <​xsl:​copy-of select="​@*"/>​
 +      <​!--<​xsl:​attribute name="​next-word-id"><​xsl:​value-of select="​$next-word-id"/></​xsl:​attribute>​-->​
 +    </a>
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template name="​checkpb">​
 +    <​xsl:​param name="​eName"/>​
 +    <​xsl:​choose>​
 +      <​xsl:​when test="​not(.//​a[@class='​txm-page'​])">​
 +        <​xsl:​copy-of select="​."/>​
 +      </​xsl:​when>​
 +      <​xsl:​otherwise>​
 +        <​xsl:​variable name="​pass">​
 +          <​xsl:​call-template name="​groupbypb">​
 +            <​xsl:​with-param name="​Name"​ select="​$eName"/>​
 +          </​xsl:​call-template>​
 +        </​xsl:​variable>​
 +        <​xsl:​for-each select="​$pass">​
 +          <​xsl:​apply-templates/>​
 +        </​xsl:​for-each>​
 +      </​xsl:​otherwise>​
 +    </​xsl:​choose>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template name="​groupbypb">​
 +    <​xsl:​param name="​Name"/>​
 +    <​xsl:​for-each-group select="​node()"​ group-starting-with="​a[@class='​txm-page'​]">​
 +      <​xsl:​choose>​
 +        <​xsl:​when test="​self::​a[@class='​txm-page'​]">​
 +          <​xsl:​copy-of select="​."/>​
 +          <​xsl:​element name="​{$Name}">​
 +            <​xsl:​attribute name="​rend">​CONTINUED</​xsl:​attribute>​
 +            <​xsl:​apply-templates select="​current-group() except ."/>​
 +          </​xsl:​element>​
 +        </​xsl:​when>​
 +        <​xsl:​otherwise>​
 +          <​xsl:​element name="​{$Name}">​
 +            <​xsl:​for-each select="​..">​
 +              <​xsl:​copy-of select="​@*"/>​
 +              <​xsl:​apply-templates select="​current-group()"/>​
 +            </​xsl:​for-each>​
 +          </​xsl:​element>​
 +        </​xsl:​otherwise>​
 +      </​xsl:​choose>​
 +    </​xsl:​for-each-group>​
 +  </​xsl:​template>​
 +  ​
 +  <!-- second pass. group by <pb> (now all at top level) and wrap groups
 +       in <​page>​ -->
 +  <​xsl:​template match="​*"​ mode="​pass2">​
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*|*|processing-instruction()|comment()|text()"​ mode="​pass2"/>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +  ​
 +  <​xsl:​template match="​comment()|@*|processing-instruction()|text()"​ mode="​pass2">​
 +    <​xsl:​copy-of select="​."/>​
 +  </​xsl:​template>​
 +  ​
 +  ​
 +  ​
 +  <​!-- <​xsl:​variable name="​style">​
 +   <​xsl:​copy-of select="/​html/​head[1]/​style[1]"></​xsl:​copy-of>​
 + </​xsl:​variable>​-->​
 +  ​
 +  <​xsl:​template match="​*[a[@class='​txm-page'​]]"​ mode="​pass2"​ >    ​
 +    ​
 +    <​xsl:​copy>​
 +      <​xsl:​apply-templates select="​@*"/>​
 +      <​xsl:​for-each-group select="​*"​ group-starting-with="​a[@class='​txm-page'​]">​
 +        <​xsl:​choose>​
 +          <​xsl:​when test="​self::​a[@class='​txm-page'​]">​
 +            <​xsl:​comment>​ Page <​xsl:​value-of select="​@title"/>​ déplacée vers <​xsl:​value-of select="​concat($output-directory,'/',​$current-file-name,'​_',​@title,'​.html'​)"/></​xsl:​comment>​
 +            <​xsl:​result-document href="​{$output-directory}/​{$current-file-name}_{@title}.html/">​
 +              <​html>​
 +                <​head>​
 +                  <meta name="​txm:​first-word-id"​ content="​{@next-word-id}"/>​
 +                  <​title><​xsl:​value-of select="​concat($current-file-name,',​ Page ',​@title)"/></​title>​
 +                  <meta http-equiv="​Content-Type"​ content="​text/​html;​charset=UTF-8"/>​
 +                  <link rel="​stylesheet"​ media="​all"​ type="​text/​css"​ href="​css/​{$css-name-txm}.css"/>​
 +                  <xsl:if test="​matches($css-name,'​\S'​)"><​link rel="​stylesheet"​ media="​all"​ type="​text/​css"​ href="​css/​{$css-name}.css"/></​xsl:​if>​
 +                  <​!--<​xsl:​copy-of select="​$style"/>​-->​
 +                </​head>​
 +                <​body>​
 +                  <div class="​txmeditionpage">​
 +                    <​xsl:​copy-of select="​current-group() except ."/>​
 +                  </​div>​
 +                </​body>​
 +              </​html>​
 +            </​xsl:​result-document>​
 +            ​
 +          </​xsl:​when>​
 +          <​xsl:​otherwise>​
 +            <​xsl:​copy-of select="​current-group()"/>​
 +          </​xsl:​otherwise>​
 +        </​xsl:​choose>​
 +      </​xsl:​for-each-group>​
 +    </​xsl:​copy>​
 +  </​xsl:​template>​
 +  ​
 +</​xsl:​stylesheet>​
 </​code>​ </​code>​
  
 +**[[public:​perseus|>>>​ Back to TXM Perseus Projects main page]]**
public/perseus_201707_plato.1512145668.txt.gz · Dernière modification: 2017/12/01 17:27 par benedicte.pincemin@ens-lyon.fr