LBSC670_class07_xsl_101911x - Erik Mitchell

nostalgicisolatedΛογισμικό & κατασκευή λογ/κού

4 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

68 εμφανίσεις

LBSC 670

Organization of Information


Review


Metadata models


Dublin Core


Metadata Standards


Dublin core, MARC


Encoding Schemes


HTML, XML, MARC…


Advanced metadata concepts


Schemas, application profiles



Questions?


INLS 520


Fall 2007

Erik Mitchell

INLS 520


Fall 2007

Erik Mitchell

Today


Guest speakers:


Metadata and information organization in digital
libraries



eXtensible

Stylesheet

Language:


Learning the nuts and bolts of metadata
transformation

Guest Speakers


Jennine

Kneiss


Thomas Whittaker


INLS 520


Fall 2007

Erik Mitchell

Anatomy of a Digital Library

Interfaces

Services

Metadata store

Digital object
store


Discovery


Administration


Create Replace Update
Delete


Index


XML files


Relational database


Object database


File system


File management
application

Connecting structure and style

CSS

XHTML

Semantics & structure

Design & interactivity

XSL

Decision making

Programming 101


Definition:


The process of developing a step
-
by
-
step
schema
tic for address a specific task



The process of organizing these steps
using a specific
encoding system



The manipulation of data to serve a
specific
information need

Compiled Vs Scripting

Definitions


Programming Language


“A formal language used to write instructions that can be
translated into machine language and then executed by a
computer.” (
definitions
)


Scripting Language


Run
-
time (does not require compilation)


Restricted context (requires a specific environment)


Functional / Object oriented


Definitions


Compiler / Interpreter


A program that builds and executes a program.
Compilers create a self
-
executable file, interpreters read a
text script at run
-
time

The programming process


Analyze the problem


What do you want your program to do?


What are your users expecting, what data do you have?


Plan program flow/logic


What steps need to occur, in what order?


Useful

tools

include

Step
-
Form,

flowcharts
,

and

pseudocode


Code the program


Create variables, routines, functions


Compile/run the program


Test, verify


Release

eXtensible

Stylesheets

eXtensible

Style Language (XSL) is a
metadata schema
that is
encoded using XML
and interpreted by Web
-
Browsers.













The primary function of XSL is to
transform XML
documents. The
XSL language features a set of programming constructs that
support this function


http://www.princexml.com/howcome/2007/xtech/papers/output/0082
-
32/index.xhtml

XSL Sample

<?xml version="1.0" encoding="UTF
-
8"?>

<
xsl:stylesheet

version="1.0"


xmlns:xsl
="http://www.w3.org/1999/XSL/Trans
form">

<
xsl:output

method="html"/>


<
xsl:template

match="/dc">



Processing Instructions


</
xsl:template
>



</
xsl:stylesheet
>



Contents of <xsl:template...>

<html>

<head>


<title>Sample XSL transformation</title>

</head>

<body>

<xsl:for
-
each select="*">

<p>

<b>


<xsl:value
-
of select="name(.)"/>


<xsl:text>:</xsl:text>


</b>

<xsl:value
-
of select="./text()"/>

</p>


</xsl:for
-
each>


</body>

</html>

XSL


Sample Stylesheet

<?xml version="1.0" encoding="UTF
-
8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:template match="/rss">


<html>



<body>




<xsl:for
-
each select="./channel/item">





<xsl:value
-
of select="title"/><br/>




</xsl:for
-
each>



</body>


</html>

</xsl:template>

</xsl:stylesheet>

XML RSS Record

<?xml version="1.0"?>

<rss version="2.0">

<channel>

<title>Sample RSS File</title>

<link>http://urltofile.xml</link>


<description>This is a sample</description>

<language>en
-
us</language>

<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>

<item>…</item>

<item>…</item>

<item>…</item>

<item>…</item>

</channel>

</rss>


WorkTime
!


Get into groups and work through
our XSL worksheet.


Ask questions


Pause for discussion

XSL Control Structures


For Each


<xsl:for
-
each select=“/date”></xsl:for
-
each>


Choosing between options


<xsl:choose>


<xsl:when select=“contains(/URL, “.edu”)>


</xsl:when>


</xsl:choose>


If


<xsl:if test=“./title != ‘’> </xsl:if>


XPath


A DOM
-
style syntax that allows us to
access elements in an XML file


Examples


/dublinCore/title


Access the title of a DC record


/dulinCore/subject/@attribute


Access an attribute of the subject element


/dublinCore/

Xpath (2)


Xpath

functions


Contains (//item/title, ‘England’)


substring
-
before(string1, string2), substring
-
after(string1, string2)


Xpath

selectors


//
elementname



finds an element anywhere in the
DOM


./
-

from the current context


/
-

from the root context


*
-

wildcard match


Wrap
-
up


Questions about Assignment 2?


Next week


Classification!




Course feedback:


http://bit.ly/lbsc670_questions