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

Printing v.15 e-Seminar Motke Keshet

Embed Size (px)

Citation preview

Page 1: Printing v.15 e-Seminar Motke Keshet

Printing

v.15 e-Seminar

Motke Keshet

www.exlibrisgroup.com

Page 2: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Old System

Page 3: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Why a New Report System ?

Page 4: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar 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

Page 5: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

XML BackgroundXML – 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.

Page 6: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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>

Page 7: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

XSL BackgroundWe 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:

Page 8: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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>

Page 9: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

And the combination gives

Page 10: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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.

Page 11: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

A closer look

Let’s look at the following:

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.

<xsl:for-each select=“//employee"> <b>First Name:</b> <xsl:value-of select="./first-name"/><br/>

Page 12: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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 encapsulatereport sections that appear more than once (e.g. Sublibrary address, patron address, bib-info etc.) in functions and invoke them whenever they are needed.

Page 13: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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.

Page 14: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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.

Page 15: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Report Generation

client server

DB tables translation

XML

Query

XML

XML XSL

XSLParser

+

HTML

Page 16: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

A Report

SublibAddress

Bib-info

Header

Page 17: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Its XML

Page 18: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

<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>

Its XSL (Part 1)

Page 19: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

<!-- 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>

Its XSL (Cont’)

Page 20: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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 …

Page 21: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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.

Page 22: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Changing Labels

Since the XSL file is a regular ASCII file

you just edit it and make the changes

you want.

Page 23: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Removing Fields

<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>

Examine the following snippet:

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)

Page 24: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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>

Page 25: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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.

Page 26: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Clarifying Some Terms

Each XML section can be displayed in one of

three layouts:

• Free

• Grid

• Split

Page 27: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Free Layout

Page 28: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Split Layout

Page 29: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Grid Layout

Page 30: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

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>

Page 31: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Common Funcs : CommentThe 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 basicArguments, namely ‘label’ and ‘value’.

Page 32: Printing v.15 e-Seminar Motke Keshet

v.15 Printing

v.1

5 S

em

inar

Aleph Reports EnvironmentServerAll 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

ClientAll XSL templates are downloaded to alephcom\files\USM50\Print Templates\LNGThe XSL parser (saxon) is in alephcom\bin