API:EPrints/XSLT

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


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::XSLT - utilities for XSLT processing


SYNOPSIS

my $xslt = EPrints::XSLT->new(
	repository => $repository,
	stylesheet => $stylesheet,
);

my $result = $xslt->transform( $doc );
print $xslt->output_as_bytes( $result );

Using ept functions:

<xsl:value-of select="ept:value('title')" />
<xsl:copy-of select="ept:render_value('title')" />


DESCRIPTION

Because XSLT requires very careful treatment this module should probably be only used by internal code.

For the correct context to be set for 'ept:' functions this module must be used for every transform.


METHODS

new

$xslt = EPrints::XSLT->new( repository => $repo, ... )

Options:

  repository
  stylesheet
  dataobj
  dataobjs
  opts
  error_cb


transform

$result = $xslt->transform( $doc [, @parameters ] )

Transforms $doc with the given stylesheet. @parameters is an optional list of key-value pairs to pass to the stylesheet.


output_as_bytes

$bytes = $xslt->output_as_bytes( $result )

See XML::LibXSLT/output_as_bytes.


EPT FUNCTIONS

  • ept:citation( [ STYLE [, OPTIONS ] ] )
Returns the citation of style STYLE (or "default") for the current item.
  • ept:config( KEY1 [, KEY2 [, ... ] ] )
Returns the repository configuration value.
  • ept:documents()
Returns a list of the current item's documents (errors if current item is not an eprint).
  • ept:icon( [ OPTIONS ] )
Returns a link to a document with icon.
Options:
  HoverPreview
  noHoverPreview
  NewWindow
  noNewWindow
  • ept:one_of( NEEDLE [, HAYSTACK ] )
Returns true if NEEDLE is in HAYSTACK based on string equality.
  • ept:param( KEY )
Returns the value of the parameter KEY e.g. in plugin arguments.
  • ept:phrase( PHRASEID )
Returns the HTML phrase for PHRASEID.
  • ept:render_value( FIELDID [, OPTIONS ] )
Returns the rendered value of FIELDID for the current item.
  • ept:url( [ STAFF ] )
Returns the URL of the current item (or control page if STAFF is true).
  • ept:value( FIELDID )
Returns the value of FIELDID for the current item.


COPYRIGHT

Copyright 2000-2011 University of Southampton.

This file is part of EPrints http://www.eprints.org/.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.