|
1
|
- (Repeat from CODI/HUG 2003)
- Phil Feilmeyer
- Hennepin County Library
- CODI – November, 2004
|
|
2
|
- Introduction to customizing the HIP user interface by way of the XSLT
Stylesheets
- XSLT = Extensible Stylesheet Language for Transformations
- Tag-based programming language
- Transforms XML documents into something else (in this case, HTML)
- Not an XSLT training session
|
|
3
|
- <table>
- <xsl:attribute
name="border">0</xsl:attribute>
- <xsl:attribute
name="width">100%</xsl:attribute>
- <xsl:attribute
name="cellspacing">0</xsl:attribute>
- <xsl:attribute
name="cellpadding">0</xsl:attribute>
- <xsl:if
test="not($totalcount = 0)">
- <xsl:if
test="$renewalsallowed = $true">
- <tr>
- <td>
- <table>
- <xsl:attribute
name="border">0</xsl:attribute>
- <xsl:attribute
name="width">100%</xsl:attribute>
- <xsl:attribute
name="cellspacing">0</xsl:attribute>
- <xsl:attribute
name="cellpadding">2</xsl:attribute>
- <tr>
- <td>
- <xsl:attribute
name="width">1%</xsl:attribute>
- <input>
- ...
|
|
4
|
- Shape the catalog to meet the specific needs of your library
- Developers need to create a single product that libraries of any type
can use
- Override Dynix’s development decisions
- especially with regard to layout
- Generates interest in the catalog from staff and the public
- Sense of ownership when a suggestion is incorporated
- Satisfying
|
|
5
|
- Not supported, help from Dynix is billable
- If you’re careful, the risk is small
- Upgrades/patches are more work and take longer
- Potentially a lot more work and a lot longer
- Not too bad if a good upgrade plan is developed
- 2.0 to 2.01 40 hours
- 2.02 to 2.03, 2.03 to 2.03.01 1 hour
- 2.03.01 to 2.1 4 hours
- A major change in system architecture could have serious consequences
|
|
6
|
- HIP 3.0 running on Windows 2000
- Dynix ILS, release 191 HF1
- 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
|
|
7
|
- Resources available for customization effort
- Development server
- Extra ILS licenses
- 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
|
|
8
|
- Breakthrough moment: realizing there are two parts to every HIP page:
- Functional elements
- links, 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
|
|
9
|
|
|
10
|
- A solid working knowledge of HTML
- Primarily working backwards from the final product
- HTML tables
- HIP uses tables extensively as the framework for each page
- Table cells and rows are used to display variable sets of information
- Tabs in the tabset
- Items in the item display
- Subject headings in the sidebar
- Basic understanding of how Cascading Stylesheets (CSS) work
|
|
11
|
- Access and rights to the XSLT stylesheets
- Development HIP
- Separate installation of HIP for development purposes
- Develop, test and tweak customizations without bothering users of the
production system
- Very easy to copy pre-tested stylesheets to the production HIP
- Additional ILS licenses
- Dynix: uses at least one Dynix/UniVerse/Unix license
- Horizon: ??
- On a separate server
- Desktop PC with 1GB of RAM (or less?)
- On the production server
- Runs on different ports or a different IP address than production HIP,
more complex setup
- Resource issues?
|
|
12
|
|
|
13
|
- Stylesheets are organized into six functional areas of HIP
- Each of the functional areas has a root stylesheet
- searchresponse.xsl – search, view results, login
- patronpersonalresponse.xsl – my account
- placerequest.xsl – hold placement
- mylistresponse.xsl – my list, manage lists
- sendbooklist.xsl – send a booklist via email
- sessioninfo.xsl – ???
|
|
14
|
- Root stylesheets are associated with their supporting stylesheets in the
file xsltransformer.xml
- Located in the top level XSL folder
|
|
15
|
- ...
- <Root>
- <Name>./xsl/placerequest.xsl</Name>
- <Includes>
- <Include type="error">error.xsl</Include>
- <Include type="toolbar">toolbar2.xsl</Include>
- <Include type="requestoptions">placerequestoptions.xsl</Include>
- <Include type="footer">generalfooter.xsl</Include>
- <Include type="timer">expiretimer.xsl</Include>
- <Include type="bookings">bookings.xsl</Include>
- <Include type="image">image.xsl</Include>
- <Include type="features">onoff.xsl</Include>
- <Include type="attributes">other.xsl</Include>
- <Include type="string">string.xsl</Include>
- </Includes>
- </Root>
- ...
|
|
16
|
- Be sure to make a backup copy of a file before you edit
- Be comfortable with your backup plan
- Ours includes a nightly automatic XCOPY from D:\dynix\xsl\ to D:\backup\dynix\xsl\
- Use a plain text editor or an editor designed for XSLT
- MS Word or Word Pad might save the file in a non-ASCII format
- If possible, break up the customization into small edits that can be
tested individually along the way
|
|
17
|
- For changes to take affect:
- Just wait a few seconds for the XSL Processor’s “File Watch” to
automatically detect and incorporate the change
- If changes don’t seem to take affect, restart XSL Processor
- Horizon Application Server (JBoss) does not need to be restarted
- Run the XSL Processor as an application rather than as a service when
you are testing an edited stylesheet
- More complete error messages
- Fast and easy to stop and start
|
|
18
|
- Newly edited stylesheets won’t be tested until they’re called by HIP
- Example: changes to security.xsl
won’t be tested until the first time a login is attempted
- HIP stylesheets contain both XSL and HTML tags
- XSL tags are labeled as such:
- <xsl:attribute>
</xsl:attribute>
- <xsl:if> </xsl:if>
- HTML tags look like bare HTML tags
- <table> </table>
- attributes are applied with the <xsl:attribute> tag
|
|
19
|
- The following XSLT:
- <img>
- <xsl:attribute
name=“src”>/images/go.gif</xsl:attribute>
- <xsl:attribute
name=“border”>0</xsl:attribute>
- </img>
- Generates this HTML:
- <img src=“/images/go.gif” border=“0”>
|
|
20
|
- XSL Processor is picky when it comes to tags:
- Tags are case sensitive
- Bad: <TD> … </td>
- Good: <td> … </td>
- End tags are required
- Bad: <br>
- Good: <br></br>
- Empty tags can use the end marker to close:
- Good: <br/>
- <xsl:value-of select=“text”/>
|
|
21
|
- Comments
- Add comments to the stylesheet using standard HTML comment tags
- <!-- pf added series title -->
- Use comment tags to deactivate Dynix code
- <!-- pf c-o unnecessary stuff
- <xsl:if test="boolean(normalize-space(explanation))">
- <a>
- <xsl:attribute
name="class">
- <xsl:value-of
select="$css_normal_black_font1"/>
- </xsl:attribute>
- <xsl:value-of
select="explanation"/>
- </a>
- </xsl:if>
- -->
- NOTE: A comment used to deactivate code cannot include any comment tags
|
|
22
|
- Following the XSL trail from the HTML source to the corresponding spot
in the stylesheets can be tricky
- Never a direct route
- Root and support stylesheets
- Variables
- Templates
- Cascading Style Sheets
- Flow control tags
|
|
23
|
- Root and support stylesheets
- The XSL responsible for the HTML on any given page comes from multiple
stylesheets
- Find out which root file by adding “&GetXML=true” to the end of the
URL
- Case sensitive
- Remove “#focus” from the end of the URL
- Example:
- http://catalog.hclib.org/ipac20/ipac.jsp?profile=rd#focus
- http://catalog.hclib.org/ipac20/ipac.jsp?profile=rd&GetXML=true
|
|
24
|
|
|
25
|
- Variables
- HTML to be customized
- Send suggestions to
- <a class="normalBlackFont1" href="mailto:dnackos@dynix.com">
- d.nackos@epixtech.com
- </a>
- Assigned to a variable
- <xsl:variable name="emailsuggestions">
- d.nackos@epixtech.com
- </xsl:variable>
|
|
26
|
- Variable called by the code to be customized
- Send suggestions to
- <a>
- <xsl:attribute
name="class">
- <xsl:value-of
select="$css_normal_black_font1"/>
- </xsl:attribute>
- <xsl:attribute
name="href">
- mailto:<xsl:value-of
select="$emailsuggestions"/>
- </xsl:attribute>
- <xsl:value-of select="$emailsuggestions"/>
- </a>
|
|
27
|
- Templates
- Allows XSLT code to be packaged and reused
- Define a template
- <xsl:template name="footer">
- <center>
- ...
- </center>
- </xsl:template>
- Call up a template
- ...
- <xsl:call-template
name="footer"/>
- </form>
- </body>
- </html>
|
|
28
|
- Another template example
- <!-- put the current session ID in to the URL -->
- <xsl:template name="addSessionToURL">
- <xsl:choose>
- <!-- if sending an email
get new session -->
- <xsl:when
test="/searchresponse/sendingemail = $true">
- <xsl:text>session=new</xsl:text>
- </xsl:when>
- <!-- if not sending an email preserve session ID -->
- <xsl:otherwise>
- <xsl:text>session=</xsl:text>
- <xsl:value-of
select="/searchresponse/session"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- Output of <xsl:call-template name=“addSessionToURL”/>
- As part of an email: session=new
- All other situations: session=106W6250V8X87.3594
|
|
29
|
- Cascading stylesheets
- In HIP, defines the style elements for fonts and buttons
- Colors
- Size
- Text decoration: bold, underline, etc.
- Assigned in the XSLT by the ‘class’ attribute
- <a>
- <xsl:attribute
name="class">
- <xsl:value-of
select="$css_normal_black_font1"/>
- </xsl:attribute>
- <b><xsl:value-of
select="$full_bib_call_num"/></b>
- </a>
|
|
30
|
- Flow control tags
- <xsl:for-each ... >
- Repeat the code within the tag for each item in the dataset
- <xsl:for-each select="//blockdata/block">
- <xsl:call-template
name="blocktable"/>
- </xsl:for-each>
- <xsl:if ... >
- Only use the code within the tag if the condition is true
- <xsl:if test="boolean(//itemsout)">
- ...
- </xsl:if>
|
|
31
|
- Flow control tags (continued)
- <xsl:choose> <xsl:when … > <xsl:otherwise>
- Choose which code to use from multiple alternatives
- <xsl:choose>
- <xsl:when
test="//profile = ‘elibrary’">
- call your local library
- </xsl:when>
- <xsl:otherwise>
- ask for assistance at the
info desk
- </xsl:otherwise>
- </xsl:choose>
|
|
32
|
- Stylesheet Editor
- XMLSpy
- Xselerator
- FrontPage 2003
- Text Editor
- Notepad
- UltraEdit
- Find/Replace across multiple files
- Line number indicator, ”Go to line” utility
- Compare files
|
|
33
|
- XSLT, Doug Tidwell (O’Reilly book)
- iPac User Interface Customization Guide, from the Dynix support website
- http://customer.dynix.com/archive/pdf/?support/ipac/docu/202/iPacCustom.pdf
- iPac Listserv and archive
- http://lists.tblc.org/mailman/listinfo/ipac/
- iPac Zone, compiled by James Day
- http://www.scpl.lib.fl.us/ipaczone/
- Contributions from HIP administrators/customizers
- Google
|
|
34
|
- During upgrades, stylesheets may be replaced with new versions
- Customizations are NOT retained
- Before the upgrade, make sure you have backup copies of all the
stylesheets that have been customized along with the original versions
- After the upgrade, compare the new version of the stylesheet to the old original
uncustomized version.
- Date/time modified
- Size
- Side by side comparison
|
|
35
|
- If there are no differences between the old original version and the new
version, your customized version needs no changes
- If there are differences between the old and new stylesheets, find out
the nature of the changes
- If the changes are relatively minor, incorporate them into your old
customized stylesheet
- If the change is relatively major compared to your customizations,
incorporate your customizations into the new version of the stylesheet
- Upgrade documentation has been pretty good about listing the stylesheets
that will be replaced during the upgrade
|
|
36
|
|