sub new {
my $class = shift;
- my $self = $class->SUPER::build('<mods:modsCollection version="3.0" xmlns:mods="http://www.loc.gov/mods/"/>');
+ my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/" xmlns:mods="http://www.loc.gov/mods/"/>');
$self->{type} = 'application/xml';
$self->{item_xpath} = '/mods:modsCollection';
return $self;
if ($type eq 'unapi' || $type eq 'opac') {
$self->_create_node(
'mods:mods',
- 'http://www.loc.gov/mods/',
- 'mods:relatedItem',
+ undef,
+ 'relatedItem',
undef,
{ type => 'otherFormat', id => 'link-'.$linkid }
);
$self->_create_node(
- "mods:mods/mods:relatedItem[\@id='link-$linkid']",
- 'http://www.loc.gov/mods/',
- 'mods:recordIdentifier',
+ "mods:mods/relatedItem[\@id='link-$linkid']",
+ undef,
+ 'recordIdentifier',
$id
);
$linkid++;
sub new {
my $class = shift;
- my $self = $class->SUPER::build('<mods:modsCollection version="3.0" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+ my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
$self->{type} = 'application/xml';
$self->{item_xpath} = '/mods:modsCollection';
return $self;
if ($type eq 'unapi' || $type eq 'opac') {
$self->_create_node(
'mods:mods',
- 'http://www.loc.gov/mods/v3',
- 'mods:relatedItem',
+ undef,
+ 'relatedItem',
undef,
{ type => 'otherFormat', id => 'link-'.$linkid }
);
$self->_create_node(
- "mods:mods/mods:relatedItem[\@id='link-$linkid']",
- 'http://www.loc.gov/mods/v3',
- 'mods:recordIdentifier',
+ "mods:mods/relatedItem[\@id='link-$linkid']",
+ undef,
+ 'recordIdentifier',
$id
);
$linkid++;
sub new {
my $class = shift;
- my $self = $class->SUPER::build('<mods:modsCollection version="3.2" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+ my $self = $class->SUPER::build('<modsCollection version="3.2" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
$self->{type} = 'application/xml';
$self->{item_xpath} = '/mods:modsCollection';
return $self;
sub new {
my $class = shift;
- my $self = $class->SUPER::build('<mods:modsCollection version="3.3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+ my $self = $class->SUPER::build('<modsCollection version="3.3" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
$self->{type} = 'application/xml';
$self->{item_xpath} = '/mods:modsCollection';
return $self;
sub new {
my $class = shift;
- my $self = $class->SUPER::build('<marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim"/>');
+ my $self = $class->SUPER::build('<collection xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim"/>');
$self->{type} = 'application/xml';
$self->{item_xpath} = '/marc:collection';
return $self;
if(!dojo._hasResource["openils.BibTemplate"]) {
dojo.require('DojoSRF');
- dojo.require('dojox.data.dom');
+ dojo.require('dojox.xml.parser');
dojo.require('dojo.string');
dojo._hasResource["openils.BibTemplate"] = true;
dojo.provide("openils.BibTemplate");
return new_nl;
},
+ textContent : function (node) {
+ var content = '';
+ if (node) {
+ if(window.ActiveXObject) content = node.text;
+ else content = node.textContent;
+ }
+ return content;
+ },
+
render : function() {
var all_slots = dojo.query('*[type^=opac/slot-data]', this.root);
var templated = slot.getAttribute('templated') == 'true';
if (debug) alert('BibTemplate debug -- slot ' + (templated ? 'is' : 'is not') + ' templated');
if (templated) {
+ if (debug) alert('BibTemplate debug -- slot template innerHTML:\n' + slot.innerHTML);
var template_values = {};
dojo.query(
'*[type=opac/template-value]',
slot
).orphan().forEach(function(x) {
- dojo.setObject(
- x.getAttribute('name'),
- (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(x.innerHTML) ))(item_list,BT,bib,slot),
- template_values
- );
+ var name = x.getAttribute('name');
+ var value = (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(x.innerHTML) ))(item_list,BT,bib,slot);
+ if (name && (value || value == '')) template_values[name] = value;
});
-
+
+ if (debug) alert('BibTemplate debug -- template values:\n' + dojo.toJson( template_values ));
slot.innerHTML = dojo.string.substitute( unescape(slot.innerHTML), template_values );
}
var handler_node = dojo.query( '*[type=opac/slot-format]', slot )[0];
- if (handler_node) slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item', dojox.data.dom.textContent(handler_node) || handler_node.innerHTML);
- else slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item','return dojox.data.dom.textContent(item) || item.innerHTML;');
+ if (handler_node) slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item', dojox.xml.parser.textContent(handler_node) || handler_node.innerHTML);
+ else slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item','return dojox.xml.parser.textContent(item) || item.innerHTML;');
if (item_list.length) {
var content = dojo.map(item_list, dojo.partial(slot_handler,item_list,BT,bib,slot)).join(joiner);