Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Workshop XSLT. XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation.

Similar presentations


Presentation on theme: "XML Workshop XSLT. XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation."— Presentation transcript:

1 XML Workshop XSLT

2 XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation Module specifications Languages XSLT, XSchema, Soap

3 XML – a sample system eXist Native XML Database XQuery process Java Stores XML, XQuery,XSL CSS and binary files (JPEG) XSLT process CSS process Server Client Browser

4 Example – Family History Photo Id : integer Image: jpeg Description: string Date: date Media: string Inscription: string Person Event Name: string Date : date age Place Address : string Lat: decimal Long: decimal BirthDeathMarriage subject

5 Many-many resolution in XML Photo Image: jpeg Description: string Date: date Media: string Inscription: string (Subject: ( Person: name Age: integer) | Animal : name )* Place: (address, lat, log) | name 2 B/W photograph Family sitting round the fireplace Robin Wallace Kenneth Wallace 12 Francis Wallace Cat Miss Whitfield Claremont, Brows Lane, Formby -3.06608 53.55555

6 Example – Events Person Event Name: string Date : date Birth DeathMarriage child father mother 1911-04-26 New Brighton Francis Wallace Kenneth Wallace Ida Wallace

7 xquery version "1.0"; (: List events for a person :) declare namespace request="http://exist-db.org/xquery/request"; declare namespace transform = "http://exist-db.org/xquery/transform"; let $person := request:request-parameter('person',''), (: get the set of events in which this person is involved :) $events := document(/'db/history/events.xml')/eventList/event[.//person = $person], (: get the stylesheet :) $ss := document('/db/history/eventList.xsl'), (: set the 'focus' of the event list to the person :) $params :=, (: order the events in ascending date order :) $elist := {for $e in $events order by $e/date return $e } return (: return the event list transformed by the stylesheet :) transform:transform($elist,$ss,$params) XQuery

8 XSLT Event List Matches the top- level Document Apply matching templates in the given node-set Evaluate an expression and insert the result Elements written directly to the result

9 XSLT … : Born :Father, Mother Child Mother Match the node named eventList XPath Filter conditions,

10 XSLT process XML document XSLT document XSLT process XML or plain text parameters Parse inputs, set context to root; While nodes in context, for each node, check if any templates match – choose the most specific and apply the template. Set context to the node matched. Apply this recursively

11 XSLT language Multilingual Output Imperative Control structures Procedural programming Rule-based matching Functional XPath Functions Process Control Debugging

12 Multi-lingual Plain text and plain xml xsl (identified by the xsl:namespace) XPath to define node-sets Filter conditions to select subsets XPath functions to manipulate the nodes Comments

13 Result output Insert evaluated expression Insert plain text – …. Insert processing instruction – Insert a number – like a level number – Copy nodes into the output – Create a node –

14 Two programming styles Pull – structured programming (imperative) –XSL models output structure and pulls parts of the XML input into the output” Push –rule-based programming (declarative) –“XML is pushed through a set of matching rules” XML output XML output

15 Imperative Control Structures Imperative Control structures –Sequence of data and instructions –Selection One option – Multiple options – –Iteration Iterate over nodes in a sequence – Order nodes in the iteration –

16 Procedural programming Procedure call - –.. Call Parameters – Procedure definition –.. Procedure parameters –

17 Rule-based matching Template definition – Template application – Recursive Apply most specific template to a node –only one rule can match

18 Functional variables can be defined but they are constants Variable declaration – Variable value –

19 XPath Functions Boolean Functions String functions Numeric Functions Node sequence functions

20 Modular Programming Inclusion of another stylesheet – Inclusion of tempates from a stylesheet –

21 Process control Stylesheet declaration – Output control – Serialisation – Key – Define attributes –

22 Debugging Output Debug message –


Download ppt "XML Workshop XSLT. XML Tagged data Hello A really interesting course, well taught Interchange of data RSS, BPEL4WS, RossettaNet … Structure document representation."

Similar presentations


Ads by Google