Archive for the ‘XSLT’ Category


Break my code—I’m going to Atlanta for a week


I’ll be in Atlanta for the next week, looking for a place to live while my wife goes to graduate school.

Meanwhile, my reworked HIP-based catalog, SunCat 2.0, is at a fairly good place for a first look.  Please check it out and tell me what you think; it’s an ambitious project and I know there’s still quite a lot to do.  The comments link at the bottom of each page will send me your browser/referer info, so please use it.

And if you’re in Atlanta and would like to meet while we’re in town, email me!


Make that “…a GREASED pig”.


I’ve managed to wrestle several XSLT stylesheets into — well, not submission exactly, but grudging respect.  I’m starting to make visible structural changes to the HTML components of HIP.

OK, so the SunCat 2.0 development server isn’t nearly as pretty as the mockup, but this time the lipstick, smeared as it may be, is on a real pig and not just a piggy bank.

And, yes, I’m aware that the UN Commission on Eliminating the Torture of Metaphors has been trying to reach me all day.  But I’ve been coding, darn it.  They can wait.


CODI 2006: Shelly Neville’s presentation on Information Portal 8.x


I’m posting this in Atlanta, having forgotten to post earlier. (Uploading 500MB of photos to Flickr takes a while, especially since the Little America hasn’t got an OC-48, and Flock kept losing its connection until about 1:30am. For all the wonders of Web 2.0, I’d have loved to be able to just use ssh, ftp, or even Xmodem-CRC.

There was a question about library-supplied images in combination with Syndetics images; Shelly pointed out that it would be rare to have both kinds of images for the same record, but that you could check boxes on a config screen to modify the layout. I said that you could also use XSLT to display the Syndetics image only if there’s no locally-provided image — just change the stylesheet.

Shelly laughed and said: “Any time a technical person says ‘you can just change the stylesheet’, I worry. I can *spell* XSL and that’s about it.”

You can use location groups to show “local copies”, “other libraries within 20 miles”, “other libraries further away”, etc.; the user would see the first group’s holdings and use a drop-down menu (or a similar control) to choose a different view.

(I hope there’ll be a way to use checkboxes to do something similar — perhaps “just change the stylesheet” to introduce some code that would display each group in a div and then show or hide the divs as the user toggles ‘public libraries’, ‘Pinellas County’, and so on. Heck, there’s an AJAX way to use a slider to say how far away you’re willing to go, but that might not actually be *useful*, just cool.)

Speaking of stylesheets, CSS will be used for layout, so there’s a good chance that the layout could be radically improved without messing around in XSLT.

Language translations will be stored in customer-accessible resource bundles, so we can create a Greek translation, or tweak a Spanish translation to reflect local usage. (Or even make the PAC say ‘your mailing address needs updated’, if that’s how normal people talk in your area.)


A useful modification to SirsiDynix HIP


We have about a dozen autonomous libraries sharing a HIP server and a Horizon datasource.  The standard behavior for Horizon Information Portal is to say “You’re searching: Tampa Bay Library Consortium“, since our datasource is called ‘Tampa Bay Library Consortium’.

But most patrons don’t really know what the Tampa Bay Library Consortium is.  They know that they’re at the Safety Harbor Public Library (or wherever they are).

So the libraries wanted to have their own names on the catalog, rather than ours.  Fair enough.

Here’s a modified template from toolbar2.xsl (HIP 3.0.6A):

<xsl:template name="find_source_label_by_id">
<xsl:param name="source_id"/>
    <xsl:when test="/searchresponse/profile = 'fyb'">
      <xsl:text>Easter Library at Clearwater Christian College</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fybr'">
      <xsl:text>Easter Library at Clearwater Christian College (RESERVES)</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fdl'">
      <xsl:text>Dunedin Public Library</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fsc'">
      <xsl:text>Roux Library at Florida Southern College</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fscr'">
      <xsl:text>Roux Library at Florida Southern College (RESERVES)</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fla'">
      <xsl:text>Largo Public Library</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fyi'">
      <xsl:text>New Port Richey Public Library</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fvu'">
      <xsl:text>Oldsmar Public Library</xsl:text>
    <xsl:when test="/searchresponse/profile = 'sm'">
      <xsl:text>Pinellas Public Library Cooperative</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fyh'">
      <xsl:text>Remington College</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fyhr'">
      <xsl:text>Remington College (RESERVES)</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fyr'">
      <xsl:text>Safety Harbor Public Library</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fyq'">
      <xsl:text>Steelman Media Center at Southeastern University</xsl:text>
    <xsl:when test="/searchresponse/profile = 'fyqr'">
      <xsl:text>Steelman Media Center at Southeastern University (RESERVES)</xsl:text>
    <xsl:when test="/searchresponse/profile = 'ftp'">
      <xsl:text>Tarpon Springs Public Library</xsl:text>
        <xsl:when test="boolean(normalize-space($source_id))">
          <xsl:for-each select="/searchresponse/group/pools/datapool">
            <xsl:if test="$source_id = source/id">
              <xsl:value-of select="source/sourcelabel"/>
          <xsl:value-of select="/searchresponse/group/pools/datapool/source/sourcelabel"/>

No, it’s not elegant, but it seems to work…




With #code4lib's help, I've now got an XSLT stylesheet that lets browsers turn the existing RSS feed into something resembling HTML. This is a big step for all of the work I'm planning to do, since it means I can apply that knowledge to all the rest of the XSLT stuff.

Huzzah! I really need to cacheize the script so I can share the URL with everyone. I've gotten a lot done today and I'm proud of it.

From an email to the stakeholders (hey guys, put those stakes down, I haven't even got my game face on):

Here's what I did today:

http://%5Bserver name deleted]/cgi-bin/

Yes, it looks very much like the old version.

What's noteworthy about this version:

  • It's actually an RSS feed, meaning that you can paste the URL into bloglines or any other RSS aggregator. (But please don't; I need to make the script cache its results or else we'll have loads of SQL queries bogging down Sunline.)
  • It also has an XSLT stylesheet attached, which lets us skin it so that it looks just like any other TBLC page or SunCat page. (Theoretically. But then, this was all theoretical to me last week!)
  • It takes input directly from the web ("location=fyh"), strips it of all potentially dangerous code, and uses that input to affect the presentation ("at Remington College") as well as the results of the SQL query.

I can apply this knowledge to make this much more useful, and allow users to get exactly what they want from SunCat. My to-do list for this script follows. (Some of it is notes to myself.)

  • Cache the result so we don't query Sybase every time an aggregator requests the feed.
  • Cache images and don't display images that don't exist.
  • Find a way to pass the image URL without using the RSS 'description' attribute.
  • Fix the SQL query to remove duplicates.
  • Fix the SQL query to retrieve title, author, etc.
  • Fix the SQL query to limit to the most recent N items.
  • Add the option to turn off images. (Don't do this in, but pass images=yes or images=no to the XSLT stylesheet.)
  • Add the option to see only checked-in items.
  • Add the option to see new items at all libraries (or at some of them? multiple location params?)
  • Add the option to restrict the search to a given author authority or subject authority.

If none of the above makes sense, you can loosely translate it as "Ben has been getting his hack on and has learned a lot that will help us do a lot of impressive stuff."


Technorati tags: , , , , ,