XPAGE Format

From EPrints Documentation
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


XML Configuration: EPScript - Control Format (EPC) - Citation - Workflow - Phrase - Template - XPAGE (static pages)

See API:EPrints/Apache/Template#Static_HTML_Pages for a list of the pins you can use in an xpage

Stored in the static folder, xpage files are portions of HTML that are rendered into static files when generate_static is run. Three tags are in the xpage namespace: xpage:page, xpage:title, and xpage:body.

The beginning of index.xpage (which generates the site's index page) is as follows - the three tags are analogous to the html, title, and body tags of an HTML document, except the body is included within the site's template. It is recommended to use xhtml as the default namespace to ease writing. As with templates, EPrints Control Format tags may be used.

 <?xml version="1.0" encoding="iso-8859-1" standalone="no"  ?>
 <!DOCTYPE page SYSTEM "entities.dtd" >
 <xpage:page xmlns="http://www.w3.org/1999/xhtml" xmlns:xpage="http://eprints.org/ep3/xpage" xmlns:epc="http://eprints.org/ep3/control">
   <xpage:title>Welcome to <epc:phrase ref="archive_name" /></xpage:title>
   <xpage:body>Some example body text.</xpage:body>
 </xpage:page>

When generate_statics is run, four static files are created for each xpage file. For index.xpage, these would be index.html (the HTML page), index.page (the contents of the xpage:body tag), index.title (the contents of the xpage:title tag), and index.title.textonly (the contents of the xpage:title with HTML tags stripped out). Note that these files are generated by generate_static, and shouldn't be edited by hand.

2013-10-21 NOTE: Some versions of EPrints (3.3.10 and lower?) don't process phrases with pins in them properly from xpages. Whitespace in the phrase tag breaks the processor, resulting in a '[error in script]' message in the page, and something like ' EPScript error: Can't locate object method "tagName" via package "XML::LibXML::Text" at /usr/share/eprints/perl_lib/EPrints/XML/EPC.pm line 204' in the apache error logs. This can be fixed by removing the whitespace:

<!-- BROKEN -->
        <epc:phrase ref="lib/searchexpression:results_for">
            <epc:param name='title'>Test</epc:param>
        </epc:phrase>
<!-- OK -->
        <epc:phrase ref="lib/searchexpression:results_for"><epc:param name='title'>Test</epc:param></epc:phrase>

or possibly patching ~/perl_lib/EPrints/XML/EPC.pm with https://github.com/eprints/eprints/commit/10fc4e67fac54dc87c6968ac3be79c4cb121efcf