diff --git a/.htaccess b/.htaccess index 15bf2d73b0573d7055ade02ed62dde561d6255f0..c0432be7e4e1f1b0836fcee3396f11c307b1fe77 100644 --- a/.htaccess +++ b/.htaccess @@ -3,7 +3,7 @@ RewriteEngine on RewriteCond %{REQUEST_URI} !^/(xhprof_html|ckeditor|exploit|\.well-known) RewriteCond %{REQUEST_FILENAME} !^.*/robots\.txt$ [NC] -RewriteRule !(userfiles|public|tmp|temp|skins)/.*\.(js|ico|txt|gif|jpg|jpeg|png|css|xml|swf|mov|pdf|doc|docx|woff|woff2|eot|svg|ttf|xls|wsdl|mp3|m4v|ogg|ogv|epub|html|xhtml|asmx|zip|sql|bro|flv|mp4|webm|tgz|json|geojson)$ index.php [NC,NE] +RewriteRule !(userfiles|public|tmp|temp|skins)/.*\.(js|ico|txt|gif|jpg|jpeg|png|css|xml|swf|mov|pdf|doc|docx|woff|woff2|eot|svg|ttf|xls|wsdl|mp3|m4v|ogg|ogv|epub|html|xhtml|asmx|zip|sql|bro|flv|mp4|webm|tgz|json|geojson|xsl)$ index.php [NC,NE] AddType application/x-javascript .js AddType text/css .css diff --git a/VERSIONS_WIP/73871 b/VERSIONS_WIP/73871 new file mode 100644 index 0000000000000000000000000000000000000000..8d9d0b7053ecb3701d8bda9692d84064342b746c --- /dev/null +++ b/VERSIONS_WIP/73871 @@ -0,0 +1,2 @@ + - ticket #73871 : Affichage notice : possibilité de remplacer la description d'une notice par un fichier XSLT. + \ No newline at end of file diff --git a/application/modules/admin/controllers/ModulesController.php b/application/modules/admin/controllers/ModulesController.php index d5c5755113c3d5622fe417bd754d6c690ec2b25e..add668fbb9d5d77189b18aa8628a17f095b6e6fd 100644 --- a/application/modules/admin/controllers/ModulesController.php +++ b/application/modules/admin/controllers/ModulesController.php @@ -207,6 +207,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { protected function isValidPostNotice() { $this->preferences['links_zones_errors'] = ''; $this->preferences['thumbnail_fields_errors'] = ''; + if (!$this->_request->isPost() || 'viewnotice' != $this->_getParam('action1')) return false; @@ -300,12 +301,16 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { $this->view->titre = $this->_('Configuration de l\'affichage du type %s', $codif->getLibelleFacette(Class_CodifTypeDoc::CODE_FACETTE . $this->_getParam('action2'))); - if ($this->isValidPostNotice()) - return $this->updateEtRetour($this->getPostNotice()); + $valid = $this->isValidPostNotice(); + + $post = $this->getPostNotice(); + $params = array_merge($this->preferences, $post); - $params = array_merge($this->preferences, $this->getPostNotice()); $this->view->form = ZendAfi_Form_Configuration_Record::newWith($params); $this->view->form->setAction($this->view->url()); + + if ($valid && $this->view->form->isValid($post)) + return $this->updateEtRetour($post); } diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index 0b22ce8582eb73cf0e324fa89865b65fb0c5ac2e..e967bccbe0867c8f19e773a331c38e04a9a0493f 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -160,7 +160,12 @@ class NoticeAjaxController extends Zend_Controller_Action { return; } - $this->_sendResponseWithScripts($this->view->notice_Entete($notice, ['entete' => Class_Codification::CHAMPS])); + $xsl = (new Class_Notice_Xsl($notice, Class_Profil::getCurrentProfil())); + $html = $xsl->isEnabled() + ? $this->view->Notice_Xsl($xsl) + : $this->view->notice_Entete($notice, ['entete' => Class_Codification::CHAMPS]); + + $this->_sendResponseWithScripts($html); } diff --git a/library/Class/FileManager.php b/library/Class/FileManager.php index 1499d5f9ae28f24e8efa1f6c5b454dd40ea260d2..4dfe3ea6c7223c8f7ad690caf895e604e673849e 100644 --- a/library/Class/FileManager.php +++ b/library/Class/FileManager.php @@ -22,7 +22,10 @@ class Class_FileManager extends Class_Entity { use Trait_Translator; - protected static $_file_system; + protected static + $_file_system, + $_open_bar = false; + const REGEX_NAME = '/^[a-z0-9][a-z0-9_\-\.]+$/i'; protected $_attribs = ['Id' => '', 'Realpath' => '', @@ -207,6 +210,9 @@ class Class_FileManager extends Class_Entity { public static function userHasRightOnPath($path) { + if(static::isOpenBar()) + return true; + if (!$user = Class_Users::getIdentity()) return false; @@ -226,6 +232,22 @@ class Class_FileManager extends Class_Entity { } + public static function isOpenBar() { + return static::$_open_bar; + } + + + public static function beOpenBar() { + return static::$_open_bar = true; + } + + + public static function reset() { + static::$_open_bar = false; + static::setFileSystem(null); + } + + public static function createImage($path, $content) { return static::getFileSystem()->createImage($path, $content); } diff --git a/library/Class/FileManager/Model.php b/library/Class/FileManager/Model.php index eee50fda58a8ad6dc359b947ac67dc513e065469..483a77a73a022fdf450b7b252eac81e48cf8cc2d 100644 --- a/library/Class/FileManager/Model.php +++ b/library/Class/FileManager/Model.php @@ -98,7 +98,6 @@ class Class_FileManager_ModelRelation { class Class_FileManager_ModelRelationText extends Class_FileManager_ModelRelation { - protected function _generateValue($model, $previous, $new) { return str_replace($previous, $new, call_user_func([$model, 'callGetterByAttributeName'], $this->_field)); @@ -117,13 +116,16 @@ class Class_FileManager_ModelRelationProfil { public function findAll($path) { $top_profiles = array_filter(Class_Profil::findTopProfils(), function($profile) use ($path) { + if ((new Class_Profil_Preferences_Record($profile))->contains($path)) + return true; + foreach(['header_img', 'favicon', 'logo_gauche_img', 'logo_droite_img', 'header_css', 'header_js'] as $key) { - if(false !== strpos($profile->getCfgSiteParam($key), $path)) + if (false !== strpos($profile->getCfgSiteParam($key), $path)) return true; } }); @@ -137,7 +139,6 @@ class Class_FileManager_ModelRelationProfil { : []; return array_merge($top_profiles, $sub_profiles); - } @@ -155,12 +156,14 @@ class Class_FileManager_ModelRelationProfil { 'header_js'] as $key) $model->setCfgSiteParam($key, str_replace($path, $by, $model->getCfgSiteParam($key))); + (new Class_Profil_Preferences_Record($model))->rename($path, $by); + $model->save(); } + public function rename($path, $by) { foreach($this->findAll($path) as $model) $this->_renameOne($model, $path, $by); } - } diff --git a/library/Class/Notice/Xsl.php b/library/Class/Notice/Xsl.php new file mode 100644 index 0000000000000000000000000000000000000000..a4a23b3ed197cac37c9a3565942990ff448d6088 --- /dev/null +++ b/library/Class/Notice/Xsl.php @@ -0,0 +1,167 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Class_Notice_Xsl { + use Trait_StaticPhpCommand, Trait_Yaz; + + const KEY = 'xslt'; + + protected static + $_xslt_processor, + $_dom_document; + + protected + $_record, + $_profile, + $_xsl_file; + + + public static function reset() { + static::$_xslt_processor = null; + static::$_dom_document = null; + static::setPhpCommand(null); + static::setYaz(null); + } + + + public function __construct($record, $profile) { + $this->_record = $record; + $this->_profile = $profile; + $this->_logErrors(); + $this->_xsl_file = $this->_getXslFileFromProfile(); + } + + + public function isEnabled() { + if(!$this->_record) + return false; + + if(!$this->_profile) + return false; + + if(!$this->getXslFileUrl()) + return false; + + return true; + } + + + public function getXslFile() { + return $this->_xsl_file; + } + + + public function getMarcXmlFile() { + if(!$this->_record) + return ''; + + if(!$marc = $this->_record->getUnimarc()) + return ''; + + return ($marc_xml_array = static::getYaz()->marcToMarcXml($marc)) + ? static::getYaz()->writeMarcXmlInFile(implode($marc_xml_array)) + : ''; + } + + + public function unlink($filename) { + static::getPhpCommand()->unlink($filename); + } + + + protected function _logErrors() { + return static::getPhpCommand()->libxml_use_internal_errors(true); + } + + + public function getErrors() { + return static::getPhpCommand()->libxml_get_errors(); + } + + + public function getXslFileUrl() { + $settings = $this->_profile->getCfgModulesPreferences('recherche', 'viewnotice', $this->_record->getTypeDoc()); + if(!$settings) + return; + + if(empty($settings)) + return; + + return array_key_exists(Class_Notice_Xsl::KEY, $settings) + ? $settings[Class_Notice_Xsl::KEY] + : null; + } + + + public function isActivated() { + return static::getPhpCommand()->extension_loaded('xsl'); + } + + + protected function _getXslFileFromProfile() { + Class_FileManager::beOpenBar(); + return Class_FileManager::find($this->getXslFileUrl()); + } + + + public function importStylesheet($path) { + $xsl = $this->getDomDocument(); + $xsl->load($path); + + $xslt = $this->getXSLTProcessor(); + $xslt->importStylesheet($xsl); + + return $this; + } + + + public function transformToXml($path) { + $xml = $this->getDomDocument(); + $xml->load($path); + + return $this->getXSLTProcessor()->transformToXml($xml); + } + + + public function getXSLTProcessor() { + return static::$_xslt_processor + ? static::$_xslt_processor + : (static::$_xslt_processor = new XSLTProcessor()); + } + + + public static function setXSLTProcessor($xslt_processor) { + static::$_xslt_processor = $xslt_processor; + } + + + public function getDomDocument() { + return static::$_dom_document + ? static::$_dom_document + : new DOMDocument; + } + + + public static function setDomDocument($dom_document) { + static::$_dom_document = $dom_document; + } +} \ No newline at end of file diff --git a/library/Class/Profil/Preferences/Record.php b/library/Class/Profil/Preferences/Record.php new file mode 100644 index 0000000000000000000000000000000000000000..8dce0b071574f2c65f783806a1cc0bc85eff4fa5 --- /dev/null +++ b/library/Class/Profil/Preferences/Record.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Class_Profil_Preferences_Record { + protected + $_controller = 'recherche', + $_profile; + + + public function __construct($profile) { + $this->_profile = $profile; + } + + + public function contains($value) { + return $this->_containsXsl($value); + } + + + public function rename($path, $by) { + $this->_renameXsl($path, $by); + return $this; + } + + + protected function _containsXsl($path) { + $found = false; + $this->_withViewNoticePrefsDo( + function($action, $prefs) use($path, &$found) { + if ($found) + return; + + $found = $path == $prefs[Class_Notice_Xsl::KEY]; + }); + + return $found; + } + + + protected function _renameXsl($path, $by) { + $this->_withViewNoticePrefsDo( + function($action, $prefs) use($path, $by) { + if ($path == $prefs[Class_Notice_Xsl::KEY]) + $this->_profile + ->setCfgModulesPreferences([Class_Notice_Xsl::KEY => $by], + $this->_controller, $action); + } + ); + } + + + protected function _withViewNoticePrefsDo($closure) { + foreach($this->_viewNoticePrefs() as $action => $prefs) + if (array_key_exists(Class_Notice_Xsl::KEY, $prefs)) + $closure($action, $prefs); + } + + + protected function _viewNoticePrefs() { + $cfg_modules = $this->_profile->getCfgModulesAsArray(); + + if (!array_key_exists($this->_controller, $cfg_modules)) + return []; + + $valids = array_filter($cfg_modules[$this->_controller], + function($key) { return 0 === strpos($key, 'viewnotice'); }, + ARRAY_FILTER_USE_KEY); + + return array_filter($valids, + function($value) { return is_array($value); }); + } +} diff --git a/library/Class/Testing/Abstract.php b/library/Class/Testing/Abstract.php index d6c2f4a9067a191a668c2844007f0e8016ef9f62..78a4d0c4e67bea233f0b528b00234339eee17c50 100644 --- a/library/Class/Testing/Abstract.php +++ b/library/Class/Testing/Abstract.php @@ -29,5 +29,4 @@ abstract class Class_Testing_Abstract { throw new RuntimeException($this->_error . $name); return @call_user_func_array($name, $args); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Testing/FileSystem.php b/library/Class/Testing/FileSystem.php index 535978d386a52300548799fb39a421fb79fc9c66..7c83ae6a180cb1df23e07698d9281a1ba74c4669 100644 --- a/library/Class/Testing/FileSystem.php +++ b/library/Class/Testing/FileSystem.php @@ -30,5 +30,4 @@ class Class_Testing_FileSystem extends Class_Testing_Abstract { 'is_readable', 'file_put_contents', 'filesize' ], $_error = 'Call to unknown fileSystem method '; -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/Class/Testing/PhpCommand.php b/library/Class/Testing/PhpCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..8c974a67afca16368b6472bb17c826d6d1b140a0 --- /dev/null +++ b/library/Class/Testing/PhpCommand.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +class Class_Testing_PhpCommand extends Class_Testing_FileSystem { + public function __construct() { + $this->_known_functions = array_merge($this->_known_functions, + ['extension_loaded', + 'libxml_use_internal_errors', + 'libxml_get_errors']); + } +} \ No newline at end of file diff --git a/library/Class/Testing/Yaz.php b/library/Class/Testing/Yaz.php index ab103b5f0786536383ac5161d281215160785267..f523ec1eab38a613e539a703c04a77cbb728883f 100644 --- a/library/Class/Testing/Yaz.php +++ b/library/Class/Testing/Yaz.php @@ -40,9 +40,19 @@ class Class_Testing_Yaz { protected function _writeUnimarcInFile($unimarc) { - $filename = PATH_TEMP . md5($unimarc) . '.marc'; + return $this->_writeContentInTempFolder($unimarc, 'marc'); + } + + + public function writeMarcXmlInFile($marc_xml) { + return $this->_writeContentInTempFolder($marc_xml, 'xml'); + } + + + protected function _writeContentInTempFolder($content, $extension) { + $filename = 'temp/' . md5($content) . '.' . $extension; static::getFileSystem()->unlink($filename); - static::getFileSystem()->file_put_contents($filename, $unimarc); + static::getFileSystem()->file_put_contents($filename, $content); return $filename; } } \ No newline at end of file diff --git a/library/Trait/StaticPhpCommand.php b/library/Trait/StaticPhpCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..e12c482ffc28932d6d1a532a7138dd0df09dc6d9 --- /dev/null +++ b/library/Trait/StaticPhpCommand.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +trait Trait_StaticPhpCommand { + protected static $_phpCommand; + + public static function setPhpCommand($phpCommand) { + self::$_phpCommand = $phpCommand; + } + + + public static function getPhpCommand() { + if (null !== self::$_phpCommand) + return self::$_phpCommand; + return new Class_Testing_PhpCommand(); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Controller/Plugin/Manager/FileManager.php b/library/ZendAfi/Controller/Plugin/Manager/FileManager.php index ee31d143ead4fa605bc470dfcd91681d5d3dbefa..9479b013176bf39b6dc3b1230fbc6eec8b25fc8f 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/FileManager.php +++ b/library/ZendAfi/Controller/Plugin/Manager/FileManager.php @@ -46,7 +46,7 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P }, 'label' => $this->_('Sélectionner "%s"', $model->getName()), 'anchorOptions' => array_filter(['title' => $this->_('Sélectionner "%s"', $model->getName()), - 'onclick' => "$(this).selectItemForCKEditor('" . Class_Url::relative(str_replace(["'", '"'], ['%27', '%22'], $model->getId())) . "');"])], + 'onclick' => "$(this).selectItemForCKEditor('" . str_replace(["'", '"'], ['%27', '%22'], $model->getId()) . "');"])], ['url' => ['action' => 'create', 'into' => $model->getId()], diff --git a/library/ZendAfi/Form/Configuration/Record.php b/library/ZendAfi/Form/Configuration/Record.php index 0a8cf85effcfe79506616a11e73f5c5995f9a0e1..a5f67d06412d86540fc2175135ea5aebce0eadbb 100644 --- a/library/ZendAfi/Form/Configuration/Record.php +++ b/library/ZendAfi/Form/Configuration/Record.php @@ -28,6 +28,14 @@ class ZendAfi_Form_Configuration_Record extends ZendAfi_Form { ->addElement('recordTabs', 'record_tabs', ['label' => $this->_('Composition de l\'affichage')]) + + ->addElement('userfile', + Class_Notice_Xsl::KEY, + ['label' => $this->_('Remplacer la description par la XSLT suivante :'), + 'allowEmpty' => true, + 'validators' => [(new Zend_Validate_Regex('/^.*\.xsl$/i')) + ->setMessage($this->_('Le fichier doit être de type "xsl"'))]]) + ->addElement('codeList', 'champs', ['label' => $this->_('Champs à afficher'), @@ -44,8 +52,7 @@ class ZendAfi_Form_Configuration_Record extends ZendAfi_Form { ->addElement('unimarc', 'thumbnail_fields', - ['label' => $this->_('Zones de vignette'), - 'validators' => [['name' => 'unimarc']]]) + ['label' => $this->_('Zones de vignette')]) ->addElement('text', 'analytics', @@ -85,7 +92,8 @@ class ZendAfi_Form_Configuration_Record extends ZendAfi_Form { ->addDisplayGroup(['champs'], 'head_group', ['legend' => $this->_('Entête')]) - ->addDisplayGroup(['record_tabs'], + ->addDisplayGroup(['record_tabs', + Class_Notice_Xsl::KEY], 'record_display_group', ['legend' => $this->_('Affichage')]) ->addDisplayGroup(['links_zones'], diff --git a/library/ZendAfi/View/Helper/Notice/Xsl.php b/library/ZendAfi/View/Helper/Notice/Xsl.php new file mode 100644 index 0000000000000000000000000000000000000000..9862b28309fd219d296f57d25417362f80438b66 --- /dev/null +++ b/library/ZendAfi/View/Helper/Notice/Xsl.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_View_Helper_Notice_Xsl extends ZendAfi_View_Helper_BaseHelper { + public function Notice_Xsl($xsl) { + if(!$xsl->isActivated()) + return $this->_tag('p', $this->_('L\'extension PHP XSL n\'est pas installée. Merci de contacter votre hébergeur'), ['class' => 'error']); + + if(!$xsl_file = $xsl->getXslFile()) + return $this->_tag('p', + $this->_('Le fichier xsl n\'a pas pu être chargé : %s', $xsl->getXslFileUrl()), + ['class' => 'error']); + + if(!$marc_xml = $xsl->getMarcXmlFile()) + return $this->_tag('p', + $this->_('Le fichier marc-xml n\'a pas pu être généré'), + ['class' => 'error']); + + $xslt = $xsl->importStylesheet($xsl_file->getRealpath()); + $response = $xsl->transformToXml($marc_xml); + + if(($errors = $xsl->getErrors()) || (!$response)) + return $this->_tag('p', $this->_('La transformation du %s en HTML par le fichier %s n\'a pas fonctionné.', + $this->view->tagAnchor(Class_Url::absolute($marc_xml), + $this->_('marc-xml'), + ['target' => 'blank']), + $this->view->tagAnchor(Class_Url::absolute($xsl_file->getPath()), + $this->_('xsl'), + ['target' => 'blank'])), + ['class' => 'error']) + . $this->_renderXsltErrors($errors); + + $xsl->unlink($marc_xml); + return $response; + } + + + protected function _renderXsltErrors($errors) { + $no_error_message = $this->_tag('p', $this->_('Aucune erreur levée par XSLTProcessor')); + if(!$errors) + return $no_error_message; + + if(empty($errors)) + return $no_error_message; + + $html = []; + foreach ($errors as $error) + $html [] = $this->_tag('li', $this->_('Erreur levée par Libxml: %s', $error->message)); + + return $this->_tag('ul', + implode($html)); + } +} \ No newline at end of file diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php index 8d082ec22b9ab0b5ed55684886d7bc1ccc8ee2ae..aca406855712afce0e1b929e58348b34794a4b34 100644 --- a/tests/application/modules/AbstractControllerTestCase.php +++ b/tests/application/modules/AbstractControllerTestCase.php @@ -35,7 +35,8 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe protected function _initMockProfil() { $this->fixture('Class_Profil', ['id' => 1, - 'libelle' => 'portail']); + 'libelle' => 'portail', + 'parent_id' => null]); $profil = $this->fixture('Class_Profil', ['id' => 2, @@ -59,7 +60,8 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe 'ref_tags' => '', 'mail_site' => 'nanook@afi-sa.net', 'browser' => 'opac', - 'cfg_modules' => []])->beCurrentProfil(); + 'cfg_modules' => [], + 'parent_id' => null])->beCurrentProfil(); @@ -193,6 +195,8 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe Class_AdminVar::set('NOM_DOMAINE', ''); Class_Log::resetInstance(); Class_WebService_BibNumerique_Vignette::resetInstance(); + Class_FileManager::reset(); + Class_Notice_Xsl::reset(); } diff --git a/tests/application/modules/admin/controllers/FileManagerControllerTest.php b/tests/application/modules/admin/controllers/FileManagerControllerTest.php index d3d0e8b9b125408d0652b1dc910d8dd38431632c..f77911a93a707890bba333303b24271a1a433206 100644 --- a/tests/application/modules/admin/controllers/FileManagerControllerTest.php +++ b/tests/application/modules/admin/controllers/FileManagerControllerTest.php @@ -1561,7 +1561,7 @@ class FileManagerControllerWithSpecialCharTest extends FileManagerControllerTest /** @test */ public function selectButtonShouldBePresent() { - $this->assertXPathContentContains('//div//a[contains(@onclick, "$(this).selectItemForCKEditor(")][contains(@onclick, "/userfiles/my %27direct%22ory/new%27_ima%22ge.jpg")]', 'Sélectionner'); + $this->assertXPathContentContains('//div//a[contains(@onclick, "$(this).selectItemForCKEditor(")][contains(@onclick, "selectItemForCKEditor(\'userfiles/my %27direct%22ory/new%27_ima%22ge.jpg")]', 'Sélectionner'); } diff --git a/tests/application/modules/admin/controllers/ModulesControllerTest.php b/tests/application/modules/admin/controllers/ModulesControllerTest.php index 9c6e4c1a44338de2c70a0ae85c5987c7762fc08b..0374aef09f396562978ed5087c227335a6c77f12 100644 --- a/tests/application/modules/admin/controllers/ModulesControllerTest.php +++ b/tests/application/modules/admin/controllers/ModulesControllerTest.php @@ -155,7 +155,7 @@ abstract class ModulesControllerRechercheViewnoticePostTestCase protected function getDatas() { - return ['boite' => 'testing_box_of_the_doom', + return ['boite' => 'boite_banniere_gauche', 'champs_codes' => 'ECNA', 'analytics' => '464', 'analytics_title' => 'a', @@ -246,8 +246,8 @@ class ModulesControllerRechercheViewnoticeValidPostTest /** @test */ - public function boiteShouldBeTestingBox() { - $this->assertEquals('testing_box_of_the_doom', $this->viewnotice_pref['boite']); + public function boiteShouldBeBanniereGauche() { + $this->assertEquals('boite_banniere_gauche', $this->viewnotice_pref['boite']); } diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php index 96709c02d4e106ce9e61c581a85218c35f5d5e0d..f32fd21d3476fbd64bfe58e1ef640cb1e2e05dfe 100644 --- a/tests/application/modules/opac/controllers/IndexControllerTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerTest.php @@ -715,6 +715,7 @@ class IndexControllerStatusTest extends AbstractControllerTestCase { public function setUp() { parent::setUp(); + Class_AdminVar::set('ALLOWED_DISK_SPACE', 1); $this->dispatch('/opac/index/status', true); $this->_json = json_decode($this->_response->getBody(), true); } diff --git a/tests/application/modules/opac/controllers/RechercheControllerViewnoticeTest.php b/tests/application/modules/opac/controllers/RechercheControllerViewnoticeTest.php index 3b7dc0d0991196ae39534794bc0fc569fb8d265a..a382cf40781ebb1e466ae95ae18f56c2e224afe7 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerViewnoticeTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerViewnoticeTest.php @@ -91,59 +91,4 @@ class RechercheControllerSearchResultWithInspectorGadgetTest extends AbstractCon public function buttonConfigurationOfSearchShouldBePresent() { $this->assertXPathContentContains('//button', 'Configuration de la recherche'); } -} - - - - -class RechercheControllerViewnoticeWithInspectorGadgetAndMarcXMLEnabledTest extends AbstractControllerTestCase { - protected $_storm_default_to_volatile = true; - - public function setUp() { - parent::setUp(); - Class_AdminVar::set('INSPECTOR_GADGET_MARC_XML', 1); - - $cmd = $this->mock() - ->whenCalled('exec') - ->answers(true) - - ->whenCalled('getOutput') - ->answers(['<collection xmlns="http://www.loc.gov/MARC21/slim">', - '<record>', - '<leader>01185nam0a2200217 450 </leader>', - '<controlfield tag="001">2774</controlfield>', - '<datafield tag="010" ind1=" " ind2=" ">', - '<subfield code="a">2-84563-280-0</subfield>']); - - $filesystem = $this->mock() - ->whenCalled('unlink') - ->answers(true) - - ->whenCalled('file_put_contents') - ->answers(true); - - Class_Testing_Yaz::setCommand($cmd); - Class_Testing_Yaz::setFileSystem($filesystem); - - $this->fixture('Class_Notice', - ['id' => 2, - 'type_doc' => Class_TypeDoc::DILICOM, - 'unimarc' => "01185nam0 2200217 450 0010005000000100031000050350016000360900009000520990038000611000041000991010008001402000036001482100013001842150011001973300660002083330010008686760006008787000028008848010026009129020029009382774 a2-84563-280-0d19,90 Euros aALOES355754 a2774 c2017-12-11d2018-03-16tLIVREx12 a20171211 frey50 afre aSeras-tu là ?fGuillaume Musso cXOd2012 a301 p. aUn seul geste aurait suffi pour tout changer. Qui n'a jamais rêvé de revenir à cet instant décisif où le bonheur était possible ? San Francisco. Elliott, médecin passionné, ne s'est jamais consolé de la disparition d'Ilena, la femme qu'il aimait, morte il y a trente ans. Un jour, par une circonstance extraordinaire, il est ramené en arrière et rencontre le jeune homme qu'il était, trente ans plus tôt. Il est revenu à l'instant décisif où un geste de lui peut sauver Ilena. Et modifier l'implacable destin qui a figé son sort à jamais. Un stupéfiant face-à -face, Une histoire d'amour bouleversante, Un suspense à couper le souffle. aAG 14 aR aMussobGuillaume960415 aFRbCALUIREc20060516 981440aroman francophone", - 'alpha_titre' => '', - 'alpha_auteur' => '']); - - $this->dispatch('/opac/recherche/viewnotice/id/2/inspector_gadget/1', true); - } - - - /** @test */ - public function tabMarcXMLShouldBePresent() { - $this->assertXPathContentContains('//button[contains(@onclick, "#ig-tab-marc-xml")]', 'Notice Bokeh'); - } - - - /** @test */ - public function marcXMLShouldBePresent() { - $this->assertXPathContentContains('//button[contains(@onclick, "controlfield")]', 'Notice Bokeh'); - } } \ No newline at end of file diff --git a/tests/scenarios/Xsl/XslTest.php b/tests/scenarios/Xsl/XslTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fb6425121983d3188cbc60be5898f58b086bfd34 --- /dev/null +++ b/tests/scenarios/Xsl/XslTest.php @@ -0,0 +1,292 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class XslRechercheControllerViewnoticeWithInspectorGadgetAndMarcXMLEnabledTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + Class_AdminVar::set('INSPECTOR_GADGET_MARC_XML', 1); + + $cmd = $this->mock() + ->whenCalled('exec') + ->answers(true) + + ->whenCalled('getOutput') + ->answers(['<collection xmlns="http://www.loc.gov/MARC21/slim">', + '<record>', + '<leader>01185nam0a2200217 450 </leader>', + '<controlfield tag="001">2774</controlfield>', + '<datafield tag="010" ind1=" " ind2=" ">', + '<subfield code="a">2-84563-280-0</subfield>']); + + $filesystem = $this->mock() + ->whenCalled('unlink') + ->answers(true) + + ->whenCalled('file_put_contents') + ->answers(true); + + Class_Testing_Yaz::setCommand($cmd); + Class_Testing_Yaz::setFileSystem($filesystem); + + $this->fixture('Class_Notice', + ['id' => 2, + 'type_doc' => Class_TypeDoc::DILICOM, + 'unimarc' => "01185nam0 2200217 450 0010005000000100031000050350016000360900009000520990038000611000041000991010008001402000036001482100013001842150011001973300660002083330010008686760006008787000028008848010026009129020029009382774 a2-84563-280-0d19,90 Euros aALOES355754 a2774 c2017-12-11d2018-03-16tLIVREx12 a20171211 frey50 afre aSeras-tu là ?fGuillaume Musso cXOd2012 a301 p. aUn seul geste aurait suffi pour tout changer. Qui n'a jamais rêvé de revenir à cet instant décisif où le bonheur était possible ? San Francisco. Elliott, médecin passionné, ne s'est jamais consolé de la disparition d'Ilena, la femme qu'il aimait, morte il y a trente ans. Un jour, par une circonstance extraordinaire, il est ramené en arrière et rencontre le jeune homme qu'il était, trente ans plus tôt. Il est revenu à l'instant décisif où un geste de lui peut sauver Ilena. Et modifier l'implacable destin qui a figé son sort à jamais. Un stupéfiant face-à -face, Une histoire d'amour bouleversante, Un suspense à couper le souffle. aAG 14 aR aMussobGuillaume960415 aFRbCALUIREc20060516 981440aroman francophone", + 'alpha_titre' => '', + 'alpha_auteur' => '']); + + $this->dispatch('/opac/recherche/viewnotice/id/2/inspector_gadget/1', true); + } + + + /** @test */ + public function tabMarcXMLShouldBePresent() { + $this->assertXPathContentContains('//button[contains(@onclick, "#ig-tab-marc-xml")]', 'Notice Bokeh'); + } + + + /** @test */ + public function marcXMLShouldBePresent() { + $this->assertXPathContentContains('//button[contains(@onclick, "controlfield")]', 'Notice Bokeh'); + } +} + + + + +class XslDocTypeConfigurationDispatchTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + /** @test */ + public function inputReplaceDescriptionWithXSLTShouldBePresent() { + $this->dispatch('/admin/modules/recherche/id_profil/2/action1/viewnotice/type_module/recherche/config/site', true); + $this->assertXPath('//input[@type="text"][@name="xslt"]'); + } +} + + + +class XslDocTypeConfigurationPostDispatchTest extends Admin_AbstractControllerTestCase { + protected + $_storm_default_to_volatile = true, + $viewnotice_pref; + + public function setUp() { + parent::setUp(); + + $this->postDispatch('/admin/modules/recherche?config=site&type_module=recherche&id_profil=2&action1=viewnotice&action2=1', + [Class_Notice_Xsl::KEY => 'fichier.xsl']); + + $this->viewnotice_pref = Class_Profil::getCurrentProfil() + ->getCfgModulesAsArray()['recherche']['viewnotice1']; + } + + + /** @test */ + public function preferencesShouldContainsXslt() { + $this->assertEquals('fichier.xsl', + $this->viewnotice_pref[Class_Notice_Xsl::KEY]); + } +} + + + +class XslNoticeajaxDetailDispatchTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $disk = $this->mock() + ->whenCalled('directoryAt') + ->answers(null) + + ->whenCalled('fileAt') + ->answers((new Class_FileManager) + ->setRealpath('tests/scenarios/Xsl/record_description.xsl')); + + Class_FileManager::setFileSystem($disk); + + $php_command = $this->mock() + ->whenCalled('extension_loaded') + ->answers(true) + + ->whenCalled('unlink') + ->answers(true) + + ->whenCalled('libxml_use_internal_errors') + ->answers(true) + + ->whenCalled('libxml_get_errors') + ->answers([]); + + Class_Notice_Xsl::setPhpCommand($php_command); + + $dom_document = $this->mock() + ->whenCalled('load') + ->answers(true); + + Class_Notice_Xsl::setDomDocument($dom_document); + + $xslt_processor = $this->mock() + ->whenCalled('importStylesheet') + ->answers(true) + + ->whenCalled('transformToXml') + ->answers('<li><strong>Numéro de notice Koha : </strong>2774</li><br><li>'); + + Class_Notice_Xsl::setXSLTProcessor($xslt_processor); + + $profile = Class_Profil::getCurrentProfil(); + $profile->setCfgModulesPreferences(['xslt' => 'tests/scenarios/Xsl/record_description.xsl'], + 'recherche', + 'viewnotice', + '1'); + $profile->save(); + + $this->fixture('Class_Notice', + ['id' => 5, + 'type_doc' => 1, + 'unimarc' => "01185nam0 2200217 450 0010005000000100031000050350016000360900009000520990038000611000041000991010008001402000036001482100013001842150011001973300660002083330010008686760006008787000028008848010026009129020029009382774 a2-84563-280-0d19,90 Euros aALOES355754 a2774 c2017-12-11d2018-03-16tLIVREx12 a20171211 frey50 afre aSeras-tu là ?fGuillaume Musso cXOd2012 a301 p. aUn seul geste aurait suffi pour tout changer. Qui n'a jamais rêvé de revenir à cet instant décisif où le bonheur était possible ? San Francisco. Elliott, médecin passionné, ne s'est jamais consolé de la disparition d'Ilena, la femme qu'il aimait, morte il y a trente ans. Un jour, par une circonstance extraordinaire, il est ramené en arrière et rencontre le jeune homme qu'il était, trente ans plus tôt. Il est revenu à l'instant décisif où un geste de lui peut sauver Ilena. Et modifier l'implacable destin qui a figé son sort à jamais. Un stupéfiant face-à -face, Une histoire d'amour bouleversante, Un suspense à couper le souffle. aAG 14 aR aMussobGuillaume960415 aFRbCALUIREc20060516 981440aroman francophone"]); + + $this->dispatch('/opac/noticeajax/detail/id_notice/5', true); + } + + + /** @test */ + public function shouldNotRedirect() { + $this->assertNotRedirect(); + } + + + /** @test */ + public function shouldDisplayMarcWithXslt() { + $this->assertContains('<strong>Numéro de notice Koha : </strong>2774</li><br><li>', $this->_response->getBody()); + } +} + + + + +class XslNoticeajaxDetailDispatchWithoutXSLTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + $php_command = $this->mock() + ->whenCalled('extension_loaded') + ->answers(false) + + ->whenCalled('libxml_use_internal_errors') + ->answers(true); + + Class_Notice_Xsl::setPhpCommand($php_command); + + $profile = Class_Profil::getCurrentProfil(); + $profile->setCfgModulesPreferences(['xslt' => 'tests/scenarios/Xsl/record_description.xsl'], + 'recherche', + 'viewnotice', + '1'); + $profile->save(); + + $this->fixture('Class_Notice', + ['id' => 5, + 'type_doc' => 1]); + + $this->dispatch('/opac/noticeajax/detail/id_notice/5', true); + } + + + /** @test */ + public function plzInstallXSLErrorShouldBeDisplay() { + $this->assertXPathContentContains('//p', "L'extension PHP XSL"); + } +} + + + + +class XslFileManagerControllerWithXslInRechercheViewnoticeTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $disk = $this->mock() + ->whenCalled('directoryAt') + ->with('userfiles/bib1/xsl/toto.xsl') + ->answers(null) + + ->whenCalled('fileAt') + ->with('userfiles/bib1/xsl/toto.xsl') + ->answers((new Class_FileManager) + ->setId('userfiles/bib1/xsl/toto.xsl') + ->setPath('userfiles/bib1/xsl/toto.xsl') + ->setParentPath('userfiles/bib1/xsl') + ->setName('toto.xsl') + ->setDir(false) + ->setWritable(true) + ->setExtension('xsl')) + + ->whenCalled('rename') + ->answers(true); + + Class_FileManager::setFileSystem($disk); + + Class_Profil::getCurrentProfil() + ->setCfgModulesPreferences(['xslt' => 'userfiles/bib1/xsl/toto.xsl'], + 'recherche', 'viewnotice', 'Assimil'); + } + + + + /** @test */ + public function dispatchDeleteShouldDisplayDisabledDeleteButton() { + $this->dispatch('/admin/file-manager/delete?item=userfiles%2Fbib1%2Fxsl%2Ftoto.xsl', true); + $this->assertXPathContentContains('//div//button[@disabled]', 'Supprimer'); + } + + + /** @test */ + public function dispatchForceDeleteShouldRedirectWithErrorMessage() { + $this->dispatch('/admin/file-manager/force-delete?item=userfiles%2Fbib1%2Fxsl%2Ftoto.xsl', true); + $this->assertRedirectTo('/admin/file-manager/index?browser=userfiles%2Fbib1%2Fxsl%2Ftoto.xsl'); + $this->assertFlashMessengerContentContains('Impossible de supprimer'); + } + + + /** @test */ + public function dispatchPropertiesShouldContainsModels() { + $this->dispatch('/admin/file-manager/properties?item=userfiles%2Fbib1%2Fxsl%2Ftoto.xsl', true); + $this->assertXpathContentContains('//table//td', 'AFI', $this->_response->getBody()); + } + + + /** @test */ + public function renameTotoXslShouldUpdateProfile() { + $this->postDispatch('/admin/file-manager/rename?item=userfiles%2Fbib1%2Fxsl%2Ftoto.xsl', ['name' => 'titi']); + $xslt = Class_Profil::getCurrentProfil()->getModulePreference('recherche', 'viewnoticeAssimil', 'xslt'); + $this->assertContains('userfiles/bib1/xsl/titi.xsl', $xslt); + } +} \ No newline at end of file diff --git a/tests/scenarios/Xsl/record_description.xsl b/tests/scenarios/Xsl/record_description.xsl new file mode 100644 index 0000000000000000000000000000000000000000..5c08983ff2594fd67aba83a5b29d1c03e8635b12 --- /dev/null +++ b/tests/scenarios/Xsl/record_description.xsl @@ -0,0 +1,1337 @@ + + +<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]> + +<xsl:stylesheet version="1.0" + xmlns:marc="http://www.loc.gov/MARC21/slim" + xmlns:items="http://www.koha-community.org/items" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + exclude-result-prefixes="marc items"> + +<xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/> +<xsl:template match="/"> + <xsl:apply-templates/> +</xsl:template> + + +<!-- debut du report de utils --> + +<xsl:template name="datafield"> + <xsl:param name="tag"/> + <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param> + <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param> + <xsl:param name="subfields"/> + <xsl:element name="datafield"> + <xsl:attribute name="tag"> + <xsl:value-of select="$tag"/> + </xsl:attribute> + <xsl:attribute name="ind1"> + <xsl:value-of select="$ind1"/> + </xsl:attribute> + <xsl:attribute name="ind2"> + <xsl:value-of select="$ind2"/> + </xsl:attribute> + <xsl:copy-of select="$subfields"/> + </xsl:element> + </xsl:template> + + <xsl:template name="tag_099"> +<xsl:if test="marc:datafield[@tag=099]"> + <br/><li> + <strong>Informations locales : </strong> + <xsl:for-each select="marc:datafield[@tag=099]"> + <xsl:if test="marc:subfield[@code='a']"> + <li><strong> <xsl:text>Créateur : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='a']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='b']"> + <li><strong> <xsl:text>Dernier modificateur : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='b']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='c']"> + <li><strong> <xsl:text>Date de création : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='c']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='d']"> + <li><strong> <xsl:text>Date de modification : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='d']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> + <li><strong> <xsl:text>Export BDSP : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='e']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> + <li><strong> <xsl:text>Base d'origine : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='f']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='g']"> + <li><strong> <xsl:text>Code de centre BDSP : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='g']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='s']"> + <li><strong> <xsl:text>Périodique : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='s']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='t']"> + <li><strong> <xsl:text>Type de document : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='t']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='u']"> + <li><strong> <xsl:text>Type de BO : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='u']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='y']"> + <li><strong> <xsl:text>Secteur thématique : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='y']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:if test="marc:subfield[@code='z']"> + <li><strong> <xsl:text>IBO : </xsl:text></strong> + <xsl:for-each select="marc:subfield[@code='z']"> + <xsl:value-of select="text()"/><xsl:text> </xsl:text> + </xsl:for-each> + </li> + </xsl:if> + <xsl:choose> + <xsl:when test="position()=last()"> + <br/> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> ; </xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </li> + </xsl:if> + </xsl:template> + + <xsl:template name="tag_210"> + <xsl:for-each select="marc:datafield[@tag=210]"> + <li> + <strong>Publication : </strong> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='a']"> + <xsl:for-each select="marc:subfield[@code='a']"> + <xsl:text> </xsl:text> + <xsl:value-of select="."/> + </xsl:for-each> + </xsl:if> + <xsl:if test="marc:subfield[@code='b']"> + <xsl:if test="marc:subfield[@code='a']">, </xsl:if> + <xsl:value-of select="marc:subfield[@code='b']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='c']"> + <xsl:if test="marc:subfield[@code='a']"> : </xsl:if> + <xsl:for-each select="marc:subfield[@code='c']"> + <xsl:text> </xsl:text> + <xsl:value-of select="."/> + </xsl:for-each> + </xsl:if> + <xsl:if test="marc:subfield[@code='d']"> + <xsl:if test="marc:subfield[@code='a' or @code='c']">, </xsl:if> + <xsl:value-of select="marc:subfield[@code='d']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> + <xsl:if test="marc:subfield[@code='a' or @code='c' or @code='d']"> - </xsl:if> + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='g']"> + <xsl:if test="marc:subfield[@code='e']"> : </xsl:if> + <xsl:value-of select="marc:subfield[@code='g']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='h']"> + <xsl:if test="marc:subfield[@code='e' or @code='g']">, </xsl:if> + <xsl:value-of select="marc:subfield[@code='h']"/> + </xsl:if> + <xsl:if test="not (position() = last())"> + <xsl:text> • </xsl:text> + </xsl:if> + </span> + </li> + </xsl:for-each> + </xsl:template> + + <xsl:template name="tag_215"> + <xsl:for-each select="marc:datafield[@tag=215]"> + <li> + <strong>Description : </strong> + <xsl:if test="marc:subfield[@code='a']"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='c']"> : + <xsl:value-of select="marc:subfield[@code='c']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='d']"> ; + <xsl:value-of select="marc:subfield[@code='d']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> + + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> + + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + </li> + </xsl:for-each> + </xsl:template> + + <xsl:template name="tag_4xx"> + <xsl:for-each select="marc:datafield[@tag=410]"> + <li> + <strong>Collection : </strong> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='t']"> + <a> + <xsl:attribute name="href"> + <xsl:text>/recherche/simple/expressionRecherche/</xsl:text> + <xsl:value-of select="translate(marc:subfield[@code='t'], '*?()', '+')"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='t']"/> + </a> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> : + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='i']"> : + <xsl:value-of select="marc:subfield[@code='i']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> / + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='v']">, + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + </span> + </li> + </xsl:for-each> +<xsl:for-each select="marc:datafield[@tag=411]"> + <li> + <strong>Sous collection : </strong> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='t']"> + <a> + <xsl:attribute name="href"> + <xsl:text>/recherche/simple/expressionRecherche/</xsl:text> + <xsl:value-of select="translate(marc:subfield[@code='t'], '*?()', '+')"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='t']"/> + </a> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> : + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='i']"> : + <xsl:value-of select="marc:subfield[@code='i']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> / + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='v']">, + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + </span> + </li> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=449]"> + <li> + <strong>Etat réglementaire : </strong> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='a']"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='t']"> + <xsl:text> : </xsl:text><xsl:value-of select="marc:subfield[@code='t']"/> + </xsl:if> + </span> + </li> + </xsl:for-each> + + <xsl:for-each select="marc:datafield[@tag=454]"> + <li> + <strong>Est une traduction de : </strong> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='t']"> + <a> + <xsl:attribute name="href"> + <xsl:text>/recherche/simple/expressionRecherche/</xsl:text> + <xsl:value-of select="translate(marc:subfield[@code='t'], '*?()', '+')"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='t']"/> + </a> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> : + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> / + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='v']">, + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + </span> + </li> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=464 or @tag=461]"> + <li> + <strong>relié avec : </strong> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='t']"> + <a> + <xsl:attribute name="href"> + <xsl:text>/recherche/simple/expressionRecherche/</xsl:text> + <xsl:value-of select="translate(marc:subfield[@code='t'], '*?()', '+')"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='t']"/> + </a> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> : + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> / + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='v']">, + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + </span> + </li> + </xsl:for-each> + <xsl:for-each select="marc:datafield[@tag=462]"> + <li> + <strong>Titre d'ensemble : </strong> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='t']"> + <a> + <xsl:attribute name="href"> + <xsl:text>/recherche/simple/expressionRecherche/</xsl:text> + <xsl:value-of select="translate(marc:subfield[@code='t'], '*?()', '+')"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='t']"/> + </a> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> : + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> / + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='v']">, + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + </span> + </li> + </xsl:for-each> + </xsl:template> + + + <xsl:template name="tag_4xx_perio"> + <xsl:param name="tag" /> + <xsl:param name="label" /> + <xsl:if test="marc:datafield[@tag=$tag]"> + <li> + <strong><xsl:value-of select="$label"/>: </strong> + <xsl:for-each select="marc:datafield[@tag=$tag]"> + <span> + <xsl:call-template name="addClassRtl" /> + <xsl:if test="marc:subfield[@code='t']"> + <a> + <xsl:attribute name="href"> + <xsl:text>/recherche/simple/expressionRecherche/</xsl:text> + <xsl:value-of select="translate(marc:subfield[@code='t'], '*?()', '+')"/> + </xsl:attribute> + <xsl:value-of select="marc:subfield[@code='t']"/> + </a> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> : + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='i']"> : + <xsl:value-of select="marc:subfield[@code='i']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> / + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='v']">, + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + </span> + </xsl:for-each> + </li> + </xsl:if> + </xsl:template> + + + + <xsl:template name="subfieldSelect"> + <xsl:param name="codes"/> + <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param> + <xsl:param name="subdivCodes"/> + <xsl:param name="subdivDelimiter"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="contains($codes, @code)"> + <xsl:if test="contains($subdivCodes, @code)"> + <xsl:value-of select="$subdivDelimiter"/> + </xsl:if> + <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> + </xsl:template> + + <xsl:template name="buildSpaces"> + <xsl:param name="spaces"/> + <xsl:param name="char"><xsl:text> </xsl:text></xsl:param> + <xsl:if test="$spaces>0"> + <xsl:value-of select="$char"/> + <xsl:call-template name="buildSpaces"> + <xsl:with-param name="spaces" select="$spaces - 1"/> + <xsl:with-param name="char" select="$char"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="chopSpecialCharacters"> + <xsl:param name="title" /> + <xsl:variable name="ntitle" + select="translate($title, '˜œ슜슛슘슈슉','')"/> + <xsl:value-of select="$ntitle" /> + </xsl:template> + + + <xsl:template name="chopPunctuation"> + <xsl:param name="chopString"/> + <xsl:variable name="length" select="string-length($chopString)"/> + <xsl:choose> + <xsl:when test="$length=0"/> + <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not($chopString)"/> + <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template name="addClassRtl"> + <xsl:variable name="lang" select="marc:subfield[@code='7']" /> + <xsl:if test="$lang = 'ha' or $lang = 'Hebrew' or $lang = 'fa' or $lang = 'Arabe'"> + <xsl:attribute name="class">rtl</xsl:attribute> + </xsl:if> + </xsl:template> + + <xsl:template name="nl2br"> + <xsl:param name="string"/> + <xsl:value-of select="normalize-space(substring-before($string,' '))"/> + <xsl:choose> + <xsl:when test="contains($string,' ')"> + <br /> + <xsl:call-template name="nl2br"> + <xsl:with-param name="string" select="substring-after($string,' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="tag_title"> + <xsl:param name="tag" /> + <xsl:param name="label" /> + <xsl:if test="marc:datafield[@tag=$tag]"> + <li> + <strong><xsl:value-of select="$label"/>: </strong> + <xsl:for-each select="marc:datafield[@tag=$tag]"> + <xsl:value-of select="marc:subfield[@code='a']" /> + <xsl:if test="marc:subfield[@code='d']"> + <xsl:text> : </xsl:text> + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> + <xsl:for-each select="marc:subfield[@code='e']"> + <xsl:text> </xsl:text> + <xsl:value-of select="."/> + </xsl:for-each> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> + <xsl:text> / </xsl:text> + <xsl:value-of select="marc:subfield[@code='f']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='h']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='h']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='i']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='i']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='v']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='x']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='x']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='z']"/> + </xsl:if> + </xsl:for-each> + </li> + </xsl:if> + </xsl:template> + + + <xsl:template name="tag_5xx"> + <xsl:param name="tag" /> + <xsl:param name="label" /> + <xsl:if test="marc:datafield[@tag=$tag]"> + <li> + <strong><xsl:value-of select="$label"/>: </strong> + <xsl:for-each select="marc:datafield[@tag=$tag]"> + <a> + <xsl:choose> + <xsl:when test="marc:subfield[@code=9]"> + <xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="href">/recherche/simple/expressionRecherche/<xsl:value-of select="translate(marc:subfield[@code='a'], '*?()', '+')"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="marc:subfield[@code='a']"/> + </a> + <xsl:if test="not (position()=last())"> + <xsl:text> | </xsl:text> + </xsl:if> + </xsl:for-each> + </li> + </xsl:if> + </xsl:template> + + + <xsl:template name="tag_subject"> + <xsl:param name="tag" /> + <xsl:param name="label" /> + <xsl:if test="marc:datafield[@tag=$tag]"> + <li> + <strong><xsl:value-of select="$label"/>: </strong> + <xsl:for-each select="marc:datafield[@tag=$tag]"> + <a> + <xsl:choose> + <xsl:when test="marc:subfield[@code=9]"> + <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="href">/recherche/simple/expressionRecherche/<xsl:value-of select="translate(marc:subfield[@code='a'], '*?()', '+')"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdjpvxyz</xsl:with-param> + <xsl:with-param name="subdivCodes">jpxyz</xsl:with-param> + <xsl:with-param name="subdivDelimiter">-- </xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </a> + <xsl:if test="not (position()=last())"> + <xsl:text> | </xsl:text> + </xsl:if> + </xsl:for-each> + </li> + </xsl:if> + </xsl:template> + + + <xsl:template name="tag_7xx"> + <xsl:param name="tag" /> + <xsl:param name="label" /> + <xsl:if test="marc:datafield[@tag=$tag]"> + <li> + <strong><xsl:value-of select="$label" />: </strong> + <xsl:for-each select="marc:datafield[@tag=$tag]"> + <span> + <xsl:call-template name="addClassRtl" /> + <a> + <xsl:choose> + <xsl:when test="marc:subfield[@code=9]"> + <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="href">/recherche/simple/expressionRecherche/<xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='b']"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="marc:subfield[@code='a']"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='b']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='b']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='c']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='c']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='d']"> + <xsl:text> </xsl:text> + <xsl:value-of select="marc:subfield[@code='d']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='e']"> + <xsl:text> </xsl:text> + <xsl:value-of select="marc:subfield[@code='e']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='f']"> + <span dir="ltr"> + <xsl:text> (</xsl:text> + <xsl:value-of select="marc:subfield[@code='f']"/> + <xsl:text>)</xsl:text> + </span> + </xsl:if> + <xsl:if test="marc:subfield[@code='g']"> + <xsl:text> </xsl:text> + <xsl:value-of select="marc:subfield[@code='g']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='p']"> + <xsl:text> </xsl:text> + <xsl:value-of select="marc:subfield[@code='p']"/> + </xsl:if> + </a> + <xsl:if test="marc:subfield[@code='4']"> + <xsl:text> </xsl:text> + <xsl:value-of select="marc:subfield[@code='4']"/> + </xsl:if> + </span> + <xsl:if test="not (position() = last())"> + <xsl:text> ; </xsl:text> + </xsl:if> + </xsl:for-each> + </li> + </xsl:if> + </xsl:template> + +<!-- fin du report de utils --> + +<xsl:template match="marc:record"> + <xsl:variable name="leader" select="marc:leader"/> + <xsl:variable name="leader6" select="substring($leader,7,1)"/> + <xsl:variable name="leader7" select="substring($leader,8,1)"/> + <xsl:variable name="biblionumber" select="marc:datafield[@tag=090]/marc:subfield[@code='a']"/> + + + <xsl:if test="marc:datafield[@tag=200]"> + <xsl:for-each select="marc:datafield[@tag=200]"> + <h1> + <xsl:call-template name="addClassRtl" /> + <xsl:variable name="title" select="marc:subfield[@code='a']"/> + <xsl:variable name="ntitle" + select="translate($title, '˜œ슜슛슘슈슉','')"/> + <!--<xsl:value-of select="$ntitle" />--> + <xsl:value-of select="marc:subfield[@code='a'][1]" /> +<xsl:for-each select="marc:subfield[@code='b']"> + <xsl:text> [</xsl:text><xsl:value-of select="."/><xsl:text>]</xsl:text> + </xsl:for-each> +<xsl:if test="marc:subfield[@code='e'][1]"><xsl:text> : </xsl:text><xsl:value-of select="marc:subfield[@code='e'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='c'][1]"><xsl:text> .</xsl:text><xsl:value-of select="marc:subfield[@code='c'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='d'][1]"><xsl:text> =</xsl:text><xsl:value-of select="marc:subfield[@code='d'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='h'][1]"><xsl:text> . </xsl:text><xsl:value-of select="marc:subfield[@code='h'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='i'][1]"><xsl:text>, </xsl:text><xsl:value-of select="marc:subfield[@code='i'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='e'][2]"><xsl:text> : </xsl:text><xsl:value-of select="marc:subfield[@code='e'][2]" /></xsl:if> +<!--<xsl:if test="marc:subfield[@code='c'][2]"><xsl:text> .</xsl:text><xsl:value-of select="marc:subfield[@code='c'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='d'][2]"><xsl:text> = </xsl:text><xsl:value-of select="marc:subfield[@code='d'][2]" /></xsl:if>--> +<xsl:if test="marc:subfield[@code='h'][2]"><xsl:text> . </xsl:text><xsl:value-of select="marc:subfield[@code='h'][2]" /></xsl:if> +<xsl:if test="marc:subfield[@code='i'][2]"><xsl:text>, </xsl:text><xsl:value-of select="marc:subfield[@code='i'][2]" /></xsl:if> +<xsl:if test="marc:subfield[@code='e'][3]"><xsl:text> : </xsl:text><xsl:value-of select="marc:subfield[@code='e'][3]" /></xsl:if><!-- +<xsl:if test="marc:subfield[@code='c'][3]"><xsl:text> .</xsl:text><xsl:value-of select="marc:subfield[@code='c'][3]" /></xsl:if> +<xsl:if test="marc:subfield[@code='d'][3]"><xsl:text> = </xsl:text><xsl:value-of select="marc:subfield[@code='d'][3]" /></xsl:if> +<xsl:if test="marc:subfield[@code='h'][3]"><xsl:text> . </xsl:text><xsl:value-of select="marc:subfield[@code='h'][3]" /></xsl:if>--> +<xsl:if test="marc:subfield[@code='i'][3]"><xsl:text>, </xsl:text><xsl:value-of select="marc:subfield[@code='i'][3]" /></xsl:if> + +<xsl:if test="marc:subfield[@code='a'][2]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][2]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][3]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][3]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][4]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][4]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][5]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][5]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][6]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][6]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][7]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][7]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][8]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][8]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][9]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][9]" /></xsl:if> +<xsl:if test="marc:subfield[@code='a'][10]"><xsl:text>. </xsl:text><xsl:value-of select="marc:subfield[@code='a'][10]" /></xsl:if> + +<!--<xsl:if test="marc:subfield[@code='b']"><xsl:text> [</xsl:text><xsl:value-of select="marc:subfield[@code='b']"/><xsl:text>]</xsl:text> + </xsl:if>--> + + <xsl:if test="marc:subfield[@code='f']"> + <xsl:text> / </xsl:text> +<xsl:if test="marc:subfield[@code='f'][1]"><xsl:text></xsl:text><xsl:value-of select="marc:subfield[@code='f'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='f'][2]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='f'][2]" /></xsl:if> +<xsl:if test="marc:subfield[@code='f'][3]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='f'][3]" /></xsl:if> + </xsl:if> +<xsl:if test="marc:subfield[@code='g'][1]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][1]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][2]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][2]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][3]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][3]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][4]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][4]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][5]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][5]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][6]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][6]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][7]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][7]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][8]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][8]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][9]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][9]" /></xsl:if> +<xsl:if test="marc:subfield[@code='g'][10]"><xsl:text> ; </xsl:text><xsl:value-of select="marc:subfield[@code='g'][10]" /></xsl:if> + </h1> + </xsl:for-each> + </xsl:if> + + <li><strong>Numéro de notice Koha : </strong> + <xsl:value-of select="$biblionumber"/> + </li> + + <xsl:call-template name="tag_099" /> + + <xsl:call-template name="tag_4xx" /> + + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">421</xsl:with-param> + <xsl:with-param name="label">Supplément</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">422</xsl:with-param> + <xsl:with-param name="label">Publication-mère du supplément</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">430</xsl:with-param> + <xsl:with-param name="label">Suite de</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">432</xsl:with-param> + <xsl:with-param name="label">Remplace</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">434</xsl:with-param> + <xsl:with-param name="label">Absorbe</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">435</xsl:with-param> + <xsl:with-param name="label">Absorbe partiellement</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">436</xsl:with-param> + <xsl:with-param name="label">Fusion de ... et de ...</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">437</xsl:with-param> + <xsl:with-param name="label">Suite partielle de</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">441</xsl:with-param> + <xsl:with-param name="label">Devient partiellement</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">442</xsl:with-param> + <xsl:with-param name="label">Remplacé par</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">444</xsl:with-param> + <xsl:with-param name="label">Absorbé par</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">446</xsl:with-param> + <xsl:with-param name="label">Scindé en ... et en ...</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">447</xsl:with-param> + <xsl:with-param name="label">Fusionne avec ... pour former ...</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">453</xsl:with-param> + <xsl:with-param name="label">Traduit sous le titre</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">454</xsl:with-param> + <xsl:with-param name="label">Est une traduction de</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="tag_4xx_perio"> + <xsl:with-param name="tag">488</xsl:with-param> + <xsl:with-param name="label">Autre type de relation</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">700</xsl:with-param> + <xsl:with-param name="label">Auteur principal</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">710</xsl:with-param> + <xsl:with-param name="label">Auteur principal collectivité</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">701</xsl:with-param> + <xsl:with-param name="label">Co-auteur</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">702</xsl:with-param> + <xsl:with-param name="label">Auteur secondaire</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">711</xsl:with-param> + <xsl:with-param name="label">Co-auteur collectivité</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">712</xsl:with-param> + <xsl:with-param name="label">Auteur secondaire collectivité</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">790</xsl:with-param> + <xsl:with-param name="label">Emetteurs</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_7xx"> + <xsl:with-param name="tag">791</xsl:with-param> + <xsl:with-param name="label">Emetteurs</xsl:with-param> + </xsl:call-template> + + <xsl:if test="marc:datafield[@tag=022]"> + <li> + <strong>Numéro de publication officielle : </strong> + <xsl:for-each select="marc:datafield[@tag=022]"> + <xsl:for-each select="marc:subfield"> + <li> + <xsl:value-of select="text()"/> + </li> + </xsl:for-each> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=029]"> + <li> + <strong>Champs spécifiques BO / Instructions : </strong> + <xsl:for-each select="marc:datafield[@tag=029]"> + <xsl:for-each select="marc:subfield"> + <xsl:choose> + <xsl:when test="@code='a'">Année : </xsl:when> + <xsl:when test="@code='b'">Numéro : </xsl:when> + </xsl:choose> + <xsl:value-of select="text()"/><xsl:text> ; </xsl:text> + </xsl:for-each> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=101]"> + <li> + <strong>Langue : </strong> + </li> + <xsl:for-each select="marc:datafield[@tag=101]"> + <xsl:for-each select="marc:subfield"> + <li> + <xsl:choose> + <xsl:when test="@code='b'">du texte intermédiaire : </xsl:when> + <xsl:when test="@code='c'">de l'oeuvre originale : </xsl:when> + <xsl:when test="@code='d'">du résumé : </xsl:when> + <xsl:when test="@code='e'">de la table des matières : </xsl:when> + <xsl:when test="@code='f'">de la page de titre : </xsl:when> + <xsl:when test="@code='g'">du titre propre : </xsl:when> + <xsl:when test="@code='h'">du livret : </xsl:when> + <xsl:when test="@code='i'">du matériel d'accompagnement : </xsl:when> + <xsl:when test="@code='j'">des sous-titres : </xsl:when> </xsl:choose> + <xsl:value-of select="text()"/> + </li> + </xsl:for-each> + </xsl:for-each> + </xsl:if> +<!-- test pour bokeh, a supprimer si besoin !!!!!!!--> + <xsl:if test="marc:datafield[@tag=1000]"> + <li> + <strong>Langue : </strong> + </li> + <xsl:for-each select="marc:datafield[@tag=1000]"> + <li> + <xsl:value-of select="marc:subfield[@code='2']"/> <xsl:text> : </xsl:text><xsl:value-of select="marc:subfield[@code='a']"/> + </li> + </xsl:for-each> + </xsl:if> + + + <xsl:if test="marc:datafield[@tag=102]"> + <li> + <strong>Pays : </strong> + <xsl:for-each select="marc:datafield[@tag=102]"> + <xsl:for-each select="marc:subfield"> + <li> + <xsl:value-of select="text()"/> + </li> + </xsl:for-each> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=205]"> + <li> + <strong>Mention d'édition : </strong> + <xsl:for-each select="marc:datafield[@tag=205]"> + <xsl:for-each select="marc:subfield"> + <li> + <xsl:value-of select="text()"/> + </li> + </xsl:for-each> + </xsl:for-each> + </li> + </xsl:if> + + + <xsl:if test="marc:datafield[@tag=207]"> + <li> + <strong>Ressources continues, numérotation : </strong> + <xsl:for-each select="marc:datafield[@tag=207]"> + <xsl:for-each select="marc:subfield"> + <xsl:choose> + <xsl:when test="@code='a'">numérotation : </xsl:when> + <xsl:when test="@code='z'">source d'information sur la numérotation : </xsl:when> + </xsl:choose> + <xsl:value-of select="text()"/><xsl:text> ; </xsl:text> + </xsl:for-each> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:call-template name="tag_210" /> + + <xsl:call-template name="tag_215" /> + +<xsl:if test="marc:controlfield[@tag=009]"> + <li><strong>Champ 009 : </strong> + <xsl:value-of select="marc:controlfield[@tag=009]"/> + </li> + </xsl:if> + + <!-- Build ISBN --> + <xsl:if test="marc:datafield[@tag=010]/marc:subfield[@code='a']"> + <li><strong>ISBN : </strong> + <xsl:for-each select="marc:datafield[@tag=010]/marc:subfield[@code='a']"> + <li><span property="isbn"> + <xsl:value-of select="."/> + </span></li> + </xsl:for-each> + </li> + </xsl:if> + + <!-- Build ISSN --> + <xsl:if test="marc:datafield[@tag=011]/marc:subfield[@code='a']"> + <li> + <strong>ISSN : </strong> + <xsl:for-each select="marc:datafield[@tag=011]/marc:subfield[@code='a']"> + <span property="issn"> + <xsl:value-of select="."/> + <xsl:choose> + <xsl:when test="position()=last()"> + <xsl:text>.</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>; </xsl:text> + </xsl:otherwise> + </xsl:choose> + </span> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:call-template name="tag_title"> + <xsl:with-param name="tag">225</xsl:with-param> + <xsl:with-param name="label">Collection</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">503</xsl:with-param> + <xsl:with-param name="label">Titre de forme</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">510</xsl:with-param> + <xsl:with-param name="label">Titre parallèle</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">512</xsl:with-param> + <xsl:with-param name="label">Titre de couverture</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">513</xsl:with-param> + <xsl:with-param name="label">Titre figurant sur une autre page de titre</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">517</xsl:with-param> + <xsl:with-param name="label">Autres variantes du titre</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">530</xsl:with-param> + <xsl:with-param name="label">Titré clé</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">531</xsl:with-param> + <xsl:with-param name="label">Titre abrégé</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">532</xsl:with-param> + <xsl:with-param name="label">Titre développé</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_5xx"> + <xsl:with-param name="tag">540</xsl:with-param> + <xsl:with-param name="label">Titre ajouté par le catalogueur</xsl:with-param> + </xsl:call-template> + + <xsl:if test="marc:datafield[@tag=676]"> + <li> + <strong>Dewey : </strong> + <xsl:for-each select="marc:datafield[@tag=676]"> + <xsl:value-of select="marc:subfield[@code='a']"/> + <xsl:if test="marc:subfield[@code='v']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='v']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='z']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='z']"/> + </xsl:if> + <xsl:if test="not (position()=last())"> + <xsl:text> ; </xsl:text> + </xsl:if> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=686]"> + <li> + <strong>Classification : </strong> + <xsl:for-each select="marc:datafield[@tag=686]"> + <xsl:value-of select="marc:subfield[@code='a']"/> + <xsl:if test="marc:subfield[@code='b']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='b']"/> + </xsl:if> + <xsl:if test="marc:subfield[@code='c']"> + <xsl:text>, </xsl:text> + <xsl:value-of select="marc:subfield[@code='c']"/> + </xsl:if> + <xsl:if test="not (position()=last())"><xsl:text> ; </xsl:text></xsl:if> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=327]"> + <li> + <strong>Note de contenu : </strong> + <xsl:for-each select="marc:datafield[@tag=327]"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">abcdjpvxyz</xsl:with-param> + <xsl:with-param name="subdivCodes">jpxyz</xsl:with-param> + <xsl:with-param name="subdivDelimiter">-- </xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=330]"> + <li> + <strong>Résumé : </strong> + </li> + <xsl:for-each select="marc:datafield[@tag=330]"> + <li> + <xsl:call-template name="nl2br"> + <xsl:with-param name="string"><xsl:value-of select="marc:subfield[@code='a']"/></xsl:with-param> + </xsl:call-template> + </li> + </xsl:for-each> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=317]"> + <li> + <strong>Note de provenance : </strong> + <xsl:for-each select="marc:datafield[@tag=317]"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=320]"> + <li> + <strong>Bibliographie : </strong> + <xsl:for-each select="marc:datafield[@tag=320]"> + <xsl:value-of select="marc:subfield[@code='a']"/> + <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=328]"> + <li> + <strong>Note de thèse : </strong> + <xsl:for-each select="marc:datafield[@tag=328]"> + <xsl:value-of select="marc:subfield[@code='a']"/> + <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=333]"> + <li> + <strong>Public : </strong> + <xsl:for-each select="marc:datafield[@tag=333]"> + <xsl:value-of select="marc:subfield[@code='a']"/> + <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:if test="marc:datafield[@tag=955]"> + <li> + <strong>Historique SUDOC du périodique : </strong> + <xsl:for-each select="marc:datafield[@tag=955]"> + <xsl:value-of select="marc:subfield[@code='9']"/>: + <xsl:value-of select="marc:subfield[@code='r']"/> + <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose> + </xsl:for-each> + </li> + </xsl:if> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">600</xsl:with-param> + <xsl:with-param name="label">Sujet - Nom de personne</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">601</xsl:with-param> + <xsl:with-param name="label">Sujet - Collectivité</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">602</xsl:with-param> + <xsl:with-param name="label">Sujet - Famille</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">604</xsl:with-param> + <xsl:with-param name="label">Sujet - Auteur/titre</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">606</xsl:with-param> + <xsl:with-param name="label">Sujet - Nom commun</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">607</xsl:with-param> + <xsl:with-param name="label">Sujet - Nom géographique</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">608</xsl:with-param> + <xsl:with-param name="label">Sujet - Forme</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">609</xsl:with-param> + <xsl:with-param name="label">Mots clés TESS</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">610</xsl:with-param> + <xsl:with-param name="label">Sujet</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">611</xsl:with-param> + <xsl:with-param name="label">Mots clés période</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">615</xsl:with-param> + <xsl:with-param name="label">Catégorie de sujet</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">616</xsl:with-param> + <xsl:with-param name="label">Marque</xsl:with-param> + </xsl:call-template> + + <xsl:call-template name="tag_subject"> + <xsl:with-param name="tag">619</xsl:with-param> + <xsl:with-param name="label">Mots clés candidats</xsl:with-param> + </xsl:call-template> + + <xsl:if test="marc:datafield[@tag=856]"> + <li> + <strong>Ressources en ligne : </strong> + <xsl:for-each select="marc:datafield[@tag=856]"> + <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable> + <a target="_blank"> + <xsl:attribute name="href"> + <xsl:value-of select="marc:subfield[@code='u']"/> + </xsl:attribute> + <xsl:choose> + <xsl:when test="marc:subfield[@code='y' or @code='2' or @code='z']"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">y2z</xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:when test="not(marc:subfield[@code='y']) and not(marc:subfield[@code='3']) and not(marc:subfield[@code='z'])"> + Cliquez ici pour consulter en ligne </xsl:when> + </xsl:choose> + </a> + <xsl:choose> + <xsl:when test="position()=last()"></xsl:when> + <xsl:otherwise> | </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </li> + </xsl:if> +</xsl:template> + + <xsl:template name="nameABCDQ"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">aq</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="punctuation"> + <xsl:text>:,;/ </xsl:text> + </xsl:with-param> + </xsl:call-template> + <xsl:call-template name="termsOfAddress"/> + </xsl:template> + + <xsl:template name="nameABCDN"> + <xsl:for-each select="marc:subfield[@code='a']"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="."/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="marc:subfield[@code='b']"> + <xsl:value-of select="."/> + </xsl:for-each> + <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">cdn</xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="nameACDEQ"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">acdeq</xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template name="termsOfAddress"> + <xsl:if test="marc:subfield[@code='b' or @code='c']"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">bc</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="part"> + <xsl:variable name="partNumber"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">n</xsl:with-param> + <xsl:with-param name="anyCodes">n</xsl:with-param> + <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="partName"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="axis">p</xsl:with-param> + <xsl:with-param name="anyCodes">p</xsl:with-param> + <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:if test="string-length(normalize-space($partNumber))"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$partNumber"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="string-length(normalize-space($partName))"> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString" select="$partName"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="specialSubfieldSelect"> + <xsl:param name="anyCodes"/> + <xsl:param name="axis"/> + <xsl:param name="beforeCodes"/> + <xsl:param name="afterCodes"/> + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="contains($anyCodes, @code) or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis]) or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:template> + +</xsl:stylesheet>