Commit c07c3813 authored by Morgane Pica's avatar Morgane Pica
Browse files

Adding the MaX queries and transfos.

parent da9a7333
Loading
Loading
Loading
Loading
+138 −0
Changes for MaX-tools/document_toc.xq: 138 added lines, 0 removed lines.
Original line number Diff line number Diff line
import module namespace max.config = 'pddn/max/config' at '../../../rxq/config.xqm';
import module namespace max.alignment = 'pddn/max/alignment' at '../../../rxq/alignment.xqm';
import module namespace max.html = 'pddn/max/html' at '../../../rxq/html.xqm';
(:import module namespace max.tei_toc = 'pddn/max/tei/tei_toc.xqm' at '../../../rxq/tei/tei_toc.xqm';:)

declare variable $baseURI external;
declare variable $dbPath external;
declare variable $project external;
declare variable $doc external;



declare function local:subChapter($chapter, $project, $doc){
	let $subChapters := $chapter/*:div[@*:id]
	return if($chapter/*:div) then(
	<ul>{
		for $subChapter in $chapter/*:div[@*:id]
		let $title := if($subChapter/*:head) then(
			if($subChapter/*:head[2]) then(
				let $title := <head>{$subChapter/*:head[1]/*:w}{$subChapter/*:head[2]/*:w}</head>
				return $title
			)
			else(<head>{if($subChapter/*:head/*:w) then($subChapter/*:head/*:w) else($subChapter/*:head)}</head>)
			)
		else(
			if($subChapter[@subtype='introduction']) then("[Introduction]")
			else(
				if($subChapter[@subtype='coutume']) then("[Coutume de Normandie]")
				else(
					if($subChapter[@subtype='usages-locaux']) then("[Usages locaux]")
					else(
						if($subChapter[@subtype='articles-placitez']) then("[Articles Placités]")
						else(
							if($subChapter[@subtype='editions']) then("[Éditions de textes législatifs]")
							else(if($subChapter[@subtype='salut']) then("[Salut]")
								else("[Sans titre]")
								)
							)
						)
					)
				)
			)
		let $idPointer := $subChapter/@xml:id
		(: MP :
		Si les titres n'ont que des chiffres romains en titre, dans de gros fichiers comme Basnage, 
		ça peut rendre la TOC inutilisable. Donc en plus des titres, s'il y a une citation en début
		de section, j'en convoque les 15 premiers tokens : cette citation est généralement le texte
		commenté dans la section courante, donc ça permet de savoir de quoi on parle dans cette
		section, même sans titre. :)
		let $quoteInTitle := if($subChapter/*:quote/child::*/*:w[16]) then(<quote><w>:</w><w> 	
&#171;&#160;</w>{subsequence($subChapter/*:quote/child::*/*:w, 1, 15)}<w>&#8230;&#160;&#187;</w></quote>) else(if($subChapter/*:quote) then(<quote><w>:</w><w> 	
&#171;&#160;</w>{subsequence($subChapter/*:quote/child::*/*:w, 1, 15)}<w>&#160;&#187;</w></quote>))
		let $type := $subChapter/@type
		return
			<li id="{$idPointer}" type="{$type}">
				<a data-href="{concat(max.config:getBaseURI(), $project, '/', $doc, '/', $idPointer, '.html')}">{
					if($type = "chapter") then($title) else(
						if($subChapter/*:quote) then($title, $quoteInTitle) else($title)
						
						)
					}</a>
				{if($type = "chapter") then(local:subChapter($subChapter, $project, $doc))}
			</li>
		}
	</ul>
	)
};

	
	(: MP :
	Cette partie de la query retourne les grandes parties de la TOC.
	
	La query se base ici sur tous les petits-enfants de /TEI/text, pour
	pouvoir donner accès aussi à la matière liminaire et aux appendices.
	Pour pouvoir les séparer du corps du texte sur la page HTML, la query
	garde trace du parent front/body/back dans l'@type.
	
	Si la partie ne contient pas de titre, la query regarde le @subtype
	(ils sont uniformisés quand c'était possible) pour pouvoir avoir un
	titre par défaut si possible. Sinon, on écrit "[Sans titre]".
	
	On n'appelle la fonction $subChapter que si la partie appartient au
	/TEI/text/body puisque dans le /TEI/text/front et /TEI/text/back,
	les (très) rares sous-parties n'ont pas d'intérêt à être convoquées.
	
	ATTENTION, ne pas enlever la <div> car sinon la query n'est pas
	valide pour MaX. Idem : une seule <div> en racine. :)
	
	<div type="maindiv">{
    	for $chapter in doc(concat($dbPath,'/', $doc))//*:text/*/*
    	let $title := if($chapter/*:docTitle) then("[Page de titre]")
    		else(
    		if($chapter/*:head) then(
    			if($chapter/*:head/*:w) then(<head>{$chapter/*:head/*:w}</head>) else(<head>{$chapter/*:head}</head>)
    			) else(
				if($chapter[@subtype='introduction']) then("[Introduction]")
				else(
					if($chapter[@subtype='coutume']) then("[Coutume de Normandie]")
					else(
						if($chapter[@subtype='usages-locaux']) then("[Usages locaux]")
						else(
							if($chapter[@subtype='articles-placitez']) then("[Articles Placités]")
							else(
								if($chapter[@subtype='editions']) then("[Éditions d'autres textes législatifs]")
								else(if($chapter[@subtype='salut']) then("[Salut]")
									else(if($chapter[@subtype='intention']) then("[Note d'intention]")
										else("[Sans titre]")
										)
									)
								)
							)
						)
					)
				)
			)
    	let $type := if($chapter/ancestor::*:front) then("front") else(
    		if($chapter/ancestor::*:back) then("back") else("body")
    		)
    	let $idPointer := $chapter/@xml:id
    	return if($type="body") then(
    		<div>
            	<h4 class="livre">{$title}</h4>
            	<ul>{local:subChapter($chapter, $project, $doc)}</ul>
        	</div>
        	) else(
    		<div type="{$type}" id="{$idPointer}" data-href="{concat(max.config:getBaseURI(), $project, '/', $doc, '/', $idPointer, '.html')}">
            	<h4>{$title}</h4>
        	</div>
        	)
    }</div>







+219 −0
Changes for MaX-tools/document_toc.xsl: 219 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" version="2.0" exclude-result-prefixes="tei xsl">
	<xsl:template match="/">
		<div id="document-toc">
			<xsl:apply-templates/>
		</div>
	</xsl:template>
	<xsl:template match="h2">
		<xsl:text> </xsl:text>
		<h2>
			<xsl:apply-templates/>
		</h2>
	</xsl:template>
	<xsl:template match="h3">
		<h3>
			<xsl:apply-templates/>
		</h3>
	</xsl:template>
	<xsl:template match="h4">
			<h4 class="parttitle"><b><xsl:apply-templates/></b></h4>
	</xsl:template>

	
	<!-- MP
		La query produit des listes dans des listes, mais elle indique
	aussi le niveau de profondeur de chaque <div> trouvée.
	En fonction de cet @type, on choisit la mise en forme de chaque
	élément. -->
	<xsl:template match="li">
		<xsl:variable name="href"><xsl:value-of select="a/@data-href"/></xsl:variable>
		<xsl:variable name="id"><xsl:value-of select="@id"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="@type='chapter' and not(child::ul)">
				<details class="hover">
					<xsl:apply-templates/>
				</details>
			</xsl:when>
			<xsl:when test="@type='chapter'">
				<details class="hover">
					<xsl:apply-templates/>
				</details>
			</xsl:when>
			<xsl:otherwise>
				<li id="{@id}">
					<xsl:apply-templates/>
				</li>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<!-- MP
		Les fichiers TEI ont 3 niveaux de div ('part' > 'chapter' > 'section') et elles sont nombreuses, donc je voulais que le dernier
	niveau soit déroulable. Donc, si le niveau de div concerné est un "chapter", elle devient un bouton controlant l'affichage ou non
	des "section" contenues dans le chapitre, de manière à n'avoir jamais plus qu'un chapitre déroulé à la fois.
	-->
	<xsl:template match="a">
		<xsl:variable name="href">
			<xsl:value-of select="@data-href"/>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="self::a[parent::li[@type='chapter']]">
				<summary href="{$href}">
					<xsl:apply-templates/><xsl:text>  	
&#8212; </xsl:text>
					<a href="{$href}"><button>Lire tout le chapitre.</button></a>
				</summary>
			</xsl:when>
			<xsl:otherwise>
				<a href="{$href}">
					<xsl:apply-templates/>
				</a>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>	
	<!-- MP
		Pour la meme raison, puisque le chapitre est à présent un bouton, j'ai rajouté un élément de liste au-dessus des sections, avec
	les memes @id et @href que l'élément original de liste du chapitre, pour permettre si besoin l'affichage du chapitre entier.
	-->
	<xsl:template match="div[@type]"/>


	<xsl:template match="ul[ancestor::div[not(@type)]]">
		<xsl:variable name="href"><xsl:value-of select="parent::li/a/@data-href"/></xsl:variable>
		<xsl:variable name="id"><xsl:value-of select="parent::li/@id"/></xsl:variable>
		<xsl:choose>
			<xsl:when test="child::ul">
				<xsl:apply-templates/>
			</xsl:when>
			<xsl:when test="parent::li[@type='chapter']">
					<ol>
						<xsl:apply-templates/>
					</ol>
			</xsl:when>
			<xsl:when test="not(parent::li[@type='chapter']) and not(child::li)">
				<ul>
					<xsl:apply-templates/>
				</ul>
			</xsl:when>
			<xsl:when test="not(child::*)"/>
			<xsl:otherwise>
				<ul>
					<xsl:apply-templates/>
				</ul>
				<hr/>
			</xsl:otherwise>
		</xsl:choose>		
	</xsl:template>

	<!-- MP
		Ici, c'est la structuration du sommaire : on fait une TOC en trois parties.
		
		- S'il y a un /TEI/text/front, la transformation produit une première
		<div> avec son contenu, sinon la <div> n'est pas produite.
		- Au milieu, il y aura toujours une <div> avec le contenu du /TEI/text/body.
		- S'il y a un /TEI/text/back, on produit une dernière <div> pour son contenu.
		
		C'est possible parce que j'ai basé ma query sur tous les petits-enfants de /TEI/text
		et que j'ai exporté le parent front/body/back dans l'@type.
	 -->

	<xsl:template match="div[@type='maindiv']">
		<xsl:if test="div[@type='front']">
			<h3 class="parttitle">Matière liminaire</h3>
			<div class="sommaire">
				<ul>
					<xsl:for-each select="div[@type='front']">
					<xsl:variable name="href"><xsl:value-of select="@data-href"/></xsl:variable>
						<xsl:variable name="id"><xsl:value-of select="@id"/></xsl:variable>
						<xsl:variable name="title"><xsl:apply-templates select="child::h4"/></xsl:variable>
						<ul>
							<li id="{$id}" type="section"><a href="{$href}"><xsl:value-of select="$title"/></a></li>
						</ul>
					</xsl:for-each>
					<hr/>
				</ul>
			</div>
		</xsl:if>
		<h3 class="parttitle">Corps du texte</h3>
		<div class="sommaire">
			<xsl:apply-templates/>
		</div>
		<xsl:if test="div[@type='back']">
			<h3 class="parttitle">Annexes</h3>
			<div class="sommaire">
				<ul>
					<xsl:for-each select="div[@type='back']">
						<xsl:variable name="href"><xsl:value-of select="@data-href"/></xsl:variable>
						<xsl:variable name="id"><xsl:value-of select="@id"/></xsl:variable>
						<xsl:variable name="title"><xsl:value-of select="child::h4"/></xsl:variable>
						<ul>
							<li id="{$id}" type="section"><a href="{$href}"><xsl:value-of select="$title"/></a></li>
						</ul>
					</xsl:for-each>
				</ul>
			</div>
		</xsl:if>
	</xsl:template>
	
	<!-- les éléments TEI -->
	<xsl:template match="tei:note[@type!='notice']"/>
	<xsl:template match="tei:rdg"/>
	<xsl:template match="tei:pb"/>
	<xsl:template match="tei:lb"/>
	<xsl:template match="tei:fw"/>		
	<xsl:template match="tei:catchwords"/>		
	<xsl:template match="tei:name">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="tei:head">
		<xsl:apply-templates/>
		<xsl:text> </xsl:text>
	</xsl:template>
	<xsl:template match="tei:add">
		<xsl:text> </xsl:text>
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="tei:app">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="tei:lem">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="tei:hi">
	 <span>
		 <xsl:attribute name="class">
			 <xsl:value-of select="@rend"/>
		 </xsl:attribute>
		 <xsl:apply-templates/>
	 </span>
	</xsl:template>
	

    <xsl:template match="tei:w[@join='left']">
    	<xsl:value-of select="node()"/>
    	<xsl:text> </xsl:text>
    </xsl:template>
        
    <!-- OVP: je fais ça un peu comme un boucher mais c’est un bon départ.
    MP : J'ajoute juste les tirets -.-->
    <xsl:template match="tei:w[not(@join='left')]">
        <xsl:variable name="nextW" select="following-sibling::tei:w[1]/@lemma"/>
        <xsl:value-of select="."/>
        <xsl:choose>
        	<!-- les cas avec une espace insécable -->
        	<xsl:when test="$nextW=';' or $nextW=':' or $nextW='?' or $nextW='!'">
            	<xsl:text>&#160;</xsl:text>
            </xsl:when>
            <!-- les cas sans espaces -->
        	<xsl:when test="$nextW=',' or $nextW='.' or $nextW='’' or $nextW='-' or @lemma='’' or @lemma='-'"/>           	
            <!-- sinon une espace simple -->          	
            <xsl:otherwise>
            	<xsl:text> </xsl:text>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
	
	
</xsl:stylesheet>
+67 −0
Changes for MaX-tools/index_references.xq: 67 added lines, 0 removed lines.
Original line number Diff line number Diff line
declare function local:get_docs_with_mentions($refdId){
    (: MP :
    On liste tous les documents contenant une mention de l'auteur courant.
    On renvoie une liste des témoins trouvés. Chaque <li> de témoin
    contient une autre liste construite par la fonction local:make_mention_list(),
    dont le premier élément sera le lien vers la document-toc du témoin courant. :)
    for $doc in collection("conde")[descendant::*:ref[@corresp=$refdId]]
    let $bibl := $doc//*:sourceDesc/*:bibl[@xml:id='temoin']
    let $date := if($bibl/*:date/@when) then($bibl/*:date/@when) else($bibl/*:date/@notBefore)
    let $datetext := if($bibl/*:date/@when) then($bibl/*:date/@when) else($bibl/*:date/text())
    let $editor := if($doc//*:titleStmt/*:editor) then(" (ed. "||string-join(($doc//*:titleStmt/*:editor),", ")||")") else()
    let $author := if($doc//*:titleStmt/*:author) then($doc//*:titleStmt/*:author/text()) else("anonyme")
    let $mentions := if(count($doc//*:ref[@corresp=$refdId]) = 1) then(" : 1 mention") else(concat(" : ",count($doc//*:ref[@corresp=$refdId])," mentions"))
    order by $date
    return <details><summary class='hover'>{"("||$datetext||") "||$author}{if($editor) then($editor) else()}{$mentions}</summary><ul><li><a target="_blank" rel="noopener noreferrer" href="{document-uri($doc)}" class="buttonlink">Sommaire de {$author}</a></li>{local:make_mention_list($doc, $refdId)}</ul></details>
};


declare function local:make_mention_list($doc, $refdId){
  (: MP :
  On fait la liste de toutes les mentions de la personne courante dans le témoin
  courant. On renvoie pour chaque un élément de liste avec l'identifiant de
  la section parente dans l'@href et le lien pour le retour au texte dans un <a>.
  La fonction renvoie toute la liste d'un coup.
  :)
  for $mention in $doc//*:ref
  where $mention/@corresp = $refdId
  let $parentId := $mention/ancestor::*:div[not(child::*:div)]/@xml:id
  let $parentName := if(contains(data($parentId), 'front')) then(concat('Matière liminaire, ',substring-after(data($parentId),'frontMatter-'))) else(if(contains(data($parentId), 'back')) then(concat('Appendices, ',substring-after(data($parentId),'backMatter-'))) else(concat('Corps du texte, ',substring-after(data($parentId),'alpha-'))))
  let $mentionNb := count($mention/preceding-sibling::*:ref[@corresp=$refdId]) +1
  let $wordNbs := if(count($mention/*:w)=1) then(data($mention/*:w/@n)) else(concat(data($mention/*:w[1]/@n), '-',data($mention/*:w[position()=last()]/@n)))
  return <li type="partname" href="{$parentId}">{$parentName} — <a target="_blank" rel="noopener noreferrer" href="{document-uri($doc)||'/'||$parentId||'.html#'||$wordNbs}">{$mentionNb||'e mention'}</a></li>
};


(: MP :
Query principale.
:)
<index type="personnes">{
  (: On fait la liste de chaque identifiant de notices bibliographiques différent dans le corpus.:)
  for $persId in distinct-values(collection("conde")//*:sourceDesc//*:listPerson//*:person/@xml:id)
  (: On ne garde que ceux qui sont effectivement référencés dans le corpus.:)
  where collection("conde")//*:ref[@corresp = concat("#",$persId)]
  let $refdId := concat('#', $persId)
  
  (: On va chercher la première notice de la personne courante et on extrait ses éventuelles dates. :)
  let $person := subsequence(collection("conde")//*:sourceDesc//*:listPerson//*:person[@xml:id=$persId],1,1)
  let $notice := if($person/@sameAs) then(data($person/@sameAs)) else('')
  let $birth := if($person//*:birth) then($person//*:birth/text()) else('')
  let $death := if($person//*:death) then($person//*:death/text()) else('')
  let $dates := if($birth != '') then(concat($birth, ' — ', $death)) else('')
  
  (: On va chercher les différentes formes possibles du nom enregistrées (français/anglais et/ou latin) individuellement.:)
  let $persFRENGname := if($person/*:persName[@xml:lang='fr']) then(string-join($person/*:persName[@xml:lang='fr']//text(),", ")) else(
    if($person/*:persName[@xml:lang='eng']) then(string-join($person/*:persName[@xml:lang='eng']//text(),", ")) else(''))
  let $persLATname := if($person/*:persName[@xml:lang='la']) then(string-join($person/*:persName[@xml:lang='la']//text(),", ")) else('')
  
  (: On combine les noms français/anglais et latin sans espace pour trier alphabétiquement.:)
  let $fullName := concat(replace(replace($persFRENGname, "\s", ""),"é","e"), replace(replace($persLATname, "\s", ""),"é","e"))
  let $initial := upper-case(substring($fullName,1,1))
  order by lower-case($fullName)
  
  (: On met en forme, selon quel(s) nom(s) est/sont présent(s). Puis on appelle la fonction
  local:get_docs_with_mentions() pour commencer la liste des mentions de la personne courante
  dans le corpus. :)
  return <details type="{$initial}" id="{$persId}"><summary class="hover"><span type="freng">{if($persFRENGname!='') then($persFRENGname) else()}</span>{if($dates != '' and $persFRENGname != '') then(concat(" [",$dates,"] ")) else()}{if ($persFRENGname!='' and $persLATname!='') then(', (')}{if ($persLATname!='') then (<span type="lat">{$persLATname}</span>) else()}{if ($persFRENGname!='' and $persLATname!='') then(')') else()}{if($persLATname !='' and $persFRENGname = '' and $dates!='') then(concat(' [',$dates,"] ")) else()}</summary><hr/>{if($notice != '') then(<a target="_blank" rel="noopener noreferrer" href="{$notice}">Notice d'autorité</a>) else()}{local:get_docs_with_mentions($refdId)}</details>
}</index>
 No newline at end of file
+145 −0
Changes for MaX-tools/index_references.xsl: 145 added lines, 0 removed lines.
Original line number Diff line number Diff line
<xsl:stylesheet version="2.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xinclude="http://www.w3.org/2001/XInclude"
  xmlns:xhtml="http://www.w3.org/TR/xhtml/strict"
  xmlns:tei="http://www.tei-c.org/ns/1.0"
  xmlns:ead="urn:isbn:1-931666-22-9"
  xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty"
  xmlns:max="https://max.unicaen.fr"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="max ead tei xsl xsi xs xlink xinclude xhtml tei hfp">
  <!--pour importer le i18n-->
  <xsl:import href="../../../../ui/xsl/i18n.xsl"/>
  <xsl:output method="xhtml" encoding="utf-8" indent="no"/>
  
<!--  <xsl:preserve-space elements="*:*"/>-->
  
  <!--variables pour le i18n-->
  <xsl:param name="project"/>
  <xsl:param name="locale"/>
  <xsl:param name="key"/>
  
  <!-- Copie des nœuds sans changement. -->
  <xsl:template match="node() | @*">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  
  <!-- MP
    Formatage des liens pour le retour au texte.
    - Si le lien est un lien général vers la document-toc (@class='buttonlink')
    on modifie le résultat de la query.
    - Sinon, c'est le lien vers la section d'une occurrence particulière,
    pas besoin de le reprendre.
  -->
  <xsl:template match="//a/@href">
    <xsl:choose>
      <xsl:when test="parent::a/@class='buttonlink'">
        <xsl:attribute name="href">
          <xsl:value-of select="replace(replace(replace(self::node(),'\}/', '}'), 'conde/', 'conde/sommaire/'),'.xml','.html')"/>
        </xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="href">
          <xsl:value-of select="self::node()"/>
        </xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
  <!-- MP
    Gestions des noms français/anglais.
    J'ai systématiquement ajouté des éléments <span> aux noms
    dans la query pour gérer les informations absentes.
    S'il y a un nom français/anglais (@type='freng'), on enlève le
    <span> et on le remplace par un <strong>.
  -->
  <xsl:template match="span[@type='freng']">
    <xsl:choose>
      <xsl:when test="contains(self::span, text())">
        <strong><xsl:value-of select="replace(self::span,'&#x2028;','')"/></strong>
      </xsl:when>
      <xsl:otherwise/>
    </xsl:choose>
  </xsl:template>
  
  <!-- MP
    Gestion des noms latins.
    J'ai systématiquement ajouté des éléments <span> aux noms
    dans la query pour gérer les informations absentes.
    S'il y a des noms latins et français, le nom latin ne prend
    qu'un élément <em>.
    S'il y a du latin mais pas du français/anglais, le latin prend un
    <strong> en plus.
    Sinon on peut enlever le <span>.
  -->
  <xsl:template match="span[@type='lat']">
    <xsl:choose>
      <xsl:when test="contains(self::span, text()) and preceding-sibling::span[@type='freng' and text()]">
        <i><xsl:value-of select="replace(self::span,'&#x2028;','')"/></i>
      </xsl:when>
      <xsl:when test="contains(self::span, text()) and preceding-sibling::span[@type='freng' and not(text())]">
        <strong><i><xsl:value-of select="replace(self::span,'&#x2028;','')"/></i></strong>
      </xsl:when>
      <xsl:otherwise/>
    </xsl:choose>
  </xsl:template>
  
  <!-- MP
    Utilisation des identifiants des <div> pour décrire chaque section
    contenant une mention de l'auteur courant.
    La variable $idlist fait une liste en tokenisant l'identifiant sur les -.
    Ensuite, selon l'ancêtre front/body/back de la section, le texte est
    construit autour des différents segments nécessaires de l'identifiant.
  -->
  <xsl:template match="li[@type='partname']">
    <xsl:variable name="idlist" select="tokenize(self::li/@href,'-')"/>
    <li>
    <xsl:choose>
      <xsl:when test="contains(self::li, 'Corps')">
        <xsl:value-of select="substring-before(self::li,',')"/>
        <xsl:text>, partie </xsl:text>
        <xsl:value-of select="subsequence($idlist,4,1)"/>
        <xsl:text>, chapitre </xsl:text>
        <xsl:value-of select="subsequence($idlist,5,1)"/>
        <xsl:text>, section </xsl:text>
        <xsl:value-of select="subsequence($idlist,6)"/>
        <xsl:text>  — </xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="substring-before(self::li,',')"/>
        <xsl:text>, section </xsl:text>
        <xsl:value-of select="subsequence($idlist,5,1)"/>
        <xsl:text>  — </xsl:text>
      </xsl:otherwise>
    </xsl:choose>
      <xsl:apply-templates select="self::li/*"/>
    </li>
  </xsl:template>
  
  <!-- MP
    Structuration de la page.
    On ajoute un titre et une explication, puis on fait un groupe
    par initiale (stockée par la query dans l'@type de chaque personne).
    Pour chaque groupe on ajoute l'initiale en titre.
  -->
  <xsl:template match="*:index[@type='personnes']">
    <div class="indexref"><h2 class="pageTitle">Références bibliographiques dans les coutumiers</h2>
      <hr/><p class="mention">Figures d'autorité citées par les auteurs des coutumiers édités par le projet ConDÉ.</p><hr/>
    <xsl:for-each-group select="child::*:details" group-by="replace(@type,'É','E')">
      <h2><xsl:value-of select="@type"/></h2>
      <div type="index">
          <xsl:for-each select="current-group()">
            <details>
              <xsl:apply-templates/>
            </details>
          </xsl:for-each>
      </div>
      <hr/>
    </xsl:for-each-group>
    </div>
  </xsl:template>
  
</xsl:stylesheet>

MaX-tools/readme.md

0 → 100644
+13 −0
Changes for MaX-tools/readme.md: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
# MaX queries and transformations

This directory contains some of the queries and transformations written by Morgane Pica to interrogate the corpus via the project website, which uses [MaX](https://www.unicaen.fr/recherche/mrsh/document_numerique/outils/max), an XML display engine based on [BaseX](https://basex.org/) and developped at the Maison de la Recherche en Sciences Sociales in the University of Caen. Usually, these files work in XQuery-XSLT pairs, wearing the same names and different format suffixes.
They may be used outside of MaX, although the HTML results are fragments and therefore lack HTML root, header or footer. A slight adaptation of the XSLTs or a manual addition will remedy this.
Some of the external variables may also not work as they are originally memorized and returned by MaX.
 #### index_references
 This set produces an index of authors quoted in the books edited by the ConDÉ project. This index records both the names and dates of authors, orders them and sorts them alphabetically. It also records the sections of text containing an actual mention of the person.
 
 #### toc
 This set produces the list of the documents in the ConDÉ corpus and orders them chronologically.
 
 #### document_toc
 This set produces the actual table of contents of one book, based on the fact that it has at least two levels of divisions.
 No newline at end of file
Loading