OSBib-Format

XML structure ~ Bibliography

A collection of PHP classes to manage bibliographic formatting for OS bibliography software using the OSBib standard. Taken from and originally developed in WIKINDX (http://wikindx.sourceforge.net).

Released through http://bibliophile.sourceforge.net under the GPL licence.

If you make improvements, please consider contacting the administrators at bibliophile.sourceforge.net so that your improvements can be added to the release package.

May 2005
Mark Grimshaw (WIKINDX)
Andrea Rossato (Uniwakka)
Guillaume Gardey (BibOrb)
Christian Boulanger (Bibliograph)


INTRODUCTION
STRUCTURE


INTRODUCTION

Use BIBFORMAT::loadStyle() to load and parse the XML file into usable arrays. The XML file is logically divided into four areas, info (general information about the formatting style), citation (see citation_xml), styleCommon (common styling for bibliographic lists) and styleTypes (specific formatting depending on the type of resource).

The info array as returned by BIBFORMAT::loadStyle() will look something like:
Array ( [name] => APA [description] => American Psychological Association (APA) [language] => English [version] => 1.0 )

The styleCommon array, as returned by BIBFORMAT::loadStyle() and after being further parsed by BIBFORMAT::getStyle() will look something like:
Array ( [titleCapitalization] => 0 [primaryCreatorFirstStyle] => 1 [primaryCreatorOtherStyle] => 1 [primaryCreatorInitials] => 0 [primaryCreatorFirstName] => 1 [otherCreatorFirstStyle] => 0 [otherCreatorOtherStyle] => 0 [otherCreatorInitials] => 0 [dayFormat] => 0 [otherCreatorFirstName] => 1 [primaryCreatorList] => 1 [otherCreatorList] => 0 [monthFormat] => 1 [editionFormat] => 1 [primaryCreatorListMore] => 7 [primaryCreatorListLimit] => 6 [dateFormat] => 1 [primaryCreatorListAbbreviation] => , et al. [otherCreatorListMore] => [runningTimeFormat] => 1 [primaryCreatorRepeatString] => [primaryCreatorRepeat] => 0 [otherCreatorListLimit] => [otherCreatorListAbbreviation] => [pageFormat] => 2 [editorSwitch] => 1 [editorSwitchIfYes] => editor (^Ed.^Eds.^). [primaryCreatorSepFirstBetween] => , [primaryCreatorSepNextBetween] => , [primaryCreatorSepNextLast] => , & [otherCreatorSepFirstBetween] => , [otherCreatorSepNextBetween] => & [otherCreatorSepNextLast] => & [primaryTwoCreatorsSep] => , & [otherTwoCreatorsSep] => & )

Not all elements need be present so you should always test with PHP's array_key_exists() function.

Because OSBib uses numeric indexing from 0 upwards, you should be careful to use something like:
if($styleCommon['primaryCreatorListAbbreviation'] === FALSE)
...

to test for a FALSE value of an array element.

The styleTypes array for a book (each type of resource has its own definition array), as returned by BIBFORMAT::loadStyle() and after being further parsed by BIBFORMAT::getStyle() will look something like (array elements will depend on the type's template definition):
Array ( [author] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [post] => . ) [publicationYear] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => ( [post] => ). ) [title] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [i] [post] => [/i] ) [translator] => Array ( [dependentPre] => [dependentPost] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [post] => , Trans.__DEPENDENT_ON_NEXT_FIELD__ ) [edition] => Array ( [dependentPre] => [dependentPost] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [post] => ed.__DEPENDENT_ON_NEXT_FIELD__ ) [volumeNumber] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => Vol. [post] => ) [publisherLocation] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => . [post] => : ) [publisherName] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => __DEPENDENT_ON_PREVIOUS_FIELD__ [post] => ) [ultimate] => . [independent] => Array ( [3] => ( [5] => ) ) )


STRUCTURE

The description here relates to the various elements of the styleCommon array. Each element will have either an INTEGER value or a STRING value.

Creator formatting:

Primary creators:
Primary creators are usually the author(s) of a resource but, depending on the type of resource, may be composers, inventors etc. etc. etc.

INTEGER primaryCreatorFirstStyle Ordering and display of the name elements for the first of the primary creators.
INTEGER primaryCreatorOtherStyle Ordering and display of the name elements for the remaining primary creators.

	 0	=>	'Joe Bloggs'
	 1	=>	'Bloggs, Joe'
	 2	=>	'Bloggs Joe'
	 3	=>	Last name only

INTEGER primaryCreatorInitials Formatting of initials for the primary creators.

	 0	=>	'T. U. '
	 1	=>	'T.U.'
	 2	=>	'T U '
	 3	=>	'TU'

INTEGER primaryCreatorFirstName Formatting of first name for the primary creators.

	 0	=>	Print the full first name(s)
	 1	=>	Print initial(s) only

STRING primaryCreatorUpperCase Uppercase/lowercase primary creator names. The value will be 'on' for yes otherwise the array element does not exist.

STRING primaryTwoCreatorsSep Separator in the case of just two primary creators.

STRING primaryCreatorSepFirstBetween Separator between the first two primary creators in the case where there are more than two.

STRING primaryCreatorSepNextBetween Separator between the following primary creators after the first two in the case where there are more than two.

STRING primaryCreatorSepNextLast Separator between the last two primary creators in the case where there are more than two.

INTEGER primaryCreatorList Abbreviations for multiple primary creators.

	 0	=>	Print the full creator list
	 1	=>	Limit the creator list

INTEGER primaryCreatorListMore If more than this number of primary creators, format as per the limit defined here. Requires primaryCreatorList to be '1'.

INTEGER primaryCreatorListLimit Print only this number of primary creators if limit is exceeded as defined here. Requires primaryCreatorList to be '1'.

STRING primaryCreatorListAbbreviation If limit is exceeded as defined here, replace remaining primary creators with this string. Requires primaryCreatorList to be '1'.

STRING primaryCreatorListAbbreviationItalic Italicize primaryCreatorListAbbreviation. Requires primaryCreatorList to be '1'. The value will be 'on' for yes otherwise the array element does not exist.

INTEGER primaryCreatorRepeat Consecutive citations in the bibliographic list by the same primary creator(s).

	 0	=>	Print the creator list
	 1	=>	Do not print the creator list
	 2	=>	Replace the creator list with string below

STRING primaryCreatorRepeatString String to replace primary creator(s) with if '2' is chosen for primaryCreatorRepeat above.

Other creators:
Other creators include editors, translators, agents, attorneys etc. etc. etc. The usage is as explained above.

INTEGER otherCreatorFirstStyle Ordering and display of the name elements for the first of the other creators (editors, translators etc.).
INTEGER otherCreatorOtherStyle Ordering and display of the name elements for the remaining other creators.
INTEGER otherCreatorInitials
Formatting of initials for the other creators.
INTEGER otherCreatorFirstName Formatting of first name for the other creators.
STRING otherCreatorUpperCase Uppercase/lowercase other creator names.
STRING otherTwoCreatorsSep Separator in the case of just two other creators.
STRING otherCreatorSepFirstBetween Separator between the first two other creators in the case where there are more than two.
STRING otherCreatorSepNextBetween Separator between the following other creators after the first two in the case where there are more than two.
STRING otherCreatorSepNextLast Separator between the last two other creators in the case where there are more than two.
INTEGER otherCreatorList Abbreviations for multiple other creators.
INTEGER otherCreatorListMore If more than this number of other creators, format as per the limit defined here. Requires otherCreatorList to be '1'.
INTEGER otherCreatorListLimit Print only this number of other creators if limit is exceeded as defined here. Requires otherCreatorList to be '1'.
STRING otherCreatorListAbbreviation If limit is exceeded as defined here, replace remaining other creators with this string. Requires otherCreatorList to be '1'.
STRING otherCreatorListAbbreviationItalic Italicize otherCreatorListAbbreviation. Requires otherCreatorList to be '1'.


Miscellaneous formatting:

Editor switch:
If a resource, such as a book, has an editor(s) but no author(s), then some bibliographic styles require that the editor(s) take the usual place of the author(s) when printing the bibliographic list.

INTEGER editorSwitch Consecutive citations in the bibliographic list by the same primary creator(s).

	 0	=>	No switch
	 1	=>	Switch

STRING editorSwitchIfYes If '1' is chosen for editorSwitch above, this is the template definition string such as editor (^Ed.^Eds.^) that the primary creator definition string in each resource type's template definition is replaced with.

Title capitalization:
INTEGER titleCapitalization

	 0	=>	Title as entered/stored in the database
	 1	=>	Only first character of first word capitalised

Note that BIBFORMAT::formatTitle() allows characters to be protected from case changes.

Edition:
INTEGER editionFormat

	 0	=>	'3'
	 1	=>	'3rd'

Page number:
INTEGER pageFormat

	 0	=>	'132-9'
	 1	=>	'132-39'
	 2	=>	'132-139'

Day:
INTEGER dayFormat

	 0	=>	'10'
	 1	=>	'10th'

Month:
INTEGER monthFormat

	 0	=>	'Feb'
	 1	=>	'February'
	 2	=>	"User-defined"
If '2', the styleCommon array will have 12 string elements for each month: userMonth_1 .. userMonth_12

Date:
INTEGER dateFormat

	 0	=>	Day followed by Month
	 1	=>	Month followed by Day

Running time:
INTEGER runningTimeFormat

	 0	=>	'3'45"'
	 1	=>	'3:45'
	 2	=>	'3,45'
	 3	=>	'3 hours, 45 minutes'
	 4	=>	'3 hours and 45 minutes'

Date ranges:
STRING dateRangeDelimit1 Separator between start and end dates if day and month given.
STRING dateRangeDelimit2 Separator between start and end dates if month only given.
INTEGER dateRangeSameMonth If start and end months are the same.

	 0	=>	"Print both months",
	 1	=>	"Print start month only",