69
Internet Technologies XML/XSLT • What is XML? • What is XSLT? • From XML to HTML using XSLT • The XSLT processing model • An Example from FpML • Homework

Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

  • View
    271

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

XML/XSLT

• What is XML?

• What is XSLT?

• From XML to HTML using XSLT

• The XSLT processing model

• An Example from FpML

• Homework

Page 2: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

What is XML?

XML is an acronym that stands for the eXtensible Markup Language.

It is a flexible framework which can be used to create new customizedmarkup languages.

HTML, for example, is a markup language with a fixed tag set.<P> <H1> ….

XML, on the other hand, does not define any particular set of tags. Itallows you to create your own tag set.

Page 3: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

What is XML’s primary purpose?

• Separating data from presentation

The range of internet capable devices is growing- WAP phones, pagers, TV sets, web browsers, in car computers, have different presentation requirements.

• Transmitting data between applications

As electronic commerce gathers pace, the amount of data exchanged between organizations is increasing. XML will play a significant role.

Page 4: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

What is XSLT?

XSLT stands for eXtensible Style Sheet Language : Transformations

XSLT is an XML language for transforming the structure of an XMLDocument.

Page 5: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

What is XSLT’s primary purpose?

• With the widespread adoption of XML languages there will be a need to extract and combine data from one set of XML documents to generate another set of XML documents.

XSLT

• In this presentation we will use XSL to convert XML documents to HTML

Page 6: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

XML to HTML using XSLT

(1) The XML document and the associated XSL style sheet mayboth be transferred to the browser.

(2) The server may apply the style sheet to an XML documentand the result may be sent to the client.

(3) The transformation may occur before the data is placed on the server.

Xalan may be used for (2) or (3). IE5 for (1).

Page 7: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

XML to HTML using XSLT

•A bibliography expressed in xml is

converted to a bibliography in html

Page 8: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib.xml<?xml version="1.0" ?>

<bib>

</bib>

<book isbn = "1-861003-12-9"> <title> XSLT Programmer's Reference </title> <author> Michael Kay </author> </book>

<paper> <title> GoTo Statement Considered Harmful </title> <author> Edsger Dijkstra</author> </paper><book isbn = "0-201485-43-5"> <title> XML and Java Developing Web Application</title> <author> Maruyama </author> <author> Tamura</author> <author> Uramoto </author></book>

Page 9: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib.xsl

<xsl:template match = "/">

</xsl:template>

<html> <title>ISBN Numbers</title> <body> <h1>ISBN Numbers</h1> <ul><xsl:apply-templates/></ul> </body> </html>

<?xml version="1.0"?>

<!-- XSL to produce a list of ISBN numbers in HTML -->

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

Page 10: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib.xsl (continued)

<xsl:template match = "book"> <li> <xsl:value-of select = "@isbn" /> </li> </xsl:template>

<xsl:template match = "paper"></xsl:template>

</xsl:stylesheet>

Page 11: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib.html

<html><title>ISBN Numbers</title><body><h1>ISBN Numbers</h1><ul> <li>1-861003-12-9</li> <li>0-201485-43-5</li></ul></body></html>

Page 12: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Bib.html

Page 13: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib.xml<?xml version="1.0" ?>

<bib>

</bib>

<book isbn = "1-861003-12-9"> <title> XSLT Programmer's Reference </title> <author> Michael Kay </author> </book>

<paper> <title> GoTo Statement Considered Harmful </title> <author> Edsger Dijkstra</author> </paper><book isbn = "0-201485-43-5"> <title> XML and Java Developing Web Application</title> <author> Maruyama </author> <author> Tamura</author> <author> Uramoto </author></book>

/

bib

book paper book

title author

XSLT Prog… Michael Kay

::

::

Page 14: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib.html

<html><title>ISBN Numbers</title><body><h1>ISBN Numbers</h1><ul> <li>1-861003-12-9</li> <li>0-201485-43-5</li></ul></body></html>

/

html

title body

ISBN.. h1 ul

li li

1-86…0-201..

Page 15: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib2.xsl<?xml version="1.0"?><!-- XSL to produce a list of titles and authors in HTML --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

version="1.0"> <xsl:template match = "/">

<html> <title>Author(s)/Title</title> <body> <h1>Author(s)/Title</h1> <ul><xsl:apply-templates/></ul> </body> </html> </xsl:template>

Page 16: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib2.xsl (continued)<xsl:template match = "book|paper"> <li> <xsl:for-each select = "author"> <xsl:value-of select = "." /> </xsl:for-each> <i> <xsl:value-of select = "title"/> </i> </li> </xsl:template></xsl:stylesheet>

Page 17: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib2.html<html><title>Author(s)/Title</title><body><h1>Author(s)/Title</h1><ul> <li> Michael Kay <i> XSLT Programmer's Reference </i></li> <li> Edsger Dijkstra<i> GoTo Statement Considered Harmful </i></li> <li> Maruyama Tamura Uramoto <i> XML and Java Developing Web Application</i></li></ul></body></html>

Page 18: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

bib2.html

Page 19: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

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

version="1.0">

<!-- Printing the last three authors in reverse order --> <xsl:template match = "/"> <html> <title>Author(s)</title> <body> <h1>Author(s)</h1> <ul> <xsl:apply-templates select = "/bib/book[2]/author[3]"/> <xsl:apply-templates select = "/bib/book[2]/author[2]"/> <xsl:apply-templates select = "/bib/book[2]/author[1]"/> </ul> </body> </html> </xsl:template>

Page 20: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Bib3.xsl (Continued)<xsl:template match = "author"> <li> <xsl:value-of select = "."/> </li> </xsl:template></xsl:stylesheet>

Page 21: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Bib3.html

<html><title>Author(s)</title><body><h1>Author(s)</h1><ul><li> Uramoto </li><li> Tamura</li><li> Maruyama </li></ul></body></html>

Page 22: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Page 23: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

XML to HTML using XSLT

•A poem expressed in xml is converted

to a poem expressed in html

Page 24: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.xml (1 of 3)<?xml version="1.0" ?>

<!-- A poem in XML Example taken from "XSLT Programmer's reference Michael Kay-->

<poem> <author> Rupert Brooke </author> <date> 1912 </date> <title>Song</title>

Page 25: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.xml (2 of 3)<stanza> <line>And suddenly the wind comes soft, </line> <line>And Spring is here again;</line> <line>And the hawthorn quickens with buds of green</line> <line>And my heart with buds of pain.</line> </stanza>

<stanza> <line>My heart all Winter lay so numb,</line> <line>The earth so dead and frore,</line> <line>That I never thought the Spring would come again</line> <line>Or my heart wake any more.</line> </stanza>

Page 26: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.xml (3 of 3)

<stanza> <line>But Winter's broken and earth has woken, </line> <line>And the small birds cry again;</line> <line>And the hawthorn hedge puts forth its buds,</line> <line>And my heart puts forth its pain.</line> </stanza></poem>

Page 27: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.html

Page 28: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.xsl (1 of 4)<?xml version="1.0"?><!-- XSL to produce an HTML encoded poem XSLT Programmer's reference, Michael Kay-->

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

<xsl:template match = "poem"> <html> <head> <title> <xsl:value-of select="title"/> </title> </head>

Page 29: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.xsl (2 of 4)

<body> <xsl:apply-templates select = "title"/> <xsl:apply-templates select = "author"/> <xsl:apply-templates select = "stanza"/> <xsl:apply-templates select = "date"/> </body> </html> </xsl:template>

Page 30: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.xsl (3 of 4)<xsl:template match = "title"> <div align="center"><h1><xsl:value-of select="."/></h1></div> </xsl:template> <xsl:template match = "author"> <div align="center"><h2>By <xsl:value-of select="."/></h2></div> </xsl:template>

<xsl:template match = "date"> <p><i><xsl:value-of select="."/></i></p> </xsl:template>

Page 31: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Poem.xsl (4 of 4)<xsl:template match="stanza"> <p><xsl:apply-templates select="line"/></p> </xsl:template>

<xsl:template match = "line"> <xsl:if test="position() mod 2 = 0">&#160;&#160;</xsl:if> <xsl:value-of select="."/><br/> </xsl:template>

</xsl:stylesheet> Nonbreaking space&nbsp; not includedautomatically in xmlas in html

Page 32: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

XSLT’s Processing Model

Consider the following XML file

<person> <name>Alan</name> <age>19</age> <email>[email protected]</email> </person>

We’ll look at a way to view this tree as a set.

Page 33: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<person> <name>Alan</name> <age>19</age> <email>[email protected] </email> </person>

person

name age

Alan 19

email

alan@

/

This is the normal way an XSLT programmer views the document.

Page 34: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<person> <name>Alan</name> <age>19</age> <email>[email protected]</email> </person>

We can represent this tree as a set.

{person : { name : alan, age : 19, email : [email protected] } }

A tree will be represented as a set of ordered pairs.

Page 35: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Another example

<biblio> <book> <author> Smith </author> <author> Jones </author> <date> 1976 </date> </book> <book> <author> Bell </author> <date> 1999 </date> </book> <paper> <title> Public key encryption</title> <author> Kensworth </author> </paper></biblio>

{biblio:{ book:{author:Smith,author:Jones,date:1976},

book:{author:Bell,date:1999},

paper:{title:Public key encryption, author:Kensworth}

}

}

Page 36: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

XSLT uses Structural Recursion

An XSLT stylesheet can be viewed as a function thatdefines a transformation.

O = S(I)

I is the input document S is the stylesheet O is the output document

Page 37: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

An example

f(v) = if isInt(v) then intTwoString(v) else vf({}) = {}f({r : t }) = { r : f(t) }f( t1 union t2 ) = f(t1) union f(t2)

// This program replaces integers with strings.

Page 38: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

An example

f(v) = if isInt(v) then intTwoString(v) else vf({}) = {}f({r : t }) = { r : f(t) }f( t1 union t2 ) = f(t1) union f(t2)

f({biblio:{ book:{author:Smith, author:Jones, date:1976}, book:{author:Bell,date:1999}, paper:{title:Public key encryption, author:Kensworth} }}) =

Page 39: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f(v) = if isInt(v) then intTwoString(v) else vf({}) = {}f({r : t }) = { r : f(t) }f( t1 union t2 ) = f(t1) union f(t2)

= {biblio: f({ book:{author:Smith, author:Jones, date:1976}, book:{author:Bell,date:1999}, paper:{title:Public key encryption, author:Kensworth} } ) }

We have a match

An example

Page 40: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f({ book:{author:Smith, author:Jones, date:1976}, book:{author:Bell,date:1999}, paper:{title:Public key encryption, author:Kensworth} }) =

f({ book:{author:Smith, author:Jones, date:1976}, book:{author:Bell,date:1999} })

union

f({ paper:{title:Public key encryption, author:Kensworth} })

f( t1 union t2 ) = f(t1) union f(t2) We have a match

Page 41: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f(v) = if isInt(v) then intTwoString(v) else v

f({}) = {}

f({r : t }) = { r : f(t) }

f( t1 union t2 ) = f(t1) union f(t2)

We have a match

f({ book:{author:Smith, author:Jones, date:1976}, book:{author:Bell,date:1999} }) =

f( {book :{author:Smith, author:Jones, date:1976}}) unionf( {book:{author:Bell,date:1999}}

Page 42: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f(v) = if isInt(v) then intTwoString(v) else v

f({}) = {}

f({r : t }) = { r : f(t) }

f( t1 union t2 ) = f(t1) union f(t2)

We have a match

f( {book :{author:Smith, author:Jones, date:1976}}) =

{ book : f({author:Smith, author:Jones, date:1976}) }

Page 43: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f(v) = if isInt(v) then intTwoString(v) else v

f({}) = {}

f({r : t }) = { r : f(t) }

f( t1 union t2 ) = f(t1) union f(t2)

We have a match

f({author:Smith, author:Jones, date:1976}) =

f({author:Smith}) union f({author : Jones, date:1976})

Page 44: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f(v) = if isInt(v) then intTwoString(v) else v

f({}) = {}

f({r : t }) = { r : f(t) }

f( t1 union t2 ) = f(t1) union f(t2)

We have a match

f({author:Smith}) = { author : f (Smith) }

Page 45: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f(v) = if isInt(v) then intTwoString(v) else v

f({}) = {}

f({r : t }) = { r : f(t) }

f( t1 union t2 ) = f(t1) union f(t2)

We have a match

{ author : f (Smith) } = { author : Smith }

… and so on …

Page 46: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

f({biblio:{ book:{author:Smith, author:Jones, date:1976},

book:{author:Bell,date:1999},

paper:{title:Public key encryption,

author:Kensworth}

}

}) = {biblio:{book:{author:Smith, author:Jones, date:”1976”},

book:{author:Bell,date:”1999”},

paper:{title:Public key encryption,

author:Kensworth}

}

}

Page 47: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

An Example From The Financial World (FpML)

FpML (Financial products Markup Language) is a new protocol to enable e-commerce activities in the field of financial derivatives.It is based on XML (Extensible Markup Language), the standardmeta-language for describing data shared between applications.Ultimately, it will allow for the electronic integration of a rangeof services, from electronic trading and confirmations toportfolio specification for risk analysis. All categories of over-the-counter (OTC) derivatives will eventually beincorporated into the standard; however, the initial release willfocus on interest rate swaps and Forward Rate Agreements (FRAs).

Taken from www.fpml.org’s web site

Page 48: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Who put FpML together?Bank of America BNP Paribas Chase Manhattan Bank Citigroup Concordia Net Credit Suisse First Boston Deutsche Bank Extensibility FinancialFusion Fuji Capital Markets

Goldman Sachs IBM J.P. Morgan Morgan Stanley Dean Witter PricewaterhouseCoopers Reuters SunGard Trading and Risk Systems S.W.I.F.T. Society for Worldwide Interbank Financial TelecommunicationUBS Warburg webMethods

Page 49: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

An FpML Document

<?xml version="1.0" standalone="no"?>

<!-- Copyright (c) 1999 by J.P.Morgan and PricewaterhouseCoopers.PricewaterhouseCoopers refers to the individual member firms of the World wide PricewaterhouseCoopers organization. All rights reserved.--><!-- version 1.0b2 : August 6, 1999 -->

Page 50: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<fpml:FpML xmlns:fpml='urn:fpml-FpML' xmlns:m='urn:fpml-money' xmlns:r='urn:fpml-rate'> <fpml:Trade> <fpml:tradeIDs> <tid:TradeIDs xmlns:tid="urn:fpml-TradeID"> <tid:TradeID> <tid:partyReference>XYZ Investement Bank</tid:partyReference> <tid:transactionReferenceNumber>237732</tid:transactionReferenceNumber> </tid:TradeID> <tid:TradeID> <tid:partyReference>ABC Investments</tid:partyReference> <tid:transactionReferenceNumber>1230</tid:transactionReferenceNumber> </tid:TradeID> </tid:TradeIDs> </fpml:tradeIDs>

Page 51: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<fpml:product> <fpswp:FXSwap xmlns:fpswp="urn:fpml-FX-Product-SwapType"> <fpswp:productID>P123908</fpswp:productID> <!-- at the moment valid value is FXSwap. it could

be expanded later --> <fpswp:productType>FXSwap</fpswp:productType> <fpswp:nearLeg> <ftsl:FXLegTemplate xmlns:ftsl="urn:fpml-FX-Template-Leg" xmlns:fxs="urn:fpml-shared-FX"> <fxs:ccy1>SFC</fxs:ccy1> <fxs:ccy2>GBP</fxs:ccy2> <fxs:ccy1BuyerReference>ABC Investments</fxs:ccy1BuyerReference> <fxs:ccy2BuyerReference>XYZ Investement Bank</fxs:ccy2BuyerReference> <fxs:ccy1Amount> <m:Money> <m:ccy>SFC</m:ccy> <m:amount>15600000</m:amount> </m:Money> </fxs:ccy1Amount>

Page 52: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<fxs:ccy2Amount> <m:Money> <m:ccy>GBP</m:ccy> <m:amount>10000000</m:amount> </m:Money> </fxs:ccy2Amount> <fxs:settlementDate>1999-08-01</fxs:settlementDate> <fxs:exchangeRate> <r:FXRate> <r:ccy1>SFC</r:ccy1> <r:ccy2>GBP</r:ccy2> <r:type>offer</r:type> <r:quoteBasis>CCY1PERCCY2</r:quoteBasis> <r:rate>1.56</r:rate> </r:FXRate> </fxs:exchangeRate> </ftsl:FXLegTemplate> </fpswp:nearLeg>

Page 53: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<fpswp:farLeg> <ftsl:FXLegTemplate xmlns:ftsl="urn:fpml-FX-Template-Leg" xmlns:fxs="urn:fpml-shared-FX"> <fxs:ccy1>SFC</fxs:ccy1> <fxs:ccy2>GBP</fxs:ccy2> <fxs:ccy1BuyerReference>XYZ Investement Bank</fxs:ccy1BuyerReference> <fxs:ccy2BuyerReference>ABC Investments</fxs:ccy2BuyerReference> <fxs:ccy1Amount> <m:Money> <m:ccy>SFC</m:ccy> <m:amount>16600000</m:amount> </m:Money> </fxs:ccy1Amount> <fxs:ccy2Amount> <m:Money> <m:ccy>GBP</m:ccy> <m:amount>10000000</m:amount> </m:Money> </fxs:ccy2Amount>

Page 54: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<fxs:settlementDate>1999-09-01</fxs:settlementDate> <fxs:exchangeRate> <r:FXRate> <r:ccy1>SFC</r:ccy1> <r:ccy2>GBP</r:ccy2> <r:type>offer</r:type> <r:quoteBasis>CCY1PERCCY2</r:quoteBasis> <r:rate>1.66</r:rate> </r:FXRate> </fxs:exchangeRate> </ftsl:FXLegTemplate> </fpswp:farLeg> </fpswp:FXSwap> </fpml:product>

Page 55: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<fpml:partyInformation> <pty:PartyInformation xmlns:pty="urn:fpml-party" xmlns:a="urn:fpml-contact"> <pty:tradeParties> <pty:Party name="ABC_Trust">

<pty:partyType>COUNTERPARTY</pty:partyType> <pty:corporateInformation> <pty:CorporateInformation> <pty:shortName>ABC Investments</pty:shortName> </pty:CorporateInformation> </pty:corporateInformation> <pty:confirmInformation> <pty:ConfirmInformation> <pty:primaryConfirmContact>

Page 56: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<a:Contact> <a:contactName>Jacob Smith</a:contactName> <a:contactOrganizationName>ABC Investments</a:contactOrganizationName> <a:emailAddress>[email protected]</a:emailAddress> <a:phoneNumber>212-888-1234</a:phoneNumber> <a:faxNumber>212-888-8888</a:faxNumber> <a:contactAddress> <a:Address> <a:streetAddress> <a:StreetAddress> <a:streetLine>123, Park Avenue</a:streetLine> </a:StreetAddress> </a:streetAddress> <a:city>New York</a:city> <a:state>NY</a:state> <a:country>US</a:country> <a:postalCode>10387</a:postalCode> </a:Address> </a:contactAddress> </a:Contact>

Page 57: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

</pty:primaryConfirmContact> </pty:ConfirmInformation> </pty:confirmInformation> <pty:settlementInformation> <pty:SettlementInstructions> <pty:settlementContact> <a:Contact> <a:contactName>Jacob Smith</a:contactName> <a:contactOrganizationName>Trade Settlements</a:contactOrganizationName> <a:phoneNumber>212-888-1434</a:phoneNumber> <a:faxNumber>212-888-6668</a:faxNumber> </a:Contact> </pty:settlementContact>

Page 58: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<pty:paymentInstructions> <pty:PaymentInstructions> <pty:settlementCurrency>GBP</pty:settlementCurrency> <pty:payFromName>ABC Bank PLC</pty:payFromName> <pty:correspondentInformation> <pty:FIRoutingInformation> <pty:fiName>ABC Bank PLC</pty:fiName> <pty:fiAddress> <a:Address> <a:city>London</a:city> <a:country>UK</a:country> </a:Address> </pty:fiAddress> <pty:fiAccountNumber>123456</pty:fiAccountNumber> <pty:fiRoutingID>ABC45678UK33</pty:fiRoutingID> <pty:fiRoutingIDType>SwiftBIC</pty:fiRoutingIDType> </pty:FIRoutingInformation> </pty:correspondentInformation>

Page 59: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<pty:intermediaryInformation> <pty:FIRoutingInformation> <pty:fiName>XYZ Bank PLC</pty:fiName> <pty:fiAccountNumber>293774</pty:fiAccountNumber> </pty:FIRoutingInformation> </pty:intermediaryInformation> <pty:beneficiaryInformation> <pty:FIRoutingInformation> <pty:fiName>ABC Brokers</pty:fiName> <pty:fiAccountNumber>/883733333</pty:fiAccountNumber> <pty:fiReferenceText>For the account of Harry Smith-/883733333 </pty:fiReferenceText> </pty:FIRoutingInformation> </pty:beneficiaryInformation> </pty:PaymentInstructions> </pty:paymentInstructions> </pty:SettlementInstructions> </pty:settlementInformation> </pty:Party>

Page 60: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<!--Also expected is the full settlement instructions for:<pty:partyReferenceName>XYZ Investment bank</pty:partyReferenceName>...--> </pty:tradeParties> </pty:PartyInformation> </fpml:partyInformation> </fpml:Trade></fpml:FpML>

Page 61: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

FpML to HTML using XSLT

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tid="urn:fpml-TradeID"

version="1.0">

<!-- Display party reference data -->

Page 62: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<xsl:template match = "/" > <html> <title>Foreign Exchange Swap</title> <body> <xsl:apply-templates/> </body> </html>

</xsl:template>

Page 63: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<xsl:template match = "* | text()"> <xsl:apply-templates/>

</xsl:template>

<xsl:template match="tid:partyReference"> <p> <xsl:value-of select="."/> </p>

</xsl:template> </xsl:stylesheet>

Page 64: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Page 65: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Wireless XSL

Page 66: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

WML<?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml> <template> <do type="back" label="Back"> <prev/> </do> </template> <card id="main" title="Welcome to my WAP"> <p align="center">I can't say much, since this screen is tiny.<br/> Why don't you visit my <a href="#fave">favorite WAP links.</a> </p> </card>

Page 67: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

<card id="fave" title="Favorite WAP Links"> <p align="center">These are some WAP sites I would love, if they existed.</p> <p align="left"> <a href="wap.cats.com">Tiny cat pictures</a><br/> <a href="wap.weather.com">The weather</a><br/> <a href="wap.jellybeans.org">One click jelly bean ordering</a> </p> </card> </wml>

Page 68: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

HomeworkConsider XML document I

<a> <e> <b> <c>1</c> <c>2</c> </b> <a> <c>3</c> </a> </e> </a>

(1) Write an XSLT stylesheet thatgenerates the same documentbut with all element namescapitalized. Use Xalan.

(2) Design a function f = O(I)that defines f(v), f({}) ,f({r : t }) and f( t1 union t2 ) so that I is transformedas described in (1).

Page 69: Internet Technologies XML/XSLT What is XML? What is XSLT? From XML to HTML using XSLT The XSLT processing model An Example from FpML Homework

Internet Technologies

Bibliography

XSLT Programmer’s Reference, Michael Kay, Wrox

Data on the Web, Abiteboul, Buneman, Suciu, Morgan Kaufmann

XML Bible, Elliotte Rusty Harold, IDG Books