1 / 32

Printing

Printing. www.exlibrisgroup.com. v.15 e-Seminar Motke Keshet. Old System. Why a New Report System ?. Why XML / XSL ?. Built in support of UTF-8 (= any language can be displayed) Fast growing standard – help and support readily available.

cletam
Download Presentation

Printing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Printing www.exlibrisgroup.com v.15 e-Seminar Motke Keshet

  2. Old System v.15 Printing

  3. Why a New Report System ? v.15 Printing

  4. Why XML / XSL ? • Built in support of UTF-8 (= any language can be displayed) • Fast growing standard – help and support readily available. • Regular text file – regular editor (vi, notepad) needed for maintenance. • XML contains all potential data from any relevant Z table. Adding data to display trivial. • XSL full language and support include files – common blocks can be encapsulated in common functions v.15 Printing

  5. XML Background • XML – A standard for representing Data and its meaning • Like HTML – every data element is surrounded by tags • Unlike HTML – the tags are not standard, they are defined by the author of the XML document • Unlike HTML – the tags have semantic meaning, no visual meaning, I.e. they say nothing about how the data should be presented. v.15 Printing

  6. XML Example <?xml version="1.0"?> <?xml-stylesheet href="pres.xsl" type="text/xsl" encoding="utf-8" ?> <emp> <employee> <first-name>John</first-name> <last-name>Smith</last-name> <birth-date>15/4/1975</birth-date> </employee> <employee> <first-name>George</first-name> <last-name>Dupont</last-name> <birth-date>17/6/1985</birth-date> </employee> </emp> v.15 Printing

  7. XSL Background We use another standard / language – XSL – to convert the XML data to HTML presentation. XSL syntax is based on XML – tags everywhere. Here is a small XSL program for converting our XML example to HTML: v.15 Printing

  8. XSL Example <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:for-each select="//employee"> <b>First Name:</b> <xsl:value-of select="./first-name"/><br/> <b>Last Name:</b> <xsl:value-of select="./last-name"/><br/> <b>Birth Date:</b> <xsl:value-of select="./birth-date"/><br/> </xsl:for-each> </xsl:template> </xsl:stylesheet> v.15 Printing

  9. And the combination gives v.15 Printing

  10. How Is It Combined You run an XSL parser called saxon, as follows: Saxon –o output.html input.xml input.xsl And get in output.html the previous slide. v.15 Printing

  11. A closer look Let’s look at the following: <xsl:for-eachselect=“//employee"> <b>First Name:</b> <xsl:value-of select="./first-name"/><br/> We tell XSL to go through all the “employee” records, and for each of them display: • Literally ‘<b>First Name:</b>’ • The actual value of the current <first-name> • Literally ‘<br/> That is: we combine: • literal values, including HTML elements, • Values to be taken from the contents of the XML file. v.15 Printing

  12. A Broader View So, if we can add HTML elements to the rendering, we can do anything HTML we want, such as presenting data in grids, deciding on fonts and sizes etc. More than that: XSL also contains functions. So it is possible to encapsulate report sections that appear more than once (e.g. Sublibrary address, patron address, bib-info etc.) in functions and invoke them whenever they are needed. v.15 Printing

  13. XSL in Aleph The report data in Aleph (starting 15.2) are contained in XML files. For each report an XSL file is defined (=Template). This template determines: • what fields of the XML are part of the report • how they should be displayed. v.15 Printing

  14. XSL in Aleph – Cont’ In addition, there are several XSL files which are common to all reports, and they are referred to by all the specific XSL templates. They contain definitions for the rendering of common report blocks such as the standard salutations, signatures, sublibrary address, patron address etc. In principle the system librarian can maintain (=translate, add/remove fields etc.) without actually knowing XSL, and rely on the patterns found in Aleph default XSLs. v.15 Printing

  15. Report Generation DB tables translation Query client server XML XML XSL Parser XML XSL + HTML v.15 Printing

  16. A Report Header Bib-info Sublib Address v.15 Printing

  17. Its XML v.15 Printing

  18. Its XSL (Part 1) <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="funcs.xsl"/> <xsl:template match="/"> <xsl:call-template name="header"/> <!--section-01 (FREE)--> <xsl:for-each select="//section-01"> <xsl:call-template name="section-01"/> </xsl:for-each> </xsl:template> v.15 Printing

  19. Its XSL (Cont’) <!-- START DATA --> <xsl:template name="header"> <xsl:call-template name="header-gen"> <xsl:with-param name="title" select="'Arrival Slip'"/> </xsl:call-template> </xsl:template> <!--SECTION-01 (FREE)--> <xsl:template name="section-01"> <xsl:call-template name="sublib-address"/> <xsl:call-template name="bib-info-hdr"> <xsl:with-param name="line" select="./bib-info"/> </xsl:call-template> <xsl:call-template name="table-open"/> <xsl:call-template name="display-gen"> <xsl:with-param name="label" select="'Doc Number:'"/> <xsl:with-param name="value" select="./z68-doc-number"/> </xsl:call-template> <xsl:call-template name="display-gen"> <xsl:with-param name="label" select="'Order Number:'"/> <xsl:with-param name="value" select="./z68-order-number"/> </xsl:call-template> <xsl:call-template name="table-close"/> </xsl:template> </xsl:stylesheet> v.15 Printing

  20. Comments • ‘header-gen’, ‘sublib-address’, ‘display-gen’ are XSL functions that handle the actual display • All of them are implemented in funcs.xsl or one of the XSL files included in it • All specific templates contain the line ‘<xsl:include href="funcs.xsl"/>’ so they all can invoke the common functions. Now to Customization … v.15 Printing

  21. Customization There are 2 basic customization: • Changing (or translating) labels • Adding or removing data (=Z table columns etc.) A more advanced customization - layout change – will be explained later. v.15 Printing

  22. Changing Labels Since the XSL file is a regular ASCII file you just edit it and make the changes you want. v.15 Printing

  23. Removing Fields Examine the following snippet: <xsl:call-template name="display-gen"> <xsl:with-param name="label" select="'Doc Number:'"/> <xsl:with-param name="value" select="./z68-doc-number"/> </xsl:call-template> <xsl:call-template name="display-gen"> <xsl:with-param name="label" select="'Sequence:'"/> <xsl:with-param name="value" select="./z68-sequence"/> </xsl:call-template> To remove a field, e.g z68-doc-number, simply delete the lines from ‘<xsl:call-template name="display-gen">’ To ‘</xsl:call-template>’ that contain it (= The blue lines) v.15 Printing

  24. Adding Fields To add a field, “cut and paste” the same range of lines, then change “label” and “value” accordingly. E.g: <xsl:call-template name="display-gen"> <xsl:with-param name="label" select="‘Auto Claim:'"/> <xsl:with-param name="value" select="./z68-auto-claim"/> </xsl:call-template> v.15 Printing

  25. Changing Relative Position The data will be displayed in the order it appears in the XSL file. So to change the order in print, simply change the order in the XSL. v.15 Printing

  26. Clarifying Some Terms Each XML section can be displayed in one of three layouts: • Free • Grid • Split v.15 Printing

  27. Free Layout v.15 Printing

  28. Split Layout v.15 Printing

  29. Grid Layout v.15 Printing

  30. Common Funcs - 1 <xsl:template name="sublib-address"> <TABLE WIDTH="100%" STYLE="font-size: 9pt; font-family: Arial"> <tr><td width="70%"></td><td><xsl:value-of select="//sub-library-address-1-occ1"/></td></tr> <tr><td width="70%"></td><td><xsl:value-of select="//sub-library-address-1-occ2"/></td></tr> <tr><td width="70%"></td><td><xsl:value-of select="//sub-library-address-1-occ3"/></td></tr> <tr><td width="70%"></td><td><xsl:value-of select="//sub-library-address-1-occ4"/></td></tr> <tr><td width="70%"></td><td><xsl:value-of select="//sub-library-address-1-occ5"/></td></tr> <tr><td width="70%"></td><td><xsl:value-of select="//sub-library-address-1-occ6"/></td></tr> <tr><td width="70%"></td><td><xsl:value-of select="//sub-library-address-1-occ7"/></td></tr> </TABLE> </xsl:template> v.15 Printing

  31. The function ‘display-gen’ is responsible for displaying most of the data in non-grid format. There are, however several options for displaying: • Display the label only if there is data attached to it (default) • Display the label even without data • Display the data right justified (numbers) • Display barcode with special barcode font • And several combinations In order to implement all options, display-gen can be invoked using arguments. Since most of the times only the default is used, it is usually called with just the 2 basic Arguments, namely ‘label’ and ‘value’. Common Funcs : Comment v.15 Printing

  32. Aleph Reports Environment Server All XSL templates are stored in the server in /usm01/form_LNG. After any change you have to run: util I 6 This prepares a package to be downloaded when the client start running. To tell ALEPH to use XSL for printing, edit: aleph/a50_5/usm50/tab/form_print_method Client All XSL templates are downloaded to alephcom\files\USM50\Print Templates\LNG The XSL parser (saxon) is in alephcom\bin v.15 Printing

More Related