ALEPH XSL Templates 1 ALEPH XSL Templates New

  • Slides: 32
Download presentation
ALEPH XSL Templates 1 ALEPH XSL Templates

ALEPH XSL Templates 1 ALEPH XSL Templates

New Print Concept • Full data is delivered in XML format. • XSL is

New Print Concept • Full data is delivered in XML format. • XSL is used format and layout. • XML data + XSL language creates an HTML print file. 2 • As an aid in the customization process, you can view the HTML file in a browser, and print from there. ALEPH XSL Templates

New Print Concept • Customization (translation, formatting and layout) can be an iterative process,

New Print Concept • Customization (translation, formatting and layout) can be an iterative process, without having to re -create the raw data. After XSL is changed, XML data can be re-printed, using new XSL definitions. • We have our own tool (a client application) for creating XSL. 3 ALEPH XSL Templates

Old System Print Product 4 ALEPH XSL Templates

Old System Print Product 4 ALEPH XSL Templates

New System Print Product 5 ALEPH XSL Templates

New System Print Product 5 ALEPH XSL Templates

Why XML / XSL ? • Built-in support for UTF-8 (= any language can

Why XML / XSL ? • Built-in support for UTF-8 (= any language can be printed). • Fast growing standard – help and support readily available. • Regular text file – regular editor (vi, notepad) used for maintenance. 6 ALEPH XSL Templates

Why XML / XSL ? • XML file contains all the data from the

Why XML / XSL ? • XML file contains all the data from the relevant Z record(s), independent of what will be printed; therefore, adding data to print form does not require programming. Data fields are easily added. • XSL is a language which supports include files – common blocks can be encapsulated in common functions. 7 ALEPH XSL Templates

XML Background • XML – A standard for representing Data and its meaning. –

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. 8 ALEPH XSL Templates

XML Example <? xml version="1. 0"? > <? xml-stylesheet href="pres. xsl" type="text/xsl" encoding="utf-8" ?

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

XSL Background We use another standard / language – XSL – to convert the

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: 10 ALEPH XSL Templates

XSL Example <xsl: stylesheet xmlns: xsl="http: //www. w 3. org/1999/XSL/Transform" version="1. 0"> <xsl: template

XSL Example <xsl: stylesheet xmlns: xsl="http: //www. w 3. 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> 11 ALEPH XSL Templates

XML + XSL = HTML 12 ALEPH XSL Templates

XML + XSL = HTML 12 ALEPH XSL Templates

A closer look Let’s look at the following: <xsl: for-each select=“//employee"> <b>First Name: </b>

A closer look Let’s look at the following: <xsl: for-each select=“//employee"> <b>First Name: </b> <xsl: value-of select=". /firstname"/><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/> 13 That is: we combine: • literal values, including HTML elements, • Values to be taken from the contents of the XML file. ALEPH XSL Templates

A Broader View So, if we can add HTML elements to the rendering, we

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 to invoke them whenever they are needed. 14 ALEPH XSL Templates

XSL in ALEPH The data for reports in ALEPH (starting 15) are contained in

XSL in ALEPH The data for reports in ALEPH (starting 15) are contained in XML files. For each report, an XSL file is defined (=Template). This template determines: • What fields of the XML are included in the formatted report. • How they should be formatted. 15 ALEPH XSL Templates

XSL in ALEPH – cont In addition, there are several XSL files which are

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. 16 They contain definitions for the rendering of common report blocks such as the standard salutations, signatures, sublibrary address, patron address etc. ALEPH XSL Templates

XSL in ALEPH – cont. In principle the system librarian can maintain (=translate, add/remove

XSL in ALEPH – cont. 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. 17 ALEPH XSL Templates

Report Generation START DB tables translation Query client server XML XSL Parser XML +

Report Generation START DB tables translation Query client server XML XSL Parser XML + XSL 18 HTML ALEPH XSL Templates

A Report 19 ALEPH XSL Templates

A Report 19 ALEPH XSL Templates

Its XML 20 ALEPH XSL Templates

Its XML 20 ALEPH XSL Templates

Its XSL (Part 1) <xsl: stylesheet xmlns: xsl="http: //www. w 3. org/1999/XSL/Transform" version="1. 0">

Its XSL (Part 1) <xsl: stylesheet xmlns: xsl="http: //www. w 3. 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> 21 ALEPH XSL Templates

<!-- START DATA --> <xsl: template name="header"> <xsl: call-template name="header-gen"> <xsl: with-param name="title" select="'Arrival

<!-- 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> Its XSL (cont. ) <!--SECTION-01 (FREE)--> 22 <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=". /z 68 -doc-number"/> </xsl: call-template> <xsl: call-template name="display-gen"> <xsl: with-param name="label" select="'Sequence: '"/> <xsl: with-param name="value" select=". /z 68 -sequence"/> </xsl: call-template> <xsl: call-template name="display-gen"> <xsl: with-param name="label" select="'Order Type: '"/> <xsl: with-param name="value" select=". /z 68 -order-type"/> </xsl: call-template> <xsl: call-template name="display-gen"> <xsl: with-param name="label" select="'Order Number: '"/> <xsl: with-param name="value" select=". /z 68 -order-number"/> </xsl: call-template> <xsl: call-template name="table-close"/> </xsl: template> </xsl: stylesheet> ALEPH XSL Templates

Comments • ‘header-gen’, ‘sublib-address’, ‘display-gen’ are XSL functions that handle the actual display •

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. 23 ALEPH XSL Templates

Now to Customization … 24 ALEPH XSL Templates

Now to Customization … 24 ALEPH XSL Templates

Customization There are 2 basic customizations: • Changing (or translating) labels • Adding or

Customization There are 2 basic customizations: • Changing (or translating) labels • Adding or removing data (=Z table columns etc. ) In addition, there is advanced customization - layout change – which will be explained later. 25 ALEPH XSL Templates

Changing Labels Since the XSL file is a regular ASCII file you just edit

Changing Labels Since the XSL file is a regular ASCII file you just edit it and make the changes you want. 26 ALEPH XSL Templates

Removing Fields Examine the following snippet: <xsl: call-template name="display-gen"> <xsl: with-param name="label" select="'Doc Number:

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=". /z 68 -docnumber"/> </xsl: call-template> <xsl: call-template name="display-gen"> <xsl: with-param name="label" select="'Sequence: '"/> <xsl: with-param name="value" select=". /z 68 -sequence"/> </xsl: call-template> To remove a field, e. g z 68 -doc-number, simply delete the lines from ‘>xsl: call-template name="display-gen">’ to ‘/>xsl: call-template>’ that contain it (= The blue lines) 27 ALEPH XSL Templates

Adding Fields To add a field, “cut and paste” the same range of lines,

Adding Fields To add a field, “cut and paste” the same range of lines, then change “label” and “value” accordingly. For example: <xsl: call-template name="display-gen"> <xsl: with-param name="label" select="‘Auto Claim: '"/> <xsl: with-param name="value" select=". /z 68 auto-claim"/> </xsl: call-template> 28 ALEPH XSL Templates

Changing Relative Position The data will be displayed in the order it appears in

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. 29 ALEPH XSL Templates

Common Functions - 1 <xsl: template name="sublib-address"> <TABLE WIDTH="100%" STYLE="font-size: 9 pt; font-family: Arial">

Common Functions - 1 <xsl: template name="sublib-address"> <TABLE WIDTH="100%" STYLE="font-size: 9 pt; font-family: Arial"> <tr><td width="70%"></td><xsl: value-of select="//sub-library-address-1 -occ 1"/></td></tr> <tr><td width="70%"></td><xsl: value-of select="//sub-library-address-1 -occ 2"/></td></tr> <tr><td width="70%"></td><xsl: value-of select="//sub-library-address-1 -occ 3"/></td></tr> <tr><td width="70%"></td><xsl: value-of select="//sub-library-address-1 -occ 4"/></td></tr> <tr><td width="70%"></td><xsl: value-of select="//sub-library-address-1 -occ 5"/></td></tr> <tr><td width="70%"></td><xsl: value-of select="//sub-library-address-1 -occ 6"/></td></tr> <tr><td width="70%"></td><xsl: value-of select="//sub-library-address-1 -occ 7"/></td></tr> </TABLE> </xsl: template> 30 ALEPH XSL Templates

Common Functions: Comment The function ‘display-gen’ is responsible for displaying most of the data

Common Functions: Comment 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 combinations of the above In order to implement all options, display-gen can be invoked using arguments. Since most of the time the default is used, it is usually called with just the 2 basic arguments, namely ‘label’ and ‘value’. 31 ALEPH XSL Templates

ALEPH Reports Environment Server All XSL templates are stored in the server in /usm

ALEPH Reports Environment Server All XSL templates are stored in the server in /usm 01/form_LNG. After any change you have to run Util /I/ 6. This prepares a package to be downloaded when the clients start running. To tell ALEPH to use XSL for printing, edit: aleph/a 50_5/usm 50/tab/form_print_method Client 32 All XSL templates are downloaded to: alephcomfilesUSM 50Print TemplatesLNG The XSL parser (saxon) is in alephcombin ALEPH XSL Templates