Loading plugins/metadata/archdesc.xsl 0 → 100644 +129 −0 Original line number Diff line number Diff line <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ead="urn:isbn:1-931666-22-9" xmlns:max="https://max.unicaen.fr" exclude-result-prefixes="ead xsl max"> <!-- Pour une xsl dans le dossier édition, modifier le chemin <xsl:import href="../../../../../ui/xsl/core/i18n.xsl"/>--> <xsl:import href="../../ui/xsl/core/i18n.xsl"/> <xsl:param name="project"/> <xsl:param name="locale"/> <xsl:template match="/"> <div> <xsl:apply-templates /> </div> </xsl:template> <xsl:template match="div/ead:*"> <table class="ead_details {local-name(.)}"> <tr> <th class="titreTabHeader"> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> <xsl:if test="@role"> <xsl:text>@</xsl:text> <xsl:value-of select="@role" /> </xsl:if> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </table> </xsl:template> <xsl:template match="div/ead:*//ead:*"> <xsl:choose> <!-- on masque par défaut certaines balises, comme p--> <xsl:when test="(local-name(.)='p')"> <xsl:apply-templates /> </xsl:when> <xsl:otherwise> <tr> <th> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> <xsl:if test="@role"> <xsl:text>@</xsl:text> <xsl:value-of select="@role" /> </xsl:if> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="div/ead:controlaccess/ead:subject | div/ead:controlaccess/ead:geogname"> <li class="{local-name(.)}"> <xsl:apply-templates /> </li> </xsl:template> <!-- on gère les éléments inline, comme emph, extref, et les lb --> <xsl:template match="//ead:emph"> <xsl:choose> <xsl:when test="./@render='bold'"> <span class="bold"> <xsl:apply-templates /> </span> </xsl:when> <xsl:otherwise> <xsl:apply-templates /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//ead:extref | //ead:archref"> <a href="{@href}" target="_blank"> <xsl:apply-templates /> </a> </xsl:template> <xsl:template match="//ead:lb"> <br/> </xsl:template> <!-- certains éléments sont à conserver dans le fil du texte comme les éléments date, addressline, language (peut dépendre du contexte) --> <xsl:template match="//ead:language | //ead:corpname"> <span class="{local-name(.)}"> <xsl:apply-templates /> </span> </xsl:template> <xsl:template match="//ead:address/ead:addressline"> <span class="addressline"><xsl:apply-templates /><br/></span> </xsl:template> <xsl:template match="//ead:head"> <h2> <xsl:apply-templates /> </h2> </xsl:template> <xsl:template match="//ead:list"> <ul> <xsl:apply-templates /> </ul> </xsl:template> <xsl:template match="//ead:item"> <li> <xsl:apply-templates /> </li> </xsl:template> </xsl:stylesheet> No newline at end of file plugins/metadata/eadheader.xsl 0 → 100644 +148 −0 Original line number Diff line number Diff line <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ead="urn:isbn:1-931666-22-9" xmlns:max="https://max.unicaen.fr" exclude-result-prefixes="ead xsl max"> <xsl:import href="../../ui/xsl/core/i18n.xsl"/> <xsl:param name="project"/> <xsl:param name="locale"/> <xsl:template match="ead:eadheader"> <div> <xsl:apply-templates /> </div> </xsl:template> <!-- Si les balises sont présentes dans le fichier xml, 4 tableaux sont créés pour les éléments eadid, filedesc, profiledesc et revisiondesc Un template spécifique est fait pour eadid qui n'a pas tout à fait la même construction --> <xsl:template match="ead:eadheader/ead:*"> <table class="ead_details {local-name(.)}"> <tr> <th class="titreTabHeader"> <!-- pour l'affichage des révisions : on compte le nombre de balises pour ajouter un rowspan --> <xsl:if test="local-name(.)='revisiondesc'"> <xsl:attribute name="rowspan"> <xsl:value-of select="count(//ead:date) + count(//ead:item) + count(//ead:change) + 1" /> </xsl:attribute> </xsl:if> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <xsl:apply-templates /> </tr> </table> </xsl:template> <!-- Template spécifique pour le tableau du eadid qui n'a pas tout à fait la même construction --> <xsl:template match="ead:eadheader/ead:eadid"> <table class="ead_details {local-name(.)}"> <tr> <th class="titreTabHeader"> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </table> </xsl:template> <xsl:template match="ead:eadheader/ead:*//ead:*"> <xsl:choose> <!-- on masque par défaut les titres, comme titleStmt et publicationStmt--> <xsl:when test="(local-name(.)='titlestmt') or (local-name(.)='publicationstmt')"> <xsl:apply-templates /> </xsl:when> <xsl:otherwise> <tr> <th> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- pour les révisions on masque les balises change, item et date --> <xsl:template match="ead:eadheader/ead:revisiondesc//ead:*"> <tr> <td> <xsl:apply-templates /> </td> </tr> </xsl:template> <!-- on gère les éléments inline, comme emph, extref, et les lb --> <xsl:template match="//ead:emph"> <xsl:choose> <xsl:when test="./@render='bold'"> <span class="bold"> <xsl:apply-templates /> </span> </xsl:when> <xsl:otherwise> <xsl:apply-templates /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//ead:extref"> <a href="{href}"> <xsl:apply-templates /> </a> </xsl:template> <xsl:template match="//ead:lb"> <br/> </xsl:template> <!-- certains éléments sont à conserver dans le fil du texte comme les éléments date, addressline, language (peut dépendre du contexte) --> <xsl:template match="//ead:language"> <span class="language"> <xsl:apply-templates /> </span> </xsl:template> <xsl:template match="//ead:creation/ead:date"> <span class="date"><xsl:apply-templates /></span> </xsl:template> <xsl:template match="//ead:address/ead:addressline"> <span class="addressline"><xsl:apply-templates /></span> </xsl:template> <xsl:template match="//ead:editionstmt/ead:edition"> <span class="edition"><xsl:apply-templates /></span> </xsl:template> </xsl:stylesheet> No newline at end of file plugins/metadata/metadata.xq +14 −21 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ import module namespace max.i18n = 'pddn/max/i18n' at '../../rxq/i18n.xqm'; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace ead="urn:isbn:1-931666-22-9"; declare variable $max.plugin.metadata:PLUGIN_ID := "metadata"; Loading @@ -24,20 +23,15 @@ declare %rest:path("/{$project}/{$doc=.*}/info/{$tag}.html") function max.plugin.metadata:getMetadataDocument($project, $doc, $tag, $search as xs:string ?, $focus as xs:string ?){ let $xml := max.plugin.metadata:getXMLByTag($project, $doc, $tag) let $projectXSL := if ($tag='header') then file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/ead/ead_header.xsl" else (file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/ead/ead_archdesc.xsl") (: let $pluginXSL := file:parent(static-base-uri()) || '_metadata.xsl' :) let $maxXSL := max.util:getDefaultTextXSL($project) let $projectXSL := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/ead/" || $tag || ".xsl" let $maxXSL := max.util:maxHome() || "/" || "/plugins/metadata/" || $tag || ".xsl" let $xsl := if (file:exists($projectXSL)) then $projectXSL else $maxXSL let $html := max.html:render( $project, $doc, <div> <div>{max.html:invokePluginXQueries($project, $doc, ())}</div> <div class="plugins-wrapper">{max.html:invokePluginXQueries($project, $doc, ())}</div> <div id='text'> {xslt:transform( $xml, Loading @@ -53,11 +47,12 @@ function max.plugin.metadata:getMetadataDocument($project, $doc, $tag, $search a declare function max.plugin.metadata:getXMLByTag($project, $doc, $tag){ switch ($tag) case "header" return case "archdesc" return try{ let $queryHeader := 'doc("'||$project || '/' || $doc ||'")//*:ead/*:eadheader' let $queryArchdesc := '<div>{doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/* except doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/*:dsc}</div>' return xquery:eval($queryHeader,map xquery:eval($queryArchdesc,map { 'project':$project, 'locale': max.i18n:getLang($project) Loading @@ -66,20 +61,18 @@ declare function max.plugin.metadata:getXMLByTag($project, $doc, $tag){ catch *{ <div class='error'>{'Error [' || $err:code || '/' || $err:module || '/' || $err:line-number ||']: ' || $err:description}</div> } case "description" return default return try{ let $queryArchdesc := '<div>{doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/* except doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/*:dsc}</div>' let $queryHeader := 'doc("'||$project || '/' || $doc ||'")//*:ead/*:'|| $tag return xquery:eval($queryArchdesc,map xquery:eval($queryHeader,map { 'project':$project, 'locale': max.i18n:getLang($project) }) } catch *{ <div class='error'>{'Error [' || $err:code || '/' || $err:module || '/' || $err:line-number ||']: ' || $err:description}</div> <div class='error'>"{'Error [' || $err:code || '/' || $err:module || '/' || $err:line-number ||']: ' || $err:description}""MaX - Erreur = Vérifier l'URL"</div> } default return "MaX - Erreur = Vérifier l'URL" }; No newline at end of file Loading
plugins/metadata/archdesc.xsl 0 → 100644 +129 −0 Original line number Diff line number Diff line <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ead="urn:isbn:1-931666-22-9" xmlns:max="https://max.unicaen.fr" exclude-result-prefixes="ead xsl max"> <!-- Pour une xsl dans le dossier édition, modifier le chemin <xsl:import href="../../../../../ui/xsl/core/i18n.xsl"/>--> <xsl:import href="../../ui/xsl/core/i18n.xsl"/> <xsl:param name="project"/> <xsl:param name="locale"/> <xsl:template match="/"> <div> <xsl:apply-templates /> </div> </xsl:template> <xsl:template match="div/ead:*"> <table class="ead_details {local-name(.)}"> <tr> <th class="titreTabHeader"> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> <xsl:if test="@role"> <xsl:text>@</xsl:text> <xsl:value-of select="@role" /> </xsl:if> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </table> </xsl:template> <xsl:template match="div/ead:*//ead:*"> <xsl:choose> <!-- on masque par défaut certaines balises, comme p--> <xsl:when test="(local-name(.)='p')"> <xsl:apply-templates /> </xsl:when> <xsl:otherwise> <tr> <th> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> <xsl:if test="@role"> <xsl:text>@</xsl:text> <xsl:value-of select="@role" /> </xsl:if> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="div/ead:controlaccess/ead:subject | div/ead:controlaccess/ead:geogname"> <li class="{local-name(.)}"> <xsl:apply-templates /> </li> </xsl:template> <!-- on gère les éléments inline, comme emph, extref, et les lb --> <xsl:template match="//ead:emph"> <xsl:choose> <xsl:when test="./@render='bold'"> <span class="bold"> <xsl:apply-templates /> </span> </xsl:when> <xsl:otherwise> <xsl:apply-templates /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//ead:extref | //ead:archref"> <a href="{@href}" target="_blank"> <xsl:apply-templates /> </a> </xsl:template> <xsl:template match="//ead:lb"> <br/> </xsl:template> <!-- certains éléments sont à conserver dans le fil du texte comme les éléments date, addressline, language (peut dépendre du contexte) --> <xsl:template match="//ead:language | //ead:corpname"> <span class="{local-name(.)}"> <xsl:apply-templates /> </span> </xsl:template> <xsl:template match="//ead:address/ead:addressline"> <span class="addressline"><xsl:apply-templates /><br/></span> </xsl:template> <xsl:template match="//ead:head"> <h2> <xsl:apply-templates /> </h2> </xsl:template> <xsl:template match="//ead:list"> <ul> <xsl:apply-templates /> </ul> </xsl:template> <xsl:template match="//ead:item"> <li> <xsl:apply-templates /> </li> </xsl:template> </xsl:stylesheet> No newline at end of file
plugins/metadata/eadheader.xsl 0 → 100644 +148 −0 Original line number Diff line number Diff line <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ead="urn:isbn:1-931666-22-9" xmlns:max="https://max.unicaen.fr" exclude-result-prefixes="ead xsl max"> <xsl:import href="../../ui/xsl/core/i18n.xsl"/> <xsl:param name="project"/> <xsl:param name="locale"/> <xsl:template match="ead:eadheader"> <div> <xsl:apply-templates /> </div> </xsl:template> <!-- Si les balises sont présentes dans le fichier xml, 4 tableaux sont créés pour les éléments eadid, filedesc, profiledesc et revisiondesc Un template spécifique est fait pour eadid qui n'a pas tout à fait la même construction --> <xsl:template match="ead:eadheader/ead:*"> <table class="ead_details {local-name(.)}"> <tr> <th class="titreTabHeader"> <!-- pour l'affichage des révisions : on compte le nombre de balises pour ajouter un rowspan --> <xsl:if test="local-name(.)='revisiondesc'"> <xsl:attribute name="rowspan"> <xsl:value-of select="count(//ead:date) + count(//ead:item) + count(//ead:change) + 1" /> </xsl:attribute> </xsl:if> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <xsl:apply-templates /> </tr> </table> </xsl:template> <!-- Template spécifique pour le tableau du eadid qui n'a pas tout à fait la même construction --> <xsl:template match="ead:eadheader/ead:eadid"> <table class="ead_details {local-name(.)}"> <tr> <th class="titreTabHeader"> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </table> </xsl:template> <xsl:template match="ead:eadheader/ead:*//ead:*"> <xsl:choose> <!-- on masque par défaut les titres, comme titleStmt et publicationStmt--> <xsl:when test="(local-name(.)='titlestmt') or (local-name(.)='publicationstmt')"> <xsl:apply-templates /> </xsl:when> <xsl:otherwise> <tr> <th> <xsl:variable name="i18nKey"> <xsl:value-of select="local-name(.)" /> </xsl:variable> <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/> </th> <td> <xsl:apply-templates /> </td> </tr> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- pour les révisions on masque les balises change, item et date --> <xsl:template match="ead:eadheader/ead:revisiondesc//ead:*"> <tr> <td> <xsl:apply-templates /> </td> </tr> </xsl:template> <!-- on gère les éléments inline, comme emph, extref, et les lb --> <xsl:template match="//ead:emph"> <xsl:choose> <xsl:when test="./@render='bold'"> <span class="bold"> <xsl:apply-templates /> </span> </xsl:when> <xsl:otherwise> <xsl:apply-templates /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//ead:extref"> <a href="{href}"> <xsl:apply-templates /> </a> </xsl:template> <xsl:template match="//ead:lb"> <br/> </xsl:template> <!-- certains éléments sont à conserver dans le fil du texte comme les éléments date, addressline, language (peut dépendre du contexte) --> <xsl:template match="//ead:language"> <span class="language"> <xsl:apply-templates /> </span> </xsl:template> <xsl:template match="//ead:creation/ead:date"> <span class="date"><xsl:apply-templates /></span> </xsl:template> <xsl:template match="//ead:address/ead:addressline"> <span class="addressline"><xsl:apply-templates /></span> </xsl:template> <xsl:template match="//ead:editionstmt/ead:edition"> <span class="edition"><xsl:apply-templates /></span> </xsl:template> </xsl:stylesheet> No newline at end of file
plugins/metadata/metadata.xq +14 −21 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ import module namespace max.i18n = 'pddn/max/i18n' at '../../rxq/i18n.xqm'; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare namespace ead="urn:isbn:1-931666-22-9"; declare variable $max.plugin.metadata:PLUGIN_ID := "metadata"; Loading @@ -24,20 +23,15 @@ declare %rest:path("/{$project}/{$doc=.*}/info/{$tag}.html") function max.plugin.metadata:getMetadataDocument($project, $doc, $tag, $search as xs:string ?, $focus as xs:string ?){ let $xml := max.plugin.metadata:getXMLByTag($project, $doc, $tag) let $projectXSL := if ($tag='header') then file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/ead/ead_header.xsl" else (file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/ead/ead_archdesc.xsl") (: let $pluginXSL := file:parent(static-base-uri()) || '_metadata.xsl' :) let $maxXSL := max.util:getDefaultTextXSL($project) let $projectXSL := file:parent(file:parent(file:parent(static-base-uri())))||"editions/"||$project||"/ui/xsl/ead/" || $tag || ".xsl" let $maxXSL := max.util:maxHome() || "/" || "/plugins/metadata/" || $tag || ".xsl" let $xsl := if (file:exists($projectXSL)) then $projectXSL else $maxXSL let $html := max.html:render( $project, $doc, <div> <div>{max.html:invokePluginXQueries($project, $doc, ())}</div> <div class="plugins-wrapper">{max.html:invokePluginXQueries($project, $doc, ())}</div> <div id='text'> {xslt:transform( $xml, Loading @@ -53,11 +47,12 @@ function max.plugin.metadata:getMetadataDocument($project, $doc, $tag, $search a declare function max.plugin.metadata:getXMLByTag($project, $doc, $tag){ switch ($tag) case "header" return case "archdesc" return try{ let $queryHeader := 'doc("'||$project || '/' || $doc ||'")//*:ead/*:eadheader' let $queryArchdesc := '<div>{doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/* except doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/*:dsc}</div>' return xquery:eval($queryHeader,map xquery:eval($queryArchdesc,map { 'project':$project, 'locale': max.i18n:getLang($project) Loading @@ -66,20 +61,18 @@ declare function max.plugin.metadata:getXMLByTag($project, $doc, $tag){ catch *{ <div class='error'>{'Error [' || $err:code || '/' || $err:module || '/' || $err:line-number ||']: ' || $err:description}</div> } case "description" return default return try{ let $queryArchdesc := '<div>{doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/* except doc("'||$project || '/' || $doc ||'")/*:ead/*:archdesc/*:dsc}</div>' let $queryHeader := 'doc("'||$project || '/' || $doc ||'")//*:ead/*:'|| $tag return xquery:eval($queryArchdesc,map xquery:eval($queryHeader,map { 'project':$project, 'locale': max.i18n:getLang($project) }) } catch *{ <div class='error'>{'Error [' || $err:code || '/' || $err:module || '/' || $err:line-number ||']: ' || $err:description}</div> <div class='error'>"{'Error [' || $err:code || '/' || $err:module || '/' || $err:line-number ||']: ' || $err:description}""MaX - Erreur = Vérifier l'URL"</div> } default return "MaX - Erreur = Vérifier l'URL" }; No newline at end of file