Changeset 66


Ignore:
Timestamp:
05/14/08 17:35:50 (16 years ago)
Author:
pinsard
Message:

implemenation of xml to bibtex transformation (superbib02_txt.xsl). reverse is not yet correctly done

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/biblioentry_xml.xsl

    r65 r66  
    1313update : 
    1414$Id$ 
     15fplod 2008-05-14T08:51:10Z aedon.locean-ipsl.upmc.fr (Darwin) 
     16introducting bibtex (latex) output 
     17fplod 2008-05-13T15:24:49Z aedon.locean-ipsl.upmc.fr (Darwin) 
     18add parameter type (default raw) 
    1519fplod 2008-05-13T09:17:14Z aedon.locean-ipsl.upmc.fr (Darwin) 
    1620bibliomisc is written after biblioid 
     
    4549<xsl:template name="one_biblioentry"> 
    4650 <xsl:param name="visu_modif"/> 
     51 <xsl:param name="type"/> 
    4752 <xsl:param name="my_biblioentry"/> 
     53 <xsl:choose> 
     54  <xsl:when test="$type = 'bibtex'"> 
     55   <xsl:choose> 
     56    <xsl:when test="$my_biblioentry/descendant::d:biblioset[@relation='journal']"> 
     57     <xsl:text>@article{</xsl:text> 
     58    </xsl:when> 
     59    <xsl:when test="$my_biblioentry/descendant::d:biblioset[@relation='conference']"> 
     60     <xsl:text>@inproceedings{</xsl:text> 
     61    </xsl:when> 
     62    <xsl:otherwise> 
     63     <xsl:message terminate="yes"> 
     64eee : unknown biblioset relation for <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
     65eee : <xsl:value-of select="$my_biblioentry/descendant::d:biblioset/@relation"/> 
     66     </xsl:message> 
     67    </xsl:otherwise> 
     68   </xsl:choose> 
     69   <xsl:value-of select="$my_biblioentry/@xml:id"/> 
     70  </xsl:when> <!-- end of bibtex specific header for biblioentry --> 
     71 </xsl:choose> 
    4872 <xsl:element name="listitem"> 
    4973  <xsl:element name="para"> 
    50     <xsl:apply-templates select="$my_biblioentry/d:authorgroup"/> 
    51     <xsl:text>, </xsl:text> 
    52     <xsl:if test="$my_biblioentry/descendant::d:pubdate"> 
    53      <xsl:apply-templates select="$my_biblioentry/descendant::d:pubdate"/> 
    54     </xsl:if> 
     74   <xsl:choose> 
     75    <xsl:when test="$type = 'bibtex'"> 
     76     <xsl:apply-templates select="$my_biblioentry/d:authorgroup" mode="bibtex"/> 
     77    </xsl:when> 
     78    <xsl:otherwise> 
     79     <xsl:apply-templates select="$my_biblioentry/d:authorgroup" mode="raw"/> 
     80    </xsl:otherwise> 
     81   </xsl:choose> 
     82   <xsl:if test="$my_biblioentry/descendant::d:pubdate"> 
     83    <xsl:choose> 
     84     <xsl:when test="$type = 'bibtex'"> 
     85      <xsl:apply-templates select="$my_biblioentry/descendant::d:pubdate" mode="bibtex"/> 
     86     </xsl:when> 
     87     <xsl:otherwise> 
     88      <xsl:apply-templates select="$my_biblioentry/descendant::d:pubdate" mode="raw"/> 
     89     </xsl:otherwise> 
     90    </xsl:choose> 
     91   </xsl:if> 
    5592    <xsl:if test="$my_biblioentry/descendant::d:date"> 
    5693     <xsl:apply-templates select="$my_biblioentry/descendant::d:date"/> 
    5794    </xsl:if> 
    58     <xsl:text> : </xsl:text> 
    59     <xsl:apply-templates select="$my_biblioentry/d:title"/> 
    60     <xsl:text>, </xsl:text> 
     95   <xsl:choose> 
     96    <xsl:when test="$type = 'bibtex'"> 
     97     <xsl:apply-templates select="$my_biblioentry/d:title" mode="bibtex"/> 
     98    </xsl:when> 
     99    <xsl:otherwise> 
     100     <xsl:apply-templates select="$my_biblioentry/d:title" mode="raw"/> 
     101    </xsl:otherwise> 
     102   </xsl:choose> 
    61103    <xsl:choose> 
    62104     <xsl:when test="$my_biblioentry/descendant::d:biblioset[@relation='journal']"> 
    63       <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:title"/> 
     105      <xsl:choose> 
     106       <xsl:when test="$type = 'bibtex'"> 
     107        <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:title" mode="bibtex"/> 
     108       </xsl:when> 
     109       <xsl:otherwise> 
     110        <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:title" mode="raw"/> 
     111       </xsl:otherwise> 
     112      </xsl:choose> 
    64113      <xsl:if test="$my_biblioentry/descendant::d:publishername"> 
    65        <xsl:text>, </xsl:text> 
    66        <xsl:apply-templates select="$my_biblioentry/descendant::d:publishername"/> 
     114       <xsl:choose> 
     115        <xsl:when test="$type = 'bibtex'"> 
     116         <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:publishername" mode="bibtex"/> 
     117        </xsl:when> 
     118        <xsl:otherwise> 
     119         <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:publishername" mode="raw"/> 
     120        </xsl:otherwise> 
     121       </xsl:choose> 
    67122      </xsl:if> 
    68123      <xsl:if test="$my_biblioentry/descendant::d:publisher/d:address"> 
    69        <xsl:text>, </xsl:text> 
    70        <xsl:apply-templates select="$my_biblioentry/descendant::d:publisher/d:address"/> 
     124       <xsl:choose> 
     125        <xsl:when test="$type = 'bibtex'"> 
     126         <xsl:apply-templates select="$my_biblioentry/descendant::d:publisher/d:address" mode="bibtex"/> 
     127        </xsl:when> 
     128        <xsl:otherwise> 
     129         <xsl:apply-templates select="$my_biblioentry/descendant::d:publisher/d:address" mode="raw"/> 
     130        </xsl:otherwise> 
     131       </xsl:choose> 
    71132      </xsl:if> 
    72133      <xsl:if test="$my_biblioentry/descendant::d:volumenum"> 
    73        <xsl:text>, </xsl:text> 
    74        <xsl:apply-templates select="$my_biblioentry/descendant::d:volumenum"/> 
     134       <xsl:choose> 
     135        <xsl:when test="$type = 'bibtex'"> 
     136         <xsl:apply-templates select="$my_biblioentry/descendant::d:volumenum" mode="bibtex"/> 
     137        </xsl:when> 
     138        <xsl:otherwise> 
     139         <xsl:apply-templates select="$my_biblioentry/descendant::d:volumenum" mode="raw"/> 
     140        </xsl:otherwise> 
     141       </xsl:choose> 
    75142       <xsl:if test="$my_biblioentry/descendant::d:issuenum"> 
    76         <xsl:text>, </xsl:text> 
    77         <xsl:apply-templates select="$my_biblioentry/descendant::d:issuenum"/> 
     143        <xsl:choose> 
     144         <xsl:when test="$type = 'bibtex'"> 
     145          <xsl:apply-templates select="$my_biblioentry/descendant::d:issuenum" mode="bibtex"/> 
     146         </xsl:when> 
     147         <xsl:otherwise> 
     148          <xsl:apply-templates select="$my_biblioentry/descendant::d:issuenum" mode="raw"/> 
     149         </xsl:otherwise> 
     150        </xsl:choose> 
     151        </xsl:if> 
    78152       </xsl:if> 
     153      <xsl:if test="$my_biblioentry/descendant::d:pagenums"> 
     154       <xsl:choose> 
     155        <xsl:when test="$type = 'bibtex'"> 
     156         <xsl:apply-templates select="$my_biblioentry/descendant::d:pagenums" mode="bibtex"/> 
     157        </xsl:when> 
     158        <xsl:otherwise> 
     159         <xsl:apply-templates select="$my_biblioentry/descendant::d:pagenums" mode="raw"/> 
     160        </xsl:otherwise> 
     161       </xsl:choose> 
    79162      </xsl:if> 
    80       <xsl:if test="$my_biblioentry/descendant::d:pagenums"> 
    81        <xsl:text>, </xsl:text> 
    82        <xsl:apply-templates select="$my_biblioentry/descendant::d:pagenums"/> 
     163      <xsl:if test="$my_biblioentry/d:biblioid"> 
     164       <xsl:choose> 
     165        <xsl:when test="$type = 'bibtex'"> 
     166         <xsl:apply-templates select="$my_biblioentry/d:biblioid" mode="bibtex"/> 
     167        </xsl:when> 
     168        <xsl:otherwise> 
     169        <xsl:apply-templates select="$my_biblioentry/d:bibliomisc" mode="raw"/> 
     170        </xsl:otherwise> 
     171       </xsl:choose> 
    83172      </xsl:if> 
    84       <xsl:apply-templates select="$my_biblioentry/d:biblioid"/> 
    85173      <xsl:if test="$my_biblioentry/descendant::d:biblioset/child::d:bibliomisc"> 
    86        <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:bibliomisc"/> 
     174       <xsl:choose> 
     175        <xsl:when test="$type = 'bibtex'"> 
     176         <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:bibliomisc" mode="bibtex"/> 
     177        </xsl:when> 
     178        <xsl:otherwise> 
     179        <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:bibliomisc" mode="raw"/> 
     180        </xsl:otherwise> 
     181       </xsl:choose> 
    87182      </xsl:if> 
    88183     </xsl:when> 
    89184     <xsl:when test="$my_biblioentry/descendant::d:biblioset[@relation='conference']"> 
    90       <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:title"/> 
    91       <xsl:text>, </xsl:text> 
     185      <xsl:choose> 
     186       <xsl:when test="$type = 'bibtex'"> 
     187        <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset[@relation='conference']/child::d:title" mode="bibtex"/> 
     188       </xsl:when> 
     189       <xsl:otherwise> 
     190        <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/child::d:title" mode="raw"/> 
     191       </xsl:otherwise> 
     192      </xsl:choose> 
    92193      <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/descendant::d:conftitle"/> 
    93194      <xsl:if test="$my_biblioentry/descendant::d:biblioset/descendant::d:confnum"> 
    94195       <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/descendant::d:confnum"/> 
    95196      </xsl:if> 
    96       <xsl:text>, </xsl:text> 
    97197      <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/descendant::d:confdates"/> 
    98       <xsl:text>, </xsl:text> 
    99       <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/descendant::d:address"/> 
    100       <xsl:text>, </xsl:text> 
    101       <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/descendant::d:publishername"/> 
     198       <xsl:choose> 
     199        <xsl:when test="$type = 'bibtex'"> 
     200         <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/descendant::d:address" mode="bibtex"/> 
     201        </xsl:when> 
     202        <xsl:otherwise> 
     203         <xsl:apply-templates select="$my_biblioentry/descendant::d:biblioset/descendant::d:address" mode="raw"/> 
     204        </xsl:otherwise> 
     205       </xsl:choose> 
     206       <xsl:choose> 
     207        <xsl:when test="$type = 'bibtex'"> 
     208         <xsl:apply-templates select="$my_biblioentry/descendant::d:publishername" mode="bibtex"/> 
     209        </xsl:when> 
     210        <xsl:otherwise> 
     211         <xsl:apply-templates select="$my_biblioentry/descendant::d:publishername" mode="raw"/> 
     212        </xsl:otherwise> 
     213       </xsl:choose> 
    102214      <xsl:if test="$my_biblioentry/descendant::d:pagenums"> 
    103        <xsl:text>, </xsl:text> 
    104        <xsl:apply-templates select="$my_biblioentry/descendant::d:pagenums"/> 
     215       <xsl:choose> 
     216        <xsl:when test="$type = 'bibtex'"> 
     217         <xsl:apply-templates select="$my_biblioentry/descendant::d:pagenums" mode="bibtex"/> 
     218        </xsl:when> 
     219        <xsl:otherwise> 
     220         <xsl:apply-templates select="$my_biblioentry/descendant::d:pagenums" mode="raw"/> 
     221        </xsl:otherwise> 
     222       </xsl:choose> 
    105223      </xsl:if> 
    106224     </xsl:when> 
     
    110228eee : <xsl:value-of select="$my_biblioentry/descendant::d:biblioset/@relation"/> 
    111229      </xsl:message> 
    112       <xsl:apply-templates select="$my_biblioentry/descendant::d:publishername"/> 
     230       <xsl:choose> 
     231        <xsl:when test="$type = 'bibtex'"> 
     232         <xsl:apply-templates select="$my_biblioentry/descendant::d:publishername" mode="bibtex"/> 
     233        </xsl:when> 
     234        <xsl:otherwise> 
     235         <xsl:apply-templates select="$my_biblioentry/descendant::d:publishername" mode="raw"/> 
     236        </xsl:otherwise> 
     237       </xsl:choose> 
    113238     </xsl:otherwise> 
    114239    </xsl:choose> 
     
    125250  </xsl:if> 
    126251 </xsl:element> 
    127 </xsl:template> 
    128  
    129 <xsl:template match="d:authorgroup"> 
     252 <xsl:choose> 
     253  <xsl:when test="$type = 'bibtex'"> 
     254  <xsl:text>}</xsl:text> 
     255  </xsl:when> 
     256 </xsl:choose> 
     257</xsl:template> 
     258 
     259<xsl:template match="d:authorgroup" mode="raw"> 
    130260 <xsl:apply-templates select="d:author"/> 
    131261 <xsl:apply-templates select="d:corpauthor"/> 
     262</xsl:template> 
     263 
     264<xsl:template match="d:authorgroup" mode="bibtex"> 
     265 <xsl:text>, </xsl:text> 
     266 <xsl:text>author = {</xsl:text> 
     267 <xsl:apply-templates select="d:author"/> 
     268 <xsl:apply-templates select="d:corpauthor"/> 
     269 <xsl:text>} </xsl:text> 
    132270</xsl:template> 
    133271 
     
    204342</xsl:template> 
    205343 
    206 <xsl:template match="d:biblioentry/d:title"> 
    207   <xsl:value-of select="normalize-space(.)"/> 
    208 </xsl:template> 
    209  
    210 <xsl:template match="d:biblioset[@relation='journal']/d:title"> 
    211   <xsl:value-of select="normalize-space(.)"/> 
    212 </xsl:template> 
    213  
    214 <xsl:template match="d:publishername"> 
    215   <xsl:value-of select="normalize-space(.)"/> 
    216 </xsl:template> 
    217  
    218 <xsl:template match="d:biblioset[@relation='journal']/d:pubdate"> 
    219   <xsl:value-of select="normalize-space(.)"/> 
    220 </xsl:template> 
    221 <xsl:template match="d:biblioset[@relation='conference']/d:pubdate"> 
    222   <xsl:value-of select="normalize-space(.)"/> 
    223 </xsl:template> 
     344<xsl:template match="d:biblioentry/d:title" mode="raw"> 
     345 <xsl:text> : </xsl:text> 
     346 <xsl:value-of select="normalize-space(.)"/> 
     347</xsl:template> 
     348 
     349<xsl:template match="d:biblioentry/d:title" mode="bibtex"> 
     350 <xsl:text>, title = {</xsl:text> 
     351 <xsl:value-of select="normalize-space(.)"/> 
     352 <xsl:text>}</xsl:text> 
     353</xsl:template> 
     354 
     355<xsl:template match="d:biblioset[@relation='journal']/d:title" mode="raw"> 
     356 <xsl:text>, </xsl:text> 
     357 <xsl:value-of select="normalize-space(.)"/> 
     358</xsl:template> 
     359 
     360<xsl:template match="d:biblioset[@relation='journal']/d:title" mode="bibtex"> 
     361 <xsl:text>, journal = {</xsl:text> 
     362 <xsl:value-of select="normalize-space(.)"/> 
     363 <xsl:text>} </xsl:text> 
     364</xsl:template> 
     365 
     366<xsl:template match="d:biblioset[@relation='conference']/d:title" mode="raw"> 
     367 <xsl:text>, </xsl:text> 
     368 <xsl:value-of select="normalize-space(.)"/> 
     369</xsl:template> 
     370 
     371<xsl:template match="d:biblioset[@relation='conference']/d:title" mode="bibtex"> 
     372 <xsl:text>, inproceedings = {</xsl:text> 
     373 <xsl:value-of select="normalize-space(.)"/> 
     374 <xsl:text>} </xsl:text> 
     375</xsl:template> 
     376 
     377<xsl:template match="d:publishername" mode="raw"> 
     378 <xsl:text>, </xsl:text> 
     379 <xsl:value-of select="normalize-space(.)"/> 
     380</xsl:template> 
     381 
     382<xsl:template match="d:publishername" mode="bibtex"> 
     383 <xsl:text>, publisher = {</xsl:text> 
     384 <xsl:value-of select="normalize-space(.)"/> 
     385 <xsl:text>} </xsl:text> 
     386</xsl:template> 
     387 
     388<xsl:template match="d:pubdate" mode="raw"> 
     389 <xsl:text>, </xsl:text> 
     390 <xsl:value-of select="normalize-space(.)"/> 
     391</xsl:template> 
     392 
     393<xsl:template match="d:pubdate" mode="bibtex"> 
     394 <xsl:text>, year = {</xsl:text> 
     395 <xsl:value-of select="normalize-space(.)"/>  
     396 <xsl:text>} </xsl:text> 
     397</xsl:template> 
     398 
    224399<xsl:template match="d:date"> 
    225400 <xsl:message terminate="no"> 
     
    231406</xsl:template> 
    232407 
    233 <xsl:template match="d:biblioset[@relation='journal']/d:volumenum"> 
    234   <xsl:value-of select="normalize-space(.)"/> 
    235 </xsl:template> 
    236  
    237 <xsl:template match="d:biblioset[@relation='journal']/d:issuenum"> 
    238   <xsl:value-of select="normalize-space(.)"/> 
    239 </xsl:template> 
    240  
    241 <xsl:template match="d:biblioset[@relation='journal']/d:pagesnum"> 
    242   <xsl:value-of select="normalize-space(.)"/> 
    243 </xsl:template> 
    244  
    245 <xsl:template match="d:biblioset[@relation='conference']/d:title"> 
    246 <!-- title of proceedings for instance --> 
    247  <xsl:value-of select="normalize-space(.)"/> 
     408<xsl:template match="d:volumenum" mode="raw"> 
     409 <xsl:text>, </xsl:text> 
     410 <xsl:value-of select="normalize-space(.)"/> 
     411</xsl:template> 
     412 
     413<xsl:template match="d:volumenum" mode="bibtex"> 
     414 <xsl:text>, volume = {</xsl:text> 
     415 <xsl:value-of select="normalize-space(.)"/>  
     416 <xsl:text>} </xsl:text> 
     417</xsl:template> 
     418 
     419<xsl:template match="d:issuenum" mode="raw"> 
     420 <xsl:text>, </xsl:text> 
     421 <xsl:value-of select="normalize-space(.)"/> 
     422</xsl:template> 
     423 
     424<xsl:template match="d:issuenum" mode="bibtex"> 
     425 <xsl:text>, number = {</xsl:text> 
     426 <xsl:value-of select="normalize-space(.)"/>  
     427 <xsl:text>} </xsl:text> 
     428</xsl:template> 
     429 
     430<xsl:template match="d:pagenums" mode="raw"> 
     431 <xsl:text>, </xsl:text> 
     432 <xsl:value-of select="normalize-space(.)"/> 
     433</xsl:template> 
     434 
     435<xsl:template match="d:pagenums" mode="bibtex"> 
     436 <xsl:text>, pages = {</xsl:text> 
     437 <xsl:value-of select="normalize-space(.)"/> 
     438 <xsl:text>} </xsl:text> 
     439</xsl:template> 
     440 
     441<xsl:template match="d:biblioid[@class='isbn']" mode="raw"> 
     442 <xsl:text>, ISBN : </xsl:text> 
     443 <xsl:value-of select="normalize-space(.)"/> 
     444</xsl:template> 
     445 
     446<xsl:template match="d:biblioid[@class='isbn']" mode="bibtex"> 
     447 <xsl:text>, isbn = {</xsl:text> 
     448 <xsl:value-of select="normalize-space(.)"/> 
     449 <xsl:text>} </xsl:text> 
     450</xsl:template> 
     451 
     452 
     453<xsl:template match="d:biblioid[@class='other']" mode="raw"> 
     454 <xsl:text>, </xsl:text> 
     455 <xsl:value-of select="@otherclass"/> 
     456 <xsl:text> : </xsl:text> 
     457 <xsl:value-of select="normalize-space(.)"/> 
     458</xsl:template> 
     459 
     460<xsl:template match="d:biblioid[@class='other']" mode="bibtex"> 
     461 <xsl:text>, note = {</xsl:text> 
     462 <xsl:value-of select="@otherclass"/> 
     463 <xsl:text> : </xsl:text> 
     464 <xsl:value-of select="normalize-space(.)"/> 
     465 <xsl:text>} </xsl:text> 
     466</xsl:template> 
     467 
     468<xsl:template match="d:biblioid[@class='doi']" mode="bibtex"> 
     469 <xsl:message terminate="no"> 
     470BBBB 
     471 </xsl:message> 
     472   <xsl:choose> 
     473    <xsl:when test=". = '???'"> 
     474     <xsl:message> iii : no doi found for  
     475      <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
     476     </xsl:message> 
     477    </xsl:when> 
     478    <xsl:otherwise> 
     479     <!-- ++ transformer 10.1029/2003GL018906 en un lien sur http://dx.doi.org/10.1029/2003GL018906 par exemple 
     480  --> 
     481      <xsl:text>, doi = {</xsl:text> <!-- ++ pas sûre, peut-être seulement note = {doi:..} --> 
     482      <xsl:value-of select="normalize-space(.)"/> 
     483    </xsl:otherwise> 
     484   </xsl:choose> 
     485 <xsl:text>} </xsl:text> 
     486</xsl:template> 
     487 
     488<xsl:template match="d:biblioid[@class='doi']" mode="raw"> 
     489   <xsl:choose> 
     490    <xsl:when test=". = '???'"> 
     491     <xsl:message> iii : no doi found for 
     492      <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
     493     </xsl:message> 
     494    </xsl:when> 
     495    <xsl:otherwise> 
     496     <!-- transformer 10.1029/2003GL018906 en un lien sur http://dx.doi.org/10.1029/2003GL018906 par exemple --> 
     497     <xsl:text>, </xsl:text> 
     498     <xsl:element name="link"> 
     499      <xsl:attribute name="xl:href"> 
     500       <xsl:text>http://dx.doi.org/</xsl:text> 
     501       <xsl:value-of select="normalize-space(.)"/> 
     502      </xsl:attribute> 
     503      <xsl:text>doi:</xsl:text><xsl:value-of select="normalize-space(.)"/> 
     504     </xsl:element> 
     505    </xsl:otherwise> 
     506   </xsl:choose> 
     507 <xsl:value-of select="normalize-space(.)"/> 
     508 <xsl:text>, </xsl:text> 
    248509</xsl:template> 
    249510 
    250511<xsl:template match="d:conftitle"> 
    251   <xsl:value-of select="normalize-space(.)"/> 
     512 <xsl:text>, </xsl:text> 
     513 <xsl:value-of select="normalize-space(.)"/> 
    252514</xsl:template> 
    253515 
    254516<xsl:template match="d:confdates"> 
    255   <xsl:value-of select="normalize-space(.)"/> 
    256 </xsl:template> 
     517 <xsl:text>, </xsl:text> 
     518 <xsl:value-of select="normalize-space(.)"/> 
     519</xsl:template> 
     520 
    257521<xsl:template match="d:confnum"> 
    258   <xsl:value-of select="normalize-space(.)"/> 
    259 </xsl:template> 
    260  
    261 <xsl:template match="d:address"> 
    262   <xsl:value-of select="normalize-space(.)"/> 
     522 <xsl:text>, </xsl:text> 
     523 <xsl:value-of select="normalize-space(.)"/> 
     524</xsl:template> 
     525 
     526<xsl:template match="d:address" mode="raw"> 
     527 <xsl:text>, </xsl:text> 
     528 <xsl:value-of select="normalize-space(.)"/> 
     529</xsl:template> 
     530 
     531<xsl:template match="d:address" mode="bibtex"> 
     532 <xsl:text>, address = {</xsl:text> 
     533 <xsl:value-of select="normalize-space(.)"/> 
     534 <xsl:text>} </xsl:text> 
    263535</xsl:template> 
    264536 
     
    266538<xsl:choose> 
    267539<xsl:when test="@class='doi'"> 
    268  <xsl:choose> 
    269   <xsl:when test=". = '???'"> 
    270    <xsl:message> iii : no doi found for  
    271     <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
    272    </xsl:message> 
    273   </xsl:when> 
    274  <xsl:otherwise> 
    275   <!-- transformer 10.1029/2003GL018906 en un lien sur http://dx.doi.org/10.1029/2003GL018906 par exemple 
    276   --> 
    277   <xsl:text>, </xsl:text> 
    278   <xsl:element name="link"> 
    279    <xsl:attribute name="xl:href"> 
    280     <xsl:text>http://dx.doi.org/</xsl:text> 
    281     <xsl:value-of select="normalize-space(.)"/> 
    282    </xsl:attribute> 
    283    <xsl:text>doi:</xsl:text><xsl:value-of select="normalize-space(.)"/> 
    284   </xsl:element> 
    285  </xsl:otherwise> 
    286  </xsl:choose> 
     540 <xsl:apply-templates select="." mode="bibtex"/> 
     541 <xsl:message terminate="no"> 
     542AAAA <xsl:value-of select="normalize-space(.)"/> 
     543 </xsl:message> 
    287544</xsl:when> 
    288545<xsl:when test="@class='isbn'"> 
    289  <xsl:text>, ISBN : </xsl:text><xsl:value-of select="normalize-space(.)"/> 
     546 <xsl:apply-templates select="." mode="bibtex"/> 
    290547</xsl:when> 
    291548<xsl:when test="@class='other'"> 
    292  <xsl:text>, </xsl:text><xsl:value-of select="@otherclass"/><xsl:text> : </xsl:text><xsl:value-of select="normalize-space(.)"/> 
     549 <xsl:apply-templates select="." mode="bibtex"/> 
     550 <xsl:message terminate="no"> 
     551CCCC <xsl:value-of select="normalize-space(.)"/> 
     552 </xsl:message> 
     553</xsl:when> 
     554<xsl:otherwise> 
     555 <xsl:message terminate="yes"> 
     556eee : unknown biblioid class for <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
     557eee : class : <xsl:value-of select="normalize-space(@class)"/> 
     558eee : value : <xsl:value-of select="normalize-space(.)"/> 
     559 </xsl:message> 
     560</xsl:otherwise> 
     561</xsl:choose> 
     562</xsl:template> 
     563 
     564<xsl:template match="d:bibliomisc" mode="raw"> 
     565<xsl:choose> 
     566<xsl:when test="contains(.,'In Press') or contains(.,'In press') or contains(.,'in press') or contains(.,'in revision') or contains(.,'submitted')"> 
     567 <xsl:value-of select="normalize-space(.)"/> 
     568 <xsl:text>, </xsl:text> 
    293569</xsl:when> 
    294570<xsl:otherwise> 
    295571 <xsl:message terminate="no"> 
    296 eee : unknown biblioid class for <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
    297 eee : <xsl:value-of select="normalize-space(.)"/> 
    298  </xsl:message> 
    299 </xsl:otherwise> 
    300 </xsl:choose> 
    301 </xsl:template> 
    302  
    303 <xsl:template match="d:bibliomisc"> 
    304 <xsl:choose> 
    305 <xsl:when test="contains(.,'In Press')"> 
    306  <xsl:text>, </xsl:text> 
    307  <xsl:value-of select="normalize-space(.)"/> 
    308 </xsl:when> 
    309 <xsl:when test="contains(.,'In press')"> 
    310  <xsl:text>, </xsl:text> 
    311  <xsl:value-of select="normalize-space(.)"/> 
    312 </xsl:when> 
    313 <xsl:when test="contains(.,'in press')"> 
    314  <xsl:text>, </xsl:text> 
    315  <xsl:value-of select="normalize-space(.)"/> 
    316 </xsl:when> 
    317 <xsl:when test="contains(.,'in revision')"> 
    318  <xsl:text>, </xsl:text> 
    319  <xsl:value-of select="normalize-space(.)"/> 
    320 </xsl:when> 
    321 <xsl:when test="contains(.,'submitted')"> 
    322  <xsl:text>, </xsl:text> 
    323  <xsl:value-of select="normalize-space(.)"/> 
    324 </xsl:when> 
    325 <xsl:otherwise> 
    326  <xsl:message> 
    327572eee : unknown bibliomisc purpose for <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
    328573eee : <xsl:value-of select="normalize-space(.)"/> 
     
    334579</xsl:template> 
    335580 
     581<xsl:template match="d:bibliomisc" mode="bibtex"> 
     582<xsl:choose> 
     583<xsl:when test="contains(.,'In Press') or contains(.,'In press') or contains(.,'in press') or contains(.,'in revision') or contains(.,'submitted')"> 
     584   <xsl:text>, note = {</xsl:text> 
     585 <xsl:value-of select="normalize-space(.)"/> 
     586   <xsl:text>} </xsl:text> 
     587</xsl:when> 
     588<xsl:otherwise> 
     589 <xsl:message terminate="no"> 
     590eee : unknown bibliomisc purpose for <xsl:value-of select="ancestor::d:biblioentry/@xml:id"/> 
     591eee : <xsl:value-of select="normalize-space(.)"/> 
     592 </xsl:message> 
     593 <xsl:text>, note = {</xsl:text> 
     594 <xsl:value-of select="normalize-space(.)"/> 
     595 <xsl:text>} </xsl:text> 
     596</xsl:otherwise> 
     597</xsl:choose> 
     598</xsl:template> 
     599 
    336600</xsl:stylesheet> 
  • trunk/bibopa.sh

    r65 r66  
    417417# strip comments 
    418418fileraw_strict=/tmp/$(basename ${fileraw})_strict 
    419 grep -v "^#" ${fileraw} > ${fileraw_strict} 
     419grep -v "^#" ${fileraw} | grep -v "^%" > ${fileraw_strict} 
    420420totlines=$( wc -l ${fileraw_strict} | awk '{print $1}' ) 
    421421l=1 
     
    435435     # before the last , 
    436436       auths=${tmp%,*}, 
    437      # replace "and" by "," 
     437     # replace " and " by "," 
    438438       auths=$( echo "${auths}" | sed -e "s/ and /,/g" ) 
     439     # replace " et " by "," 
     440       auths=$( echo "${auths}" | sed -e "s/ et /,/g" ) 
    439441     # after the last , 
    440442       year=${tmp##*,} 
     
    712714          pag=${endline##*,} 
    713715          pag=$( cleanname "${pag}" ) 
    714 #set  
     716#set 
    715717#read a 
    716718          cat <<EOF >> ${fileou} 
     
    736738      ;; 
    737739      10) 
    738           publishername=${endline%%Editors,*}  
     740          publishername=${endline%%Editors,*} 
    739741          publishername="${publishername} Editors" 
    740742          publishername=$( cleanname "${publishername}" ) 
     
    771773EOF 
    772774      unset isbn 
    773       unset agu  
     775      unset agu 
    774776      unset pag 
    775777      unset publishername 
     
    800802  unset title 
    801803  unset vol 
    802   unset year  
     804  unset year 
    803805  unset pag 
    804806  l=$(( ${l} + 1 )) 
  • trunk/makefile

    r65 r66  
    177177clean : 
    178178        -@rm -fr $(DIRWWW)/ 
    179         -@rm -f $(DIRTMP)/bibdemo1_dbk5.txt 
    180         -@rm -f $(DIRTMP)/bibdemo1_dbk5.xml 
     179        -@rm -f $(DIRTMP)/bibdemo1_dbk5_1.txt 
     180        -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.txt 
     181        -@rm -f $(DIRTMP)/bibdemo1_dbk5_1.xml 
     182        -@rm -f $(DIRTMP)/bibdemo1_dbk5_2.xml 
     183        -@rm -f $(DIRTMP)/bibdemo1_dbk5.bib 
    181184        -@rm -f $(DIRTMP)/bibnemo1.xml 
    182185        -@rm -f $(DIRTMP)/bibnemo1.txt 
     
    548551 
    549552test_raw : \ 
    550 test_raw_demo1 \ 
     553test_raw_demo1_1 \ 
     554test_raw_demo1_2 \ 
    551555test_raw_nemo1 \ 
    552556test_raw_nemoall 
    553557 
    554 test_raw_demo1 : \ 
     558test_raw_demo1_1 : \ 
    555559$(DIRSRC)/data/bibdemo1_dbk5.xml \ 
    556 $(DIRTMP)/bibdemo1_dbk5.xml \ 
    557 $(DIRTMP)/bibdemo1_dbk5.txt 
    558         diff -b $(DIRTMP)/bibdemo1_dbk5.xml $(DIRSRC)/data/bibdemo1_dbk5.xml | more 
    559         rm -i $(DIRTMP)/bibdemo1_dbk5.xml $(DIRTMP)/bibdemo1_dbk5.txt 
    560  
    561 $(DIRTMP)/bibdemo1_dbk5.txt : \ 
     560$(DIRTMP)/bibdemo1_dbk5_1.xml \ 
     561$(DIRTMP)/bibdemo1_dbk5_1.txt 
     562        diff -b $(DIRTMP)/bibdemo1_dbk5_1.xml $(DIRSRC)/data/bibdemo1_dbk5.xml | more 
     563        rm -i $(DIRTMP)/bibdemo1_dbk5_1.xml $(DIRTMP)/bibdemo1_dbk5_1.txt 
     564 
     565$(DIRTMP)/bibdemo1_dbk5_1.txt : \ 
    562566$(DIRSRC)/data/bibdemo1_dbk5.xml \ 
    563 $(DIRSRC)/superbib01_txt.xsl 
     567$(DIRSRC)/superbib01_txt.xsl \ 
     568$(DIRSRC)/biblioentry_xml.xsl 
    564569        xsltproc --param makedate "'$(MAKEDATE)'" \ 
    565570        --output $@ \ 
     
    567572        $(DIRSRC)/data/bibdemo1_dbk5.xml 
    568573 
    569 $(DIRTMP)/bibdemo1_dbk5.xml : \ 
    570 $(DIRTMP)/bibdemo1_dbk5.txt \ 
     574$(DIRTMP)/bibdemo1_dbk5_1.xml : \ 
     575$(DIRTMP)/bibdemo1_dbk5_1.txt \ 
    571576$(DIRSRC)/bibopa.sh 
    572         $(DIRSRC)/bibopa.sh -p demo1 -i $(DIRTMP)/bibdemo1_dbk5.txt -t raw -l fr 
     577        $(DIRSRC)/bibopa.sh -p demo1 -i $(DIRTMP)/bibdemo1_dbk5_1.txt -t raw -l fr 
     578 
     579test_raw_demo1_2 : \ 
     580$(DIRSRC)/data/bibdemo1_dbk5.xml \ 
     581$(DIRTMP)/bibdemo1_dbk5_2.xml \ 
     582$(DIRTMP)/bibdemo1_dbk5_2.txt 
     583        diff -b $(DIRTMP)/bibdemo1_dbk5_2.xml $(DIRSRC)/data/bibdemo1_dbk5.xml | more 
     584        rm -i $(DIRTMP)/bibdemo1_dbk5_2.xml $(DIRTMP)/bibdemo1_dbk5_2.txt 
     585 
     586$(DIRTMP)/bibdemo1_dbk5_2.txt : \ 
     587$(DIRSRC)/data/bibdemo1_dbk5.xml \ 
     588$(DIRSRC)/superbib02_txt.xsl \ 
     589$(DIRSRC)/biblioentry_xml.xsl 
     590        xsltproc --param makedate "'$(MAKEDATE)'" \ 
     591        --output $@ \ 
     592        $(DIRSRC)/superbib02_txt.xsl \ 
     593        $(DIRSRC)/data/bibdemo1_dbk5.xml 
     594 
     595$(DIRTMP)/bibdemo1_dbk5_2.xml : \ 
     596$(DIRTMP)/bibdemo1_dbk5_2.txt \ 
     597$(DIRSRC)/bibopa.sh 
     598        $(DIRSRC)/bibopa.sh -p demo1 -i $(DIRTMP)/bibdemo1_dbk5_2.txt -t bibtex -l fr 
    573599 
    574600test_raw_nemo1 : \ 
     
    581607$(DIRTMP)/bibnemo1.txt : \ 
    582608$(DIRSRC)/data/bibnemo1.xml \ 
    583 $(DIRSRC)/superbib01_txt.xsl 
     609$(DIRSRC)/superbib01_txt.xsl \ 
     610$(DIRSRC)/biblioentry_xml.xsl 
    584611        xsltproc --param makedate "'$(MAKEDATE)'" \ 
    585612        --output $@ \ 
     
    601628$(DIRTMP)/bibnemoall.txt : \ 
    602629$(DIRSRC)/data/biball.xml \ 
    603 $(DIRSRC)/superbib01_txt.xsl 
     630$(DIRSRC)/superbib01_txt.xsl \ 
     631$(DIRSRC)/biblioentry_xml.xsl 
    604632        xsltproc --param makedate "'$(MAKEDATE)'" \ 
    605633        --output $@ \ 
  • trunk/superbib01_txt.xsl

    r64 r66  
    77<!-- 
    88module : 
    9 transformation docbook en un texte 
     9transformation of a DocBook file into a text file eatable by bibopa.sh  
    1010 
    1111example pour test demo1 
    1212$ xsltproc \-\-param makedate "'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'" \ 
    13   \-\-output /tmp/bibdemo_dbk5.txt \ 
    14   superbib01_txt.xsl data/bibdemo_dbk5.xml 
     13  \-\-output /tmp/bibdemo1_dbk5.txt \ 
     14  superbib01_txt.xsl data/bibdemo1_dbk5.xml 
    1515$ ./bibopa.sh -p demo1 -i /tmp/bibdemo1_dbk5.txt -t raw -l fr 
    16 $ diff biblio.xml data/bibdemo_dbk5.xml 
     16$ diff biblio.xml data/bibdemo1_dbk5.xml 
    1717 
    1818update : 
     
    4040 <xsl:call-template name="one_biblioentry"> 
    4141 <xsl:with-param name="visu_modif" select="'visu'"/> 
     42 <xsl:with-param name="type" select="'raw'"/> 
    4243 <xsl:with-param name="my_biblioentry" select="."/> 
    4344</xsl:call-template> 
  • trunk/superbib01_xml.xsl

    r64 r66  
    231231    <xsl:call-template name="one_biblioentry"> 
    232232     <xsl:with-param name="visu_modif" select="'visu'"/> 
     233     <xsl:with-param name="type" select="'raw'"/> 
    233234     <xsl:with-param name="my_biblioentry" select="."/> 
    234235    </xsl:call-template> 
  • trunk/superbib02_xml.xsl

    r64 r66  
    193193  <xsl:call-template name="one_biblioentry"> 
    194194   <xsl:with-param name="visu_modif" select="'visu'"/> 
     195   <xsl:with-param name="type" select="'raw'"/> 
    195196   <xsl:with-param name="my_biblioentry" select="ancestor::d:biblioentry"/> 
    196197  </xsl:call-template> 
  • trunk/superbibmany01_xml.xsl

    r64 r66  
    179179  <xsl:call-template name="one_biblioentry"> 
    180180   <xsl:with-param name="visu_modif" select="'visu'"/> 
     181   <xsl:with-param name="type" select="'raw'"/> 
    181182   <xsl:with-param name="my_biblioentry" select="ancestor::d:biblioentry"/> 
    182183  </xsl:call-template> 
Note: See TracChangeset for help on using the changeset viewer.