220 likes | 367 Vues
This resource explores the transformative role of XSLT (Extensible Stylesheet Language Transformations) in digital media, emphasizing the separation of content and presentation. It discusses how XSLT facilitates flexible presentations, allowing users to manipulate and view data in multiple formats. The material highlights the immateriality of digital information, the reduction of physical medium ties, and how XSLT can transform XML source data into various outputs (HTML, PDF, ePub). Additionally, it addresses the broader implications of mutable formatting across digital media.
E N D
Digital Media Technology Week 6: Introduction to XSLT Peter Verhaar
XML and Presentation • Initial separation of form an content • Form is added through a stylesheet • Presentation is flexible
Immateriality of digital information • No permanent connection to a physical medium • Shape is created by rendering devices • Endurance and aesthetics • Decrease in the importance of form as a more general development on digital media? Mp3-files, e-Books
Advantages • Flexible presentation: different ‘views’ on the data • Possibilities for filtering • Textual analyses: calculations
Flexible presentation Please find <choice><sic>inclosed</sic><corr>enclosed</corr></choice>Diplomatic edition:<xsl:value-of select=“choice/sic”/> Critical edition:<xsl:value-of select=“choice/corr”/>
XML Source XSLT Stylesheet XML Result
Template • Oxford English Dictionary: “An instrument used as a gauge or guide in bringing any piece of work to the desired shape” ; “a tool in moulding … a guide in forming moulds for castings or pottery” • A blueprint / a model
TEI <titleStmt><title>Letter from De Erven F. Bohn to George Eliot</title></titleStmt> <xsl:template> <html> <head></head> <body> <h1> <xsl:value-of select=“titleStmt/title”/> </h1> </body> </htlml> </xsl:template> XSLT
HTML Result file <html> <head></head> <body> <h1>Letter from De Erven F. Bohn to George Eliot</h1> </body> </htlml>
Medium-neutrality HTML PDF TEI Stylesheet MS Word ePUB
Example: XML source <?xml version="1.0" encoding="UTF-8"?> <letter> <head>Letter from De Erven F. Bohn to W. Blackwood and sons, January 22nd, 1873</head> <body> <dateline> <place>Haarlem</place> <date>22 January 1873</date> </dateline> <greeting>Dear Sirs!</greeting> <p>We beg to apply to you the kind request for sending us one week before the publication one copy of Bulwer's novel: <title>Kenelm Chillingly, His adventures and opinions</title>, which book you have in the press, for what we are inclined to pay 30 £. When it were possible to send us already now the first volume by the post; it would be yet more agreeable. Mr H.A. Kramers at Rotterdam readily will be our pledge.</p> <salute> your truly</salute> <signed>De Erven F. Bohn</signed> </body> </letter>
<xsl:stylesheet> </xsl:stylesheet> <xsl:template match=“letter” ></xsl:template> <xsl:template match=“body” ></xsl:template>
Getting started • Include a template that points to the root element of the XML source. XML XSLT <?xml version="1.0" encoding="UTF-8"?> <letter> <head>Letter from De Erven F. Bohn to W. Blackwood and sons, January 22nd, 1873</head> <body> ….</body> </letter> <xsl:template match=“letter"> … </xsl:template>
XSLT XML Source <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="letter"> </xsl:template> </xsl:stylesheet> <?xml version="1.0" encoding="UTF-8"?> <letter> … </letter> XML Result
<xsl:template match="tei:lb"> <br/></xsl:template> <xsl:template match="tei:gap"> <xsl:text> [...] </xsl:text> </xsl:template>
Transformation to PDF • XSL:FO (Formatting Objects) • XSL:FO creates a “Page Design” and text can be pasted into this basic layout
Exchange of data Metadata Harvesting
Crosswalking • Mapping and exporting metadata • For instance: TEI to MARC21 TEI//tei:titleStmt/title//tei:titleStmt/tei:title/tei:persName//tei:opener//tei:date DCdc:title dc:creatordc:date