Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : YAZ Functions : yaz_record

yaz_record

Returns a record (PHP 4 >= 4.0.1, PECL yaz:0.9-1.0.9)
string yaz_record ( resource id, int pos, string type )

Example 2676. Array for GRS-1 record

Consider this GRS-1 record:

(4,52)Robert M. Pirsig
(4,70)
     (4,90)
           (2,7)Transworld Publishers, ltd.

This record has two nodes at root level. First element at root level is (4,52) [tag type 4, tag value 52], and has data Robert M. Pirsig. Second element at root level (4,70) has a subtree with a single element (4,90). (4,90) has yet another sub tree (2,7) with data Transworld Publishers, ltd..

If this record is present at position $p, then

<?php

$ar
= yaz_record($id, $p, "array");
print_r($ar);

?>

will output:

Array
(
   [0] => Array
       (
           [0] => (4,52)
           [1] => Robert M. Pirsig
       )
   [1] => Array
       (
           [0] => (4,70)
       )
   [2] => Array
       (
           [0] => (4,70)(4,90)
       )
   [3] => Array
       (
           [0] => (4,70)(4,90)(2,7)
           [1] => Transworld Publishers, ltd.
       )
)

Example 2677. Working with MARCXML

The following PHP snippet returns a MARC21/USMARC record as MARCXML. The original record is returned in marc-8 (unknown to most XML parsers), so we convert it to UTF-8 (which all XML parsers must support).

<?php
$rec
= yaz_record($id, $p, "xml; charset=marc-8,utf-8");
?>

The record $rec can be processed with the Sablotron XSLT processor as follows:

<?php

$xslfile
= 'display.xsl';
$processor = xslt_create();
$parms = array('/_xml' => $rec);
$res = xslt_process($processor, 'arg:/_xml', $xslfile, NULL, $parms);
xslt_free($processor);
$res = preg_replace("'</?html[^>]*>'", '', $res);
echo
$res;

?>

For PHP 5 the XSL extension must be used instead of Sablotron XSLT.


Code Examples / Notes » yaz_record

j dot penez

To obtain iso2709 format (complete format), just set type to "raw"

Change Language


Follow Navioo On Twitter
yaz_addinfo
yaz_ccl_conf
yaz_ccl_parse
yaz_close
yaz_connect
yaz_database
yaz_element
yaz_errno
yaz_error
yaz_es_result
yaz_es
yaz_get_option
yaz_hits
yaz_itemorder
yaz_present
yaz_range
yaz_record
yaz_scan_result
yaz_scan
yaz_schema
yaz_search
yaz_set_option
yaz_sort
yaz_syntax
yaz_wait
eXTReMe Tracker