Customizing HIP 2.x/3.x Advanced XSLT Stylesheet Editing PowerPoint PPT Presentation

presentation player overlay
1 / 38
About This Presentation
Transcript and Presenter's Notes

Title: Customizing HIP 2.x/3.x Advanced XSLT Stylesheet Editing


1
Customizing HIP 2.x/3.xAdvanced XSLT Stylesheet
Editing
  • Phil Feilmeyer
  • Hennepin County (MN) Library

2
Customizing at Hennepin County Library
  • HIP 3.08 running on Windows 2003
  • Horizon 7.34
  • HCL is a single library with 26 branches
  • Each branch has a HIP profile, but they are
    essentially identical
  • Decision-making aspects of customization are
    centralized
  • Only one strings.xsl, other.xsl, onoff.xsl
  • Experience with HTML and ColdFusion
  • ColdFusion is a web application platform that
    uses templates and a tag-based programming
    language

3
Customizing at Hennepin County Library
  • Resources available for customization effort
  • Development server
  • Staff with experience in web application
    development
  • Started with cosmetic changes
  • Reduction of white space
  • Removal of extraneous information
  • Color conformity with the library's web pages

4
Customizing at Hennepin County Library
  • Breakthrough moment realizing there are two
    parts to every HIP page
  • Functional elements
  • links, form tags, input boxes, submit buttons,
    JavaScript
  • Display elements
  • As long as the functional elements are left
    intact, you can do as you like with the display
    elements
  • First major customization toolbar2.xsl

5
Header Example (toolbar2.xsl)
6
Viewing XML Data
  • To see the XML behind most HIP pages, add
    GetXMLtrue to the URL
  • Case sensitive
  • Remove "focus" from the end of the URL first
  • Example
  • http//catalog.hclib.org/ipac20/ipac.jsp?profiler
    dfocus
  • http//catalog.hclib.org/ipac20/ipac.jsp?profiler
    dGetXMLtrue
  • You are re-submitting the HIP request, so you may
    be re-renewing or re-reserving a title
  • Occasionally it doesn't work
  • address bar only contains base URL

7
Viewing XML Data
8
XML Path Language (XPath)
  • Syntax for referencing elements of an XML
    document
  • lt?xml version"1.0" encoding"UTF-8"
    standalone"yes" ?gt
  • ltsearchresponsegt
  • ltversiongt3.08lt/versiongt
  • ltsessiongt11Q97W731J891.12065lt/sessiongt
  • ltprofilegtelibrarylt/profilegt
  • ltexpirepagegt300lt/expirepagegt
  • ...
  • lt/searchresponsegt
  • XPath reference to the user's profile
  • /searchresponse/profile

9
XML Path Language (XPath)
  • Absolute path starts with a 'slash'
  • /patronpersonalresponse/patroninfo/name/full
  • Use double-slash to left truncate
  • //profile
  • //session
  • Include position in brackets for 'multivalue
    fields'
  • //searchresults/results/row3/TITLE/data/text
  • No initial 'slash' for a relative path
  • TITLE/data/text
  • Context can be provided by a ltxslfor-eachgt tag
  • ltxslfor-each select"//searchresults/results/row"
    gt
  • ... ltxslvalue-of select"TITLE/data/text"/gt
    ...
  • lt/xslfor-eachgt

10
Benefits of looking at the XML
  • Patron personal data is part of the XML on every
    HIP page after login
  • ltsearchresponsegt
  • ...
  • ltsecuritygt
  • ltauthgttruelt/authgt
  • ltnamegtFEILMEYER, PHILIP Alt/namegt
  • ltpatronidgt831256lt/patronidgt
  • ltaddressgt12601 RIDGEDALE DR, MINNETONKA, MN
    55305lt/addressgt
  • ltemailaddressgtpfeilmeyer_at_hclib.orglt/emailaddre
    ssgt
  • ltphonegt952-847-8768lt/phonegt
  • lt/securitygt
  • ...
  • lt/searchresponsegt
  • The email address in XPath /searchresponse/securi
    ty/emailaddress
  • //security/emailaddress

11
Benefits of looking at the XML
  • Custom XSLT to automatically include the patron's
    email address in the input box whenever an email
    option appears
  • ltinputgt
  • ltxslattribute name"class"gt
  • ltxslvalue-of select"css_text_input_box"/gt
  • lt/xslattributegt
  • ltxslattribute name"type"gttextlt/xslattributegt
  • ltxslattribute name"size"gt40lt/xslattributegt
  • ltxslattribute name"name"gtemailaddresslt/xslatt
    ributegt
  • ltxslattribute name"maxlength"gt100lt/xslattribu
    tegt
  • ltxslif test"string-length(//security/emailaddr
    ess) gt 0"gt
  • ltxslattribute name"value"gt
  • ltxslvalue-of select"//security/emailaddres
    s"/gt
  • lt/xslattributegt
  • lt/xslifgt
  • lt/inputgt

12
Benefits of looking at the XML
  • lttrgt
  • lttdgtPickup Location ltxslvalue-of
    select"pickup_location"/gtlt/tdgt
  • lt/trgt

ltxslif test"not(boolean(//security/emailaddress)
)"gt lttrgtlttdgt ltimggt ltxslattribute
name"src"gt/images/email.giflt/xslattributegt
lt/imggt lt/tdgtlt/trgt ... lt/xslifgt
13
Benefits of looking at the XML
14
Editing example
  • Make something conditional based on profile
  • ltxslif test"not(//profile 'elibrary')"gt
  • lttrgt
  • lttdgt
  • To protect your personal information, close
    this
  • browser window before you leave the
    workstation.
  • lt/tdgt
  • lt/trgt
  • lt/xslifgt

15
Another editing example
  • Make something conditional based on profile
  • ltxslchoosegt
  • ltxslwhen test"//profile 'elibrary'"gt
  • call your local library
  • lt/xslwhengt
  • ltxslotherwisegt
  • ask for assistance at the info desk
  • lt/xslotherwisegt
  • lt/xslchoosegt

16
Adding Customized Data Elementsusing the HIP
Admin Tool
  • OCLC for staff (but not the public) in the Bib
    Display
  • Add new element to Full Bib Display using the
    Admin Tool

17
Adding Customized Data Elementsusing the HIP
Admin Tool
  • Check the XML to find out how the data is
    structured
  • ltsearchresponsegt
  • ltfullnonmarcgt
  • ltsearchresultsgt ltresultsgt
  • ltheadergt ltrowgt
  • ltcolgt ltcellgt
  • ltlabelgtISBNlt/labelgt
    lttextgt0375422889lt/textgt
  • lt/colgt lt/cellgt
  • ltcolgt ltcellgt
  • ltlabelgtContentslt/labelgt lttextgtlt/textgt
  • lt/colgt lt/cellgt
  • ltcolgt ltcellgt
  • ltlabelgtSummarylt/labelgt lttextgtContinues
    the author's ...lt/textgt
  • lt/colgt lt/cellgt
  • ltcolgt ltcellgt
  • ltlabelgtOCLClt/labelgt
    lttextgtocm54005645lt/textgt
  • lt/colgt lt/cellgt
  • lt/headergt lt/rowgt
  • lt/resultsgt

18
Adding Customized Data Elementsusing the HIP
Admin Tool
  • The original fullnonmarcbib.xsl stylesheet simply
    creates a row for each of the additional data
    elements
  • lt! build nonfixed element display fields --gt
  • ltxslfor-each select"//searchresults/results/row/
    cell"gt
  • ltxslvariable name"pos"gt
  • ltxslvalue-of select"position()"/gt
  • lt/xslvariablegt
  • ltxslchoosegt
  • ltxslwhen test"boolean(normalize-space(text))
    "gt
  • create a table row with label and data
  • lt/xslwhengt
  • ltxslotherwisegt
  • don't do anything
  • lt/xslotherwisegt
  • lt/xslchoosegt
  • lt/xslfor-eachgt

19
Adding Customized Data Elementsusing the HIP
Admin Tool
  • Identify the position of the label of your new
    element using ltxslvariablegt at the upper-most
    level in the template
  • ltxslvariable name"oclc_pos"gt
  • ltxslfor-each select"//searchresults/header/col
    "gt
  • ltxslif test"label 'OCLC'"gt
  • ltxslvalue-of select"position()"/gt
  • lt/xslifgt
  • lt/xslfor-eachgt
  • lt/xslvariablegt

20
Adding Customized Data Elementsusing the HIP
Admin Tool
  • Insert your custom code in the appropriate spot
  • lt!-- fixed elements XSLT ends here --gt
  • ltxslif test"boolean(//searchresults/results/row/
    celloclc_pos/text)"gt
  • lttrgt
  • lttdgt
  • ltxslvalue-of select"//searchresults/header/col
    oclc_pos/label"/gt
  • lt/tdgt
  • lttdgt
  • ltxslvalue-of select"//searchresults/results/ro
    w/celloclc_pos/text"/gt
  • lt/tdgt
  • lt/xslifgt
  • lt!-- nonfixed elements XSLT starts here --gt

21
Adding Customized Data Elementsusing the HIP
Admin Tool
  • Modify the original stylesheet to exempt this
    data from the generic display
  • lt! build nonfixed element display fields --gt
  • ltxslfor-each select"//searchresults/results/row/
    cell"gt
  • ltxslvariable name"pos"gt
  • ltxslvalue-of select"position()"/gt
  • lt/xslvariablegt
  • ltxslchoosegt
  • ltxslwhen test"boolean(normalize-space(text))
    and (pos ! oclc_pos)"gt
  • create a table row with label and data
  • lt/xslwhengt
  • ltxslotherwisegt
  • don't do anything
  • lt/xslotherwisegt
  • lt/xslchoosegt
  • lt/xslfor-eachgt

22
Data not available from the XML
23
Data not available from the XML
Borrower ID, but no barcode number in the XML
24
Data not available from the XML
  • getURL( ) - Custom java function in the XSL
    Processor that pulls in content from a web page
  • written by Casey Durfee (formerly of Seattle
    Public Library)
  • http//extranet.spl.org/rss-0.5.zip
  • Instructions getURL.txt
  • Code Utils.jar (in the optional folder)
  • Create a custom web application to deliver the
    desired information
  • we use Perl CGI and ColdFusion

25
Data not available from the XML
  • http//arthur.hclib.org/perl/xsl_getBorrowerBarcod
    e?borrowerID831256
  • Takes the borrower ID number from the http
    request
  • Queries the Horizon database to find out the
    borrower barcode
  • select bbarcode from borrower_search_cf_view
    where borrower 831256
  • Returns the borrower barcode

26
Data not available from the XML
  • toolbar2.xsl
  • lttdgt
  • ltxslvalue-of select"//security/name"/gt
  • ltxslif test"isStaffProfile 'true'"gt
  • ltxslvariable name"url"gt
  • http//arthur/perl/xsl_getBorrowerBarcode?bo
    rrowerID
  • ltxslvalue-of select"//security/patronid"/gt
  • lt/xslvariablegt
  • ltbr/gt
  • ltxslvalue-of select"UtilsgetURL(url)"/gt
  • lt/xslifgt
  • lt/tdgt

27
Data not available from the XML
  • Taken to extremes...
  • xsl_getSummaryViewData?bibID3092569locrd

numRequests0 checkedInsomewheres refRentall24
ref0bsx0onorder0onorder_avail0 reqData22
22 ldr06a ldr07m desc00 desc01 desc04 fixed2
1 fixed23 fixed290 URL excerptURL niceTitle
Sleepover Larry
numRequests0checkedInsomewheresrefRentall 2
4ref0bsx0onorder0onorder_avail0reqData2
222ldr06aldr07mdesc00desc01desc04 fixe
d21 fixed23 fixed290URLexcerptURL niceTi
tleSleepover Larry
28
HIP Architecture Anatomy of a HIP Request
User's Browser
Horizon Application Server
XSL Processor
Web Apps
Syndetics
Horizon
HIP Admin DB
29
Advanced Customizing - Other Possibilities
  • Add javascript to a page
  • "Validate" email address submission
  • Confirmation dialog box when canceling requests
  • Connect dynamically to another web application
  • Due date calendar
  • Show location of available copies
  • Update borrower information

30
Managing Customized Stylesheets -the Hennepin
Method
  • Make a backup copy of the original
    xsltransformer.xml file for the current version
  • I called ours xsltransformer_306a_original.xml
  • Identify stylesheets that have been customized
    using unique filenames
  • Whenever a customization is made to a stylesheet
    (no matter how small), give the edited file a new
    name and leave the unedited, original version in
    the XSL folder
  • generalfooter.xsl becomes hcl_generalfooter_306a.x
    sl and the original generalfooter.xsl remains in
    the XSL folder

31
Managing Customized Stylesheets
  • Update any and all references to the customized
    files in xsltransformer.xml
  • ltRootgt
  • ltNamegt./xsl/mylistresponse.xsllt/Namegt
  • ltIncludesgt
  • ltInclude type"timer"gtexpiretimer.xsllt/Includegt
  • ltInclude type"features"gtonoff.xsllt/Includegt
  • ltInclude type"image"gtimage.xsllt/Includegt
  • ltInclude type"attributes"gthcl_other_306a.xsllt/I
    ncludegt
  • ltInclude type"mylist"gthcl_mylist_306a.xsllt/Incl
    udegt
  • ltInclude type"string"gthcl_string_306a.xsllt/Incl
    udegt
  • ltInclude type"error"gterror.xsllt/Includegt
  • ltInclude type"toolbar"gthcl_toolbar2_306a.xsllt/I
    ncludegt
  • ltInclude type"footer"gthcl_generalfooter_306a.xs
    llt/Includegt
  • lt/Includesgt
  • lt/Rootgt

32
Managing Customized Stylesheets
  • If you use a 'Find and Replace' tool to update
    the entries in xsltransformer.xml, watch out for
    similarly named stylesheets
  • items.xsl
  • summaryitems.xsl
  • The root files cannot be renamed, so if you
    customize them you'll need to keep track
    "manually"
  • Keep copies of the unedited originals around with
    an identifying filename (example
    searchresponse_original_3.06a.xsl)

33
Managing Customized Stylesheets
  • Upgrade Procedure - use for upgrades, hotfixes,
    service packs, patches
  • Step 1 Before the upgrade, copy the full xsl
    folder/directory to an available location (e.g.
    elsewhere on the HIP server, workstation, network
    drive, thumb drive, etc.)
  • Step 2 Rename the working version of
    xsltransformer.xml to something else, and then
    rename the original version back
  • xsltransformer.xml becomes xsltransformer_306a.xml
  • xsltransformer_original_306a.xml becomes
    xsltransformer.xml

34
Managing Customized Stylesheets
  • Step 3 If you have customized any of the root
    stylesheets
  • Rename the current customized versions using an
    identifiable filename
  • searchresponse.xsl becomes searchresponse_306a.xsl
  • Put the original, unedited versions back to their
    original filename
  • searchresponse_original_306a.xsl becomes
    searchresponse.xsl
  • Now you should be back to "out-of-the-box" and
    ready for the upgrade.

35
Managing Customized Stylesheets
  • Step 4 Run the upgrade
  • After it's finished, you should have a default
    installation of the new version of the XSL
    Processor
  • Step 5 After the upgrade
  • For each of the stylesheets you've customized,
    compare the pre-upgrade originals to the
    post-upgrade originals.
  • file size
  • date/time modified
  • If there are no changes in the original versions,
    then your customized version can be re-integrated
    without modification (except for a filename
    change)
  • hcl_generalfooter_306a.xsl becomes
    hcl_generalfooter_309.xsl

36
Managing Customized Stylesheets
  • Step 5 After the upgrade (continued)
  • If the post-upgrade original IS different than
    the pre-upgrade original, use a "Compare Files"
    utility to determine the nature of the changes
  • If the changes are relatively minor, incorporate
    them (if appropriate) into your customized
    version
  • If the changes are major compared to your
    customizations, recreate your customizations into
    the new version of the stylesheet
  • In either case, make sure that the new, original
    version of each stylesheet with it's original
    filename is left in the XSL folder
  • Don't forget the root stylesheets if they have
    been customized

37
Managing Customized Stylesheets
  • Step 6 Update xsltransformer.xml
  • Make a backup copy of the post-upgrade
    xsltransformer.xml
  • Edit the new version of xsltransformer.xml,
    updating any and all references to the customized
    stylesheets

38
Customizing HIP 2.x/3.xAdvanced XSLT Stylesheet
Editing
  • Phil Feilmeyer
  • Hennepin County (MN) Library
  • pfeilmeyer_at_hclib.org
  • Slides www.hclib.org/extranet
Write a Comment
User Comments (0)
About PowerShow.com