Create an HTML output from your own project with XSLT

Similar documents
WTP-101 Developing Rich Internet Applications with Java Web Frameworks

CST 150 Web Design I CSS Review - In-Class Lab

XSL - Introduction and guided tour

Markup Sprachen und semi-strukturierte Daten

Web layout guidelines for daughter sites of Scotland s Environment

JJY s Joomla 1.5 Template Design Tutorial:

Development Perspective: DIV and CSS HTML layout. Web Design. Lesson 2. Development Perspective: DIV/CSS

By Nabil ADOUI, member of the 4D Technical Support team

WTP-101 Developing Web Applications with Standards. using W3C org standard technologies such as, HTML, CSS, XML, XSD and XSL

T XML in 2 lessons! %! " #$& $ "#& ) ' */,: -.,0+(. ". "'- (. 1

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Interactive, dynamic Scalable Vector Graphics

Web Server Logs Analyze Using the XML Technologies

IMPLEMENTING AN XML COURSE IN THE COLLEGE OF BUSINESS

Building A Very Simple Website

Web Design and Databases WD: Class 7: HTML and CSS Part 3

F O R U M N O K I A. Implementing Trucking Logistics with Nokia Handsets. Version 1.0; July 18, Java /XML

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Principles of Web Design 6 th Edition. Chapter 12 Responsive Web Design

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

Filen ex_e.xml. Her kommer koderne Det der står skrevet med fed er ændret af grp <?xml version="1.0"?>

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

Document Builder. Thien Tran Department of Computer Science San Jose State University

XML and Tools. Muhammad Khalid Sohail Khan Mat #: University of Duisburg Essen Germany

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

Using Style Sheets for Consistency

Level 1 - Clients and Markup

HTML and CSS. Elliot Davies. April 10th,

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

Web Authoring CSS. Module Descriptor

Simply download Beepip from and run the file when it arrives at your computer.

This document will describe how you can create your own, fully responsive. drag and drop template to use in the creator.

Kentico CMS, 2011 Kentico Software. Contents. Mobile Development using Kentico CMS 6 2 Exploring the Mobile Environment 1

XSLT - A Beginner's Glossary

CIS 467/602-01: Data Visualization

What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

Leveraging exist-db for Efficient TEI Document Management

CSS. CSS - cascading style sheets CSS - permite separar num documento HTML o conteúdo do estilo. ADI css 1/28

XSL Elements. xsl:copy-of

Web Design and Development ACS Chapter 9. Page Structure

XML WEB TECHNOLOGIES

ICE: HTML, CSS, and Validation

Developers Guide. Designs and Layouts HOW TO IMPLEMENT WEBSITE DESIGNS IN DYNAMICWEB. Version: English

Introduction to Web Development

How To Customize A Forum On Vanilla Forum On A Pcode (Forum) On A Windows (For Forum) On An Html5 (Forums) On Pcode Or Windows 7 (Forforums) On Your Pc

Interactive Data Visualization for the Web Scott Murray

2 Problem description

Responsive Web Design for Teachers. Exercise: Building a Responsive Page with the Fluid Grid Layout Feature

Selectors in Action LESSON 3

Looking Good! Troubleshooting Display Problems

Web Design I. Spring 2009 Kevin Cole Gallaudet University

Von XML nach. Internet-Adressen. Günter Partosch, Oktober 2002

Learning Web Design. Third Edition. A Beginner's Guide to (X)HTML, Style Sheets, and Web Graphics. Jennifer Niederst Robbins

Contents. Downloading the Data Files Centering Page Elements... 6

Basics of HTML (some repetition) Cascading Style Sheets (some repetition) Web Design

Web Development I & II*

Dynamic Styling in Web Development

COMMONWEALTH OF PENNSYLVANIA DEPARTMENT S OF Human Services, INSURANCE, AND AGING

- a Humanities Asset Management System. Georg Vogeler & Martina Semlak

CSET 3100 Advanced Website Design (3 semester credit hours) IT Required

CSS for Page Layout. Key Concepts

Web Design for Programmers. Brian Hogan NAPCS Slides and content 2008 Brian P. Hogan Do not reproduce in any form without permission

Creating an newsletter using SimpleNews and phplist

OOML: Structured Approach to Web Development

Web Browser. Fetches/displays documents from web servers. Mosaic 1993

Static webpages with Pelican

MadCap Software. Import Guide. Flare 11

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

Beginning Web Development with Node.js

ios App Development Using Cordova

Fast track to HTML & CSS 101 (Web Design)

XML for RPG Programmers: An Introduction

WordPress and HTML Basics

Further web design: Cascading Style Sheets Practical workbook

Building A Very Simple Web Site

The Training Floor s. Webmaster s. Bible

CS134 Web Site Design & Development. Quiz1

Support Notes (Issue 1) September IGphones. Certificate in Digital Applications (DA105) Coding for the Web

Joomla Templates 101 Barb Ackemann

Data Integration through XML/XSLT. Presenter: Xin Gu

Module 6 Web Page Concept and Design: Getting a Web Page Up and Running

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

Garfield Public Schools Fine & Practical Arts Curriculum Web Design

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

XSLT Mapping in SAP PI 7.1

Introduction to Adobe Dreamweaver CC

IAS Web Development using Dreamweaver CS4

INTRO TO XMLSPY (IXS)

CREATING RESPONSIVE UI FOR WEB STORE USING CSS

INTEROPERABILITY BETWEEN VISUAL UML DESIGN APPLICATIONS AND AUTHORING TOOLS FOR LEARNING DESIGN

Chapter 3: XML Namespaces

The Web Web page Links 16-3

Enabling Web Services

Scoop Hosted Websites. USER MANUAL PART 4: Advanced Features. Phone: scoop@scoopdigital.com.au Website: scoopdigital.com.

Table of Contents: 1. Introduction/Rationale. 2. Who should use these guidelines? 3. Who should read/use this document?

Style & Layout in the web: CSS and Bootstrap

The Essential Guide to HTML Design

A set-up guide and general information to help you get the most out of your new theme.

Web publishing: An introduction to CSS

HOW Interactive Design Conference 2013

Transcription:

Create an HTML output from your own project with XSLT Martina Semlak - Georg Vogeler

Folie 2

Minimal stuff provided <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0"> <xsl:output method="xml" omit-xml-declaration="yes" encoding="utf-8" indent="yes" /> </xsl:stylesheet> Folie 3

First step Grab file xsl:template with the attribute: match="/" This template can contain the basic HTML structure of the ouput file Folie 4

HTML basics Reminder <html> <head><title></title><link (e.g. for a css)></head> <body></body> </html> We added this into <xsl:template match="/"> </xsl:template> Folie 5

Display text We have prepared basic HTML structure for you: header, section, nav > ul = navigation with references to other files We need a heading for the whole text: html: section > h3 xsl: xsl:value-of, attribute select with the appropriate xpath: //body/head div seems to be convenient to retain: do something with all divs: <xsl:apply-templates select="//body/div"/> what to do: <xsl:template match="div"> <div><xsl:apply-templates /></div> </xsl:template> Folie 6

XPath conditions Use a condition in the XPath (square brackets) for html: body/header > h1 and h2: find the appropriate title-element with type main or sub <h1> <xsl:value-of select="//title[@type='main']"/> </h1> Folie 7

<apply-templates />: individual templates xsl:template match="lg" div class="stanza" xsl:template match="l" <br/>... xsl:template match="hi" span xsl:template match="lb" <br /> Folie 8

Attributes Convert TEI content into an attribute of any HTML-element: as an explicit XSL-statement: <xsl:attribute name="attribute-name">content</xsl:attribute> or with curly brackets { }: <a href="{xpath}">...</a> e.g.: xsl:template match="hi" span and put the content of @rend into the style attribute Folie 9

Attributes <xsl:template match="hi"> <span> <xsl:attribute name="class" select="@rend"/> <xsl:apply-templates /> </span> </xsl:template> Folie 10

images: more complex XPath xsl:template match="pb" html:<img> add XPath: //surface[@xml:id=current()/@facs/substringafter(.,'#')]/graphic[1]/@url look for a surface element: //surface which fullfills a condition [...] which is the xml:id of the surface has to be the same as the text in the facsattribute of the current pb-element after the hash:sign @xml:id=current()/@facs/substring-after(.,'#') and use./graphic[1] and its URL:./@url Folie 11

images: more complex XPath <xsl:template match="pb"> <img width="300"> <xsl:attribute name="src" select="//surface[@xml:id=current()/@facs/substringafter(.,'#')]/graphic[1]/@url"> </xsl:attribute> </img> </xsl:template> Folie 12

Headings HTML has explicit numbers for the hierarchical level of headings: h1, h2, h3, h4. Headings in the text are on level 4 onwards. we need to create an element with a name dependent from the current position instead of writing directly an HTML element you can use xsl:element with the attribute name the name is constructed by the number of divs in which the current element is nested: count(ancestor::div) Folie 13

Headings <xsl:template match="head"> <xsl:element name="h{count(ancestor::div) + 3}"> <xsl:apply-templates/> </xsl:element> </xsl:template> Folie 14

Poem Headings are rightbound are head elements being children of a division from the type poem head[parent::div/@type='poem'] Conditions with xsl:if <xsl:if test=".[parent::div/@type='poem']"> <xsl:attribute name="class"> <xsl:text>right</xsl:text> </xsl:attibute> </xsl:if> Folie 15

The template: <xsl:template match="head"> <xsl:element name="h{count(ancestor::div) + 3}"> <xsl:if test=".[parent::div/@type='poem']"> <xsl:attribute name="class"> <xsl:text>right</xsl:text> </xsl:attibute> </xsl:if> <xsl:apply-templates/> </xsl:element> </xsl:template> Folie 16

Repeat something: e.g. keywords All terms in the keywords section should be converted into metaelements in the html header: html: <meta name="keywords" content="..."/> Xpath: /TEI/teiHeader/profileDesc/textClass/keywords/term (or //textclass/keywords/term) output: <xsl:for-each select="...">... </xsl:for-each> Put the XPath form above into the select attribute Put the html into the xsl:foreach add current() or. in curly brackets in the content-attribute of the meta element Folie 17

Repeat something: e.g. keywords <meta name="keywords"> <xsl:attribute name="content"> <xsl:for-each select="//textclass/keywords/term"> <xsl:value-of select="."/> </xsl:for-each> </xsl:attribute> </meta> Folie 18

Output by position <meta name="keywords"> <xsl:attribute name="content"> <xsl:for-each select="//textclass/keywords/term"> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>, </xsl:text> </xsl:if> </xsl:for-each> </xsl:attribute> </meta> Folie 19

CSS modification Since we don t have a page structure in the HTML we need additional CSS selectors: div.stanza, h5 { margin-left: 320px } h6.right { font-size: 1.2em; text-align: right; margin-top: 1em; } img { float: left; padding-top: 1em } Folie 20

Convert overlapping markup e.g. display text page by page: use the stylesheets from Sebastian Rahtz (Lyon 2011, example 8 in the zip folder): http://tei.oucs.ox.ac.uk/talks/2011-05-26-lyon or James Cummings: https://github.com/jamescummings/leap-xslt/blob/master/leapprocesspb.xsl Folie 21