Commit 8720195b authored by qkeunebr's avatar qkeunebr
Browse files

Merge branch 'master' of gitlab.utc.fr:crozatst/hdoc

parents d9754b20 34b7e4e1
!input/.gitkeep
!output/.gitkeep
\ No newline at end of file
...@@ -3,11 +3,10 @@ ...@@ -3,11 +3,10 @@
(: For example, $author := '^Baptiste Montangé$', to search for an exact name:) (: For example, $author := '^Baptiste Montangé$', to search for an exact name:)
(: For example, $name := 'Montangé', to search for documents whose author named Coutant:) (: For example, $name := 'Montangé', to search for documents whose author named Coutant:)
(: Remark : Accents in the authors' names have been taken care of :) (: Remark : Accents in the authors' names have been taken care of :)
declare function local:searchDocByAuthor($name as xs:string, $docs as node()*) as node()*
<documents>{ {
let $name := 'Montangé'
let $name_noAcc := translate($name, 'áàâäéèêëíìîïóòôöúùûü','aaaaeeeeiiiioooouuuu') let $name_noAcc := translate($name, 'áàâäéèêëíìîïóòôöúùûü','aaaaeeeeiiiioooouuuu')
for $doc in //document for $doc in $docs
return return
for $author in $doc/authors/author for $author in $doc/authors/author
let $titre := $doc/titre let $titre := $doc/titre
...@@ -15,4 +14,7 @@ ...@@ -15,4 +14,7 @@
where matches($author_noAcc, $name_noAcc) where matches($author_noAcc, $name_noAcc)
group by $titre (: Avoid duplications of documents by their titre:) group by $titre (: Avoid duplications of documents by their titre:)
return $doc return $doc
}</documents> };
\ No newline at end of file
(: Example :)
local:searchDocByAuthor('Montangé', //document)
\ No newline at end of file
...@@ -3,9 +3,12 @@ ...@@ -3,9 +3,12 @@
(: For example, $name := '^NF29_HdocEtherpad$', to search for an exact name:) (: For example, $name := '^NF29_HdocEtherpad$', to search for an exact name:)
(: For example, $name := 'NF29', to search for documents whose name contains 'NF29':) (: For example, $name := 'NF29', to search for documents whose name contains 'NF29':)
<documents>{ declare function local:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
let $name := '^NF29_HdocEtherpad$' {
for $doc in //document for $doc in $docs
where matches($doc/titre, $name, "i") where matches($doc/titre, $name, "i")
return $doc return $doc
}</documents> };
\ No newline at end of file
(: Example :)
local:searchDocByTitle('^NF29_HdocEtherpad$', //document)
\ No newline at end of file
...@@ -37,5 +37,5 @@ ...@@ -37,5 +37,5 @@
<xsl:template match="script"/> <xsl:template match="script"/>
<!-- Ignoring divs that are not useful and that might interfere with the true xslt transformation --> <!-- Ignoring divs that are not useful and that might interfere with the true xslt transformation -->
<xsl:template match="/html/body/div/div/div/div[@class!='mw-highlight mw-content-ltr']"/> <xsl:template match="/html/body/div/div/div/div[@class!='mw-highlight mw-content-ltr' and not(descendant::table)]"/>
</xsl:stylesheet> </xsl:stylesheet>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment