Using XML and XSL to transform and import records

by Jonathan Jacobsen Wednesday, July 29, 2009 6:53 PM

Why enter records into your database when you can have someone else do it for you? Or at least, why not borrow records from other sources and import them into your database? It’s quite easy to do, saving time and improving accuracy. One approach to this is:

  1. Use a service such as Bookwhere, Biblios.net or PubMed to search for records in numerous online databases, for materials such as books, journals, articles, videos, maps ­- anything that might have been catalogued by someone somewhere may be found (see our blog post on Biblios.net).
  2. Save records in MARC XML format (though any XML format can be used).
  3. In Genie (part of the Inmagic Library Suite), use the included Bookwhere XSLT to convert selected MARC tags to Genie fields and import records. (XSLT is short for Extensible Stylesheet Language Transformation, and is a language used to transform XML data into other formats).
  4. In Inmagic DB/Text, customize an XSLT to map MARC XML or any other XML data source to your data structure and import records.
  5. After importing records, you would of course further customize them to suit your database.

If you use Genie, it includes an XSLT (Bookwhere.xsl in the Genie ImporterFiles folder) that maps MARC XML fields into Genie fields. You can customize this XSLT further for your cataloging needs. For example, some MARC tag to Genie field mappings we have added include:

 

MARC Tags Genie Field
090 or 050 CatCallNumber
520 CatAbstract

856 subfield u

CatURL

856 subfield y

CarURLNotes

246, 247, 730, 740, 770, 772, 776, 780, 785, 787

CatAlternateTitle

Leader position 6 or 7

CatRecordType

Here's an example of the above Leader mapping added to the Genie Bookwhere.xsl transformation:

<xsl:template name="RecordType2" match="marc:leader">

<xsl:choose>

<xsl:when test="substring(marc:leader, 8, 1 )='s'">

'CatRecordType' Periodical

</xsl:when>

<xsl:when test="substring(marc:leader, 7, 1 )='a'">

'CatRecordType' Book

</xsl:when>

<xsl:when test="substring(marc:leader, 7, 1 )='g'">

'CatRecordType' Videorecording

</xsl:when>

</xsl:choose>

</xsl:template>

Virtually any XML file can be imported into a textbase using an XSL. The beauty of XSLT is that data cleanup can be done as part of the process. For example, ALL CAPS can be converted to Title case, fields can be separated or joined, dates can be transformed to other formats, and much more.

Burnaby Art Gallery: Collection Management and Art Rental Systems

by Jonathan Jacobsen Thursday, May 21, 2009 5:06 PM

Andornot recently completed two projects for the Burnaby Art Gallery in Burnaby, British Columbia: one for the gallery's main collection and one for their art rental and sales program.

Collection Management System

The gallery's main collection is largely made up of works on paper by Canadian artists. Special consideration is given to the acquisition of multiples (e.g. original prints) and of works distinctly relevant to the citizens of Burnaby.

This collection was previously managed in a legacy database application only available to gallery staff. The gallery consulted with Andornot to replace the legacy system with TextWorks and to make the collection available on the web for public searching. The results of the project can be seen in the searchable database available on the gallery's website.

Notable features of the web portion of the project include:

  • Alphabetical lists of artists included in the collection, for easy browsing.
  • Quick links to artworks by popular artists and on popular topics (created using the Andornot Search Cannery).
  • Thumbnail images of the artworks in the search results when available, with the ability to expand to a full-size image. This feature was enabled with the Andornot Image Handler with the benefit that administrators need only create a single image, and the Image Handler dynamically generates thumbnails as needed.

The desktop portion of the project provides a TextWorks interface for managing artworks, artists and exhibits and includes detailed fields for tracking conservation history.

Art Rental and Sales System

The gallery's popular art rental program provides individuals and organizations with access to contemporary works of art at very reasonable rates. The gallery was previously using two legacy applications to manage the artworks available in the program and the financial aspects of rentals and sales.

With a successful implementation of CS/TextWorks for the gallery's main collection complete, it was a natural extension to investigate using TextWorks for art rental management as well.

Darrin Martens, curator of the gallery, explains: "We wanted to make more use of the Inmagic software we already use to manage our collection and retire two older applications that weren't meeting our needs. The TextWorks databases that Andornot created are terrific and save us a great deal of time each month in managing art rentals."

Andornot's solution supports the management of artworks, artists, and clients, processing of rental and sale transactions, monthly and quarterly billing, and generation of annual client and artist statements. All functions and information related to the art rental program are now available in one set of linked databases, accessible to the staff who need it.

Contact us to learn how you can use TextWorks to manage your gallery's collection or art rental program, or any other information repository.

Genie Label Formatting Tricks

by Jonathan Jacobsen Tuesday, March 17, 2009 1:48 PM

Item Fields Appear After Catalog Fields

When defining a catalog label in MyLabels.config, you can pull data from both the Catalog and Items textbases. Data from Items is wrapped in <ItemInfo> tags

e.g.
<ItemInfo>
  <Field Name="ItemVolume" Header="v." />
  <Field Name="ItemCopyInfo" Header="c." />
</ItemInfo>

While you can place the ItemInfo section anywhere in the label definition, when the label is rendered on screen or printed, the ItemInfo section will always appear last. It's best to place it last in the config file section as well, so it's clear where it will appear on the label.

If you have a strong need to place some Item fields before or in between Catalog fields, it is possible to subdivide one of the boxes on the labels into smaller boxes, one with the Catalog fields and the other with the Item fields. It takes some dedicated work with a ruler and finessing of the label measurements, some trial and error with the printer, and a dose of patience, but it can be done.

Limit Number of Words

If you have a field on the label, such as Title or Subtitle, that tends to have quite a bit of data in it, it may not fit in the available space on the label, and will push other fields down and off the label. One remedy is to limit the amount of data from the field that appears. You can do this by adding this line

UseFunction="NumberOfWords(x)"

to the field (where x is a number).

e.g.
<Field Name="CatTitle" Style="font-weight:bold" UseFunction="NumberOfWords(5)" />

This function is documented in the Inmagic Genie Technical Notes document in relation to the MyReports.config file. However, it works equally well in MyLabels.config.

Turning Carriage Return / Line Feeds into HTML Line Breaks in Inmagic Genie

by Jonathan Jacobsen Wednesday, February 25, 2009 10:36 AM

 

If you have imported information into Genie from another source, using TextWorks or the importer, or typed it in directly in TextWorks, you may have lines of text that are separated only by line feeds, rather than entered as subfields.  They may have appeared to have the correct layout in TextWorks, but when displayed on the web in Genie, may appear to run together.

For example, text that started out like this:

Contents

Chapter 1: Feasibility

Chapter 2: Accountability

Chapter 3: Operational Issues

may appear online as:

ContentsChapter 1: FeasibilityChapter 2: AccountabilityChapter 3: Operational Issues

To have this appear as intended in Genie, you could edit each record individually in the Genie Catalog, but a faster way is to use TextWorks to Batch Replace those line breaks with subfield marks. (You will need to have access to the TextWorks Windows client to do this) .

To do this:

1. In TextWorks, search for all records with data in the field requiring modification, using the * wildcard in that field.

2. Select Records > Batch Modify from the TextWorks menu.

3. Complete the Batch Modify dialogue as follows:

  • Field to Modify: select the field requiring modification
  • Operation: "Substitute Text"
  • Affects: Matching
  • Find What: {LF}
  • Replace With: {SF}

{LF} represents a line feed or paragraph break. {SF} represents a subfield indicator.

4. Perform the batch modification to change all occurrences of the line feed character in the selected field in the selected records to a subfield indicator, then check the results in Genie.

Note: If you are at all in doubt about the batch modification process, backup your complete database before making any changes.

Next, you would edit the MyReports.config configuration file. In this file, find the OPACFull report and the relevant field within that report definition, and add the following line:

Separator="&lt;br/&gt;"

e.g. <Field Name="CatAbstract" Separator="&lt;br/&gt;"/>

This causes every subfield to be separated with the <br/> tag. Repeat for the CatalogFull report and any other reports in which this field appears.

Another option in Genie is to edit the MyReports.config file to wrap the field in <pre> tags, which causes the text to display exactly as entered, without the use of subfields. The disadvantage of this approach is that the text will appear in a fixed-width font and long lines will not wrap. If you wish to try this, edit the field definition as described above, in MyReports.config, to add

Header="&lt;pre&gt;"and Footer="&lt;/pre&gt;"

e.g. <Field Name="CatAbstract" Header="&lt;pre&gt;" Footer="&lt;/pre&gt;"/>

and see if you like this look in Genie.

 

All About Favicons

by Jonathan Jacobsen Wednesday, January 28, 2009 9:47 AM

Y'know those small images that appear in your web browser's address bar as you move from site to site? Or that appear in your list of favourites or bookmarks next to each site?

 favicons3

Those are Favicons, short for Favourites Icons. They are a great way to help users see at a glance what site is open in their browser, especially if they have several tabs open at once.

How do I create one?

A favicon is simply a 16 x 16 pixel square image.

Typically the icon is a representation of your organization's logo or letters of its name or colour scheme. The image below shows some examples open in separate tabs in the Firefox browser.

favicons4

You can create one from scratch using your favourite image editing program (or asking your graphic designer for a favour), or you can use one of several online tools to create one for you.

These two tools generate icons from images you upload:

http://www.favicongenerator.com/

http://www.html-kit.com/favicon/

The following tool generates an icon from text you type (great for organizations without a logo, or one that doesn't reproduce well in the small size of an icon):

http://antifavicon.com/

The image can be in any format supported that a web browser can display, such as GIF, PNG and JPEG.

How do I add one to my website?

Once you have an icon image, save it to a location on your web server. Traditionally the file was named "favicon.ico" and saved in the root folder. However, the latest browsers support alternate locations and file names.

If you choose to name your file favicon.ico, note that the image format may still be a PNG, GIF, JPEG, etc.; it's only the extension that is changed to ".ico".

To include the icon in your website, edit the pages to add one of the following lines to the <head> section:

Either

<link rel="shortcut icon" href="favicon.ico" >

or

<link rel="icon" type="image/png" href="/path/favicon.png"/>

where type is the image type (e.g. png, jpg, gif, etc.) and href points to the image location on your web server.

Note that the first link tag example does not conform to W3C recommendations, so the second example is preferred.

How do I add one to my Inmagic WebPublisher PRO pages?

If you have used the Andornot Starter Kit to publish your textbase online, you may be able to simply edit the file "\layout\include\HeadTag.htm" to add the above line to the <head> section of most pages served by WebPublisher PRO. You may also need to edit your search pages. It all depends on how your site is configured.

Tags:

Month List