« UK holdings | Main | XML and CSS »


Ed Summers

Neato, this could come in very handy. I'm kind of an XSLT novice so I had never seen JavaScript being referenced in an external file before. Does this require the user run the transformation in a browser, or are there XSLT libs that bundle JavaScript support. I was curious, so I went digging around for js/viaf.js to see what functions in the XSLT it was using but I couldn't seem to find it.

Andrew Houghton

Here is the information on LC's Web site for handling dates in MARC records that contain 2 digit years.

Here is the XSL I use for creating a variable based upon the 008's date created:

<xsl:variable name="date.created">
    select="marc:controlfield[@tag = '008'][1]">
    <!-- Break apart date created value -->
    <xsl:variable name="year">
        One of these days LC will fix the date to be
        Y2K compliant...
        See: http://www.loc.gov/marc/yr2000.html
        <!-- Post Y2K date -->
          test="number(substring(.,1,2)) &gt;= 0 and
                number(substring(.,1,2)) &lt; 68">
        <!-- Pre Y2K date -->
    <xsl:variable name="month"
    <xsl:variable name="day"
    <!-- Build date created from pieces -->

Including viaf.js was an oversight--the authorities full display doesn't use it at all. It got cut & pasted from the main XSLT script that controls the interface.

All the Javascript calls in the interface are from the generated HTML to the JavaScript (which may then modify the HTML). It's possible to control XSLT from the JavaScript in some browsers, but I haven't tried it.

Thanks for the pointer and code Andy, I'll update the script.


The comments to this entry are closed.

My Photo

April 2018

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30