XSLT Transformation... 1 Desired effect... 1 Files... 1 XML... 2 XSLT... 3 Result file... 4



Similar documents
CS412 Interactive Lab Creating a Simple Web Form

Caldes CM12: Content Management Software Introduction v1.9

Cisco Adaptive Security Appliance (ASA) Web VPN Portal Customization: Solution Brief

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

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

How to Create a Mobile Responsive Template in ExactTarget

Introduction to Web Design Curriculum Sample

Guide to Integrate ADSelfService Plus with Outlook Web App

Advanced Drupal Features and Techniques

Script Handbook for Interactive Scientific Website Building

<script type="text/javascript"> var _gaq = _gaq []; _gaq.push(['_setaccount', 'UA ']); _gaq.push(['_trackpageview']);

Introduction to XHTML. 2010, Robert K. Moniot 1

About webpage creation

Short notes on webpage programming languages

Professional & Workgroup Editions

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

Cover Page. Dynamic Server Pages Guide 10g Release 3 ( ) March 2007

Client-side Web Engineering From HTML to AJAX

Installation & Configuration Guide Version 2.2

How to Display Weather Data on a Web Page

Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts!

Developing XML Solutions with JavaServer Pages Technology

Data Integration through XML/XSLT. Presenter: Xin Gu

An Approach to Translate XSLT into XQuery

CHAPTER 10. When you complete this chapter, you will be able to:

Website 101. Yani Ivanov. Student Assistant / Web Administrator

A send-a-friend application with ASP Smart Mailer

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

Chapter 22 How to send and access other web sites

HTML Forms and CONTROLS

AJAX The Future of Web Development?

WEB PROGRAMMING LAB (Common to CSE & IT)

HTML Tables. IT 3203 Introduction to Web Development

1Lesson 1: Overview of Web Design Concepts Objectives

Foundation of Information Technology (Code No: 165) Sample Question Paper II Summative Assessment - Term II. Max Time: 3 hours Max Marks: 90 SECTION A

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

HTML. A computer network is a collection of computers linked through cables or wireless means.

DITA CMS Release 4.0 (Dynamic Release Management Module): Detailed Release Notes

Novell Identity Manager

ICT 6012: Web Programming

Web Reporting by Combining the Best of HTML and SAS

Web design. FDC Workshop: WebPage Design. Agenda. All you wanted to know about designing your own personal webpage without daring ask about it!

Creating your personal website. Installing necessary programs Creating a website Publishing a website

Xtreeme Search Engine Studio Help Xtreeme

Caldes CM2: Marketing s Support Document v1.12

mpdf Example 37. Barcodes <?php

Example. Represent this as XML

Page: 1. Merging XML files: a new approach providing intelligent merge of XML data sets

Asset Management. By: Brian Johnson

Web Development 1 A4 Project Description Web Architecture

Command-Line Tool for View Manager View Manager 4.0

Tabela obrazująca przebieg testów akceptacyjnych

PEAR. PHP Extension and Application Repository. Mocsnik Norbert Harmadik Magyarországi PHP Konferencia március 12., Budapest

HTML Basics(w3schools.com, 2013)

1 of 8 9/14/2011 5:40 PM

Chapter 2 HTML Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Semistructured data and XML. Institutt for Informatikk INF Ahmet Soylu

XSLT - A Beginner's Glossary

Web Programming with PHP 5. The right tool for the right job.

HTML TIPS FOR DESIGNING

Advanced Web Design. Zac Van Note.

FETAC Certificate in Multimedia Production. IBaT College Swords. FETAC Certificate in Multimedia Production Web Authoring Dreamweaver 3

BlueHornet Whitepaper

DEERFIELD.COM. DNS2Go Update API. DNS2Go Update API

Chapter 24 Web Servers (PWS, IIS, Apache, Jigsaw) 805. A Web server communicating with several HTTP clients.

XHTML vs. HTML - Which is the Best for You?

Building Checkout Pages

SEO Deployment Best Practices

Web Server Lite. Web Server Software User s Manual

CREATE A CUSTOM THEME WEBSPHERE PORTAL

Sample HP OO Web Application

POS Design. RTI HTML and Graphical User Interface (GUI) Direct Mail Maintenance. Discussion Document

Web Development and Core Java Lab Manual V th Semester

Building a Customized Data Entry System with SAS/IntrNet

Internet Technologies

Campaign Guidelines and Best Practices

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

İNTERNET TABANLI PROGRAMLAMA- 13.ders GRIDVIEW, DETAILSVIEW, ACCESSDATASOURCE NESNELERİ İLE BİLGİ GÖRÜNTÜLEME

HOTEL RESERVATION SYSTEM. Database Management System Project

Creating HTML authored webpages using a text editor

8 STEPS TO CODE KILLER RESPONSIVE S

Installation and Integration Manual TRANZILA Secure 5

Part II of The Pattern to Good ILE. with RPG IV. Scott Klement

Hello World RESTful web service tutorial

How to Properly Compose HTML Code : 1

Advanced Tornado TWENTYONE Advanced Tornado Accessing MySQL from Python LAB

ITNP43: HTML Lecture 4

So we're set? Have your text-editor ready. Be sure you use NotePad, NOT Word or even WordPad. Great, let's get going.

BASI DI DATI II 2 modulo Parte II: XML e namespaces. Prof. Riccardo Torlone Università Roma Tre

Kentico CMS 7.0 Tutorial ASPX

Cascading Style Sheet (CSS) Tutorial Using Notepad. Step by step instructions with full color screen shots

WEB DESIGN LAB PART- A HTML LABORATORY MANUAL FOR 3 RD SEM IS AND CS ( )

Web and e-business Technologies

Table of Contents Find out more about NewZapp

var form = app.createformpanel().setid('form').setencoding('multipart/form-data'); app.add(form);

Creating a Resume Webpage with

Outline of CSS: Cascading Style Sheets

XSLT Mapping in SAP PI 7.1

Real SQL Programming 1

Concordion. Concordion. Tomo Popovic, tp0x45 [at] gmail.com

Transcription:

XSLT Transformation... 1 Desired effect... 1 Files... 1 XML... 2 XSLT... 3 Result file... 4 XSLT Transformation This technique allows you distinguish data and layout into two separated files. You need any web browser, nothing else. More about transformations 1. xslt file can be written manually or by GUI in jdeveloper 2. alternative for xslt is xquery. Xquery can be written manually or by GUI in eclipse 3. in Oracle Database is function XMLTRANSFORM which transforms one XML file into another file Simple example Desired effect

Input file : XML <?xml version="1.0" encoding="windows-1250"?> <?xml-stylesheet type="text/xsl" href="layout.xslt"?> <xml> <title name="planowanie - ROZKŁAD ZAJĘĆ"></title> <period name="semestr: Zima 2010"></period> <data> <gro href="(c11).htm" text="row1łąka źrebię łóżko jeść"/> <gro href="(c11).htm" text="row2"/> <gro href="(c11).htm" text="row3"/> <lec href="(c11).htm" text="row4"/> <lec href="(c11).htm" text="row5"/> <lec href="(c11).htm" text="row6"/> <res href="(c11).htm" text="row7"/> Standard header, windows-1250 = standard of ms windows operation system Reference to xslt Tag with attribute with no data

<res href="(c11).htm" text="row8"/> <res href="(c11).htm" text="row9"/> </data> <who lastupdatetext="aktualizacja: 2010-03-29 21:19:47"></who> </xml> Input file : XSLT <?xml version="1.0" encoding="windows-1250"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html"/> <xsl:template match="xml"> <html> <HEAD> <xsl:for-each select = "title"> <title> <xsl:value-of select="@name"/> </title> </xsl:for-each> </HEAD> <body> <xsl:apply-templates/> </body> </html> Defines key words to be used In file Process branch named xml. This is case sensitive Content of result file Process branch named title. Must be inside xml branch @ means reference to attribute, compare with xml file recursive calling <xsl:template match="period"> <CENTER><xsl:value-of select="@name"/></center><br/><br/><br/><br/> <xsl:template match="data"> <TABLE BORDER="1" WIDTH="100%"> <TR><TD>Grupy</TD><TD>Wyk³adowcy</TD><TD>Zasoby</TD></TR> <TR> <TD VALIGN="TOP"> <xsl:for-each select = "gro"> <a> <xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute> <xsl:value-of select="@text"/> </a><br/> </xsl:for-each> </TD> <TD VALIGN="TOP"> <xsl:for-each select = "lec"> <a> <xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute> <xsl:value-of select="@text"/> </a><br/> </xsl:for-each> </TD> <TD VALIGN="TOP"> <xsl:for-each select = "res"> <BR/> NOT <BR/> each element must be closed For each element named gro This is a bit sophisticated. This command generates to html element <a href=? >?</a>

<a> <xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute> <xsl:value-of select="@text"/> </a><br/> </xsl:for-each> </TD> </TR> </TABLE> <xsl:template match="who"> <BR/><xsl:value-of select="@lastupdatetext"/> </xsl:stylesheet> Result file <html> <HEAD> <META http-equiv="content-type" content="text/html; charset=utf-16"> <title>planowanie - ROZK AD ZAJÊÆ</title> </HEAD> <body> <CENTER>Semestr: Zima 2010</CENTER><BR><BR><BR><BR><TABLE BORDER="1" WIDTH="100%"> <TR><TD>Grupy</TD><TD>Wykładowcy</TD><TD>Zasoby</TD></TR> <TR> <TD VALIGN="TOP"><a href="(c11).htm">row1³¹ka Ÿrebiê ³ó ko jeœæ</a><br><a href="(c11).htm">row2</a><br><a href="(c11).htm">row3</a><br></td> <TD VALIGN="TOP"><a href="(c11).htm">row4</a><br><a href="(c11).htm">row5</a><br><a href="(c11).htm">row6</a><br></td> <TD VALIGN="TOP"><a href="(c11).htm">row7</a><br><a href="(c11).htm">row8</a><br><a href="(c11).htm">row9</a><br></td> </TR> </TABLE><BR>Aktualizacja: 2010-03-29 21:19:47</body> </html> Advanced example This example shows - how to reference to specific nodes ([]) - how to use disable-output-escaping - how to use reusable code (<xsl:template name="comment">, <xsl:call-template name="comment">) - how to use case statement (<xsl:choose>)

- how to reference to current element (.) - how to use build-in functions (translate) - how test whether node exists Desired effect Input file : XML C:\Documents and Settings\admin\Pulpit\jira\xml.xml <?xml version="1.0" encoding="windows-1250"?> <?xml-stylesheet type="text/xsl" href="layout.xslt"?> <rss version="0.92"> <channel> <title>credit Workflow</title> <link>http://10.200.205.44:8080/secure/issuenavigator.jspa?reset=true&jqlquery=p roject+%3d+cw</link> <description>an XML representation of a search request</description> <language>pl-pl</language> <issue start="0" end="328" total="328"/> <build-info> <version>4.0.1</version> <build-number>471</build-number> <build-date>27-11-2009</build-date> <edition>enterprise</edition> </build-info>

<item> <title>[cw-345] java.lang.outofmemoryerror</title> <link>http://10.200.205.44:8080/browse/cw-345</link> <project id="10002" key="cw">credit Workflow</project> <description>podczas wprowadzania danych (obywatelstwo, PESEL, dokument, numer) pojawia sie blad: = <BR/>, see disable-output-escaping in xslt java.lang.outofmemoryerror For more information, please see the server&apos;s error log for an entry beginning with: Server Exception during PPR, #3.</description> <key id="10608">cw-345</key> <summary>java.lang.outofmemoryerror</summary> <type id="1" iconurl="http://10.200.205.44:8080/images/icons/bug.gif">bug</type> <priority id="2" iconurl="http://10.200.205.44:8080/images/icons/priority_critical.gif">krytyczny</pr iority> <status id="1" iconurl="http://10.200.205.44:8080/images/icons/status_open.gif">open</status> <resolution id="-1">nierozwi¹zane</resolution> <security id="10000">oracle</security> <assignee username="kmichalski">krzysztof Michalski</assignee> <reporter username="jkruszynska">joanna Kruszynska</reporter> <created>fri, 2 Apr 2010 14:37:19 +0200 (CEST)</created> <updated>fri, 2 Apr 2010 14:37:19 +0200 (CEST)</updated> <version> 0.0.7</version> <component>adf</component> <due></due> <votes>0</votes> <attachments> </attachments> <subtasks> </subtasks> <customfields> <customfield id="customfield_10005" <customfieldname>zgłaszający</customfieldname> <customfieldvalue><![cdata[zespó³ testowy]]></customfieldvalue> <customfield id="customfield_10004" <customfieldname>środowisko</customfieldname> <customfieldvalue><![cdata[testowe]]></customfieldvalue>

<customfield id="customfield_10003" <customfieldname>wykryto w</customfieldname> <customfieldvalue><![cdata[testach modu³owych]]></customfieldvalue> <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect"> <customfieldname>formatka</customfieldname> <customfieldvalue><![cdata[wni-001]]></customfieldvalue> </item> </customfields> <item> <title>[cw-344] zmiana w interfejsie</title> <link>http://10.200.205.44:8080/browse/cw-344</link> <project id="10002" key="cw">credit Workflow</project> <description>agnieszka, prosba o zmiane w dokumencie - przyciski &quot;zamykajace&quot; formatke, czyli &quot;zakonczenie negatywne&quot;, &quot;przeslij&quot;, &quot;anuluj&quot; beda na tle jasniejszym, podobnie jak przycisk &quot;zapisz&quot;. beda wizualnie oddzielone od &quot;niezamykajacego&quot; przycisku &quot;zapisz&quot;. Dzieki</description> <key id="10607">cw-344</key> <summary>zmiana w interfejsie</summary> <type id="3" iconurl="http://10.200.205.44:8080/images/icons/task.gif">task</type> <priority id="4" iconurl="http://10.200.205.44:8080/images/icons/priority_minor.gif">średni</pri ority> <status id="1" iconurl="http://10.200.205.44:8080/images/icons/status_open.gif">open</status> <resolution id="-1">nierozwi¹zane</resolution> <security id="10000">oracle</security> <assignee username="amatuszewska">agnieszka Matuszewska</assignee> <reporter username="kkrasowski">kamil Krasowski</reporter> <created>fri, 2 Apr 2010 14:10:42 +0200 (CEST)</created> <updated>fri, 2 Apr 2010 14:10:42 +0200 (CEST)</updated> <version> 0.0.7</version> <due></due> <votes>0</votes> <attachments> </attachments> <subtasks> </subtasks> <customfields> <customfield

id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect"> <customfieldname>formatka</customfieldname> <customfieldvalue><![cdata[war-001]]></customfieldvalue> <customfield id="customfield_10004" <customfieldname>środowisko</customfieldname> <customfieldvalue><![cdata[developerskie]]></customfieldvalue> </item> </customfields> <item> <title>[cw-343] createbmaccount - jaka wartosc dla takiego parametru: AccountCategory</title> <link>http://10.200.205.44:8080/browse/cw-343</link> <project id="10002" key="cw">credit Workflow</project> <description>uruchomilam createbmaccount ale zwrocilo mi status: 2 = Niedopuszczalna kategoria konta nie wiem co wprowadzic w to pole, a w excelu nie mam zadnych wartosci dla Kategorii zakladanego rachunku (wydaje mi sie ze o to chodzi, ale pewna nie jestem) - jest info ze tego brakuje!</description> <key id="10606">cw-343</key> <summary>createbmaccount - jaka wartosc dla takiego parametru: AccountCategory</summary> <type id="1" iconurl="http://10.200.205.44:8080/images/icons/bug.gif">bug</type> <priority id="5" iconurl="http://10.200.205.44:8080/images/icons/priority_trivial.gif">niski</priorit y> <status id="1" iconurl="http://10.200.205.44:8080/images/icons/status_open.gif">open</status> <resolution id="-1">nierozwi¹zane</resolution> <security id="10000">oracle</security> <assignee username="msobieszek">marcin Sobieszek</assignee> <reporter username="mbartnik">martyna Bartnik</reporter> <created>fri, 2 Apr 2010 13:00:11 +0200 (CEST)</created> <updated>fri, 2 Apr 2010 13:00:11 +0200 (CEST)</updated> <component>interfejsy</component> <due></due> <votes>0</votes> <attachments> </attachments> <subtasks> </subtasks> <customfields> <customfield

id="customfield_10005" <customfieldname>zgłaszający</customfieldname> <customfieldvalue><![cdata[zespó³ testowy]]></customfieldvalue> <customfield id="customfield_10004" <customfieldname>środowisko</customfieldname> <customfieldvalue><![cdata[testowe]]></customfieldvalue> <customfield id="customfield_10003" <customfieldname>wykryto w</customfieldname> <customfieldvalue><![cdata[testach modu³owych]]></customfieldvalue> </item> </customfields> <item> <title>[cw-342] Metoda "assignbmaccountcoowner" nie uruchamia się</title> <link>http://10.200.205.44:8080/browse/cw-342</link> <project id="10002" key="cw">credit Workflow</project> <description>maćku, wymieniona w tytule metoda nie uruchamia się, błąd jaki wyskakuje jest w załączniku (tam także kiedy wystąpił problem). Martyna także ma ten sam błąd. Jeszcze zaobserwowaliśmy r&#xf3;żnice: w pliku &quot;coresystem.account.assigncoowner.xsd&quot; jest wymagany atrybut &quot;account_relation&quot; a na konsoli nie jest on oznaczony gwiazdką (w testach dawaliśmy oba atrybuty).</description> <key id="10605">cw-342</key> <summary>metoda "assignbmaccountcoowner" nie uruchamia się</summary> <type id="1" iconurl="http://10.200.205.44:8080/images/icons/bug.gif">bug</type> <priority id="3" iconurl="http://10.200.205.44:8080/images/icons/priority_major.gif">wysoki</priority > <status id="1" iconurl="http://10.200.205.44:8080/images/icons/status_open.gif">open</status> <resolution id="-1">nierozwi¹zane</resolution> <security id="10000">oracle</security> <assignee username="msobieszek">marcin Sobieszek</assignee> <reporter username="ppachla">piotr Pachla</reporter> <created>fri, 2 Apr 2010 12:55:46 +0200 (CEST)</created> <updated>wed, 7 Apr 2010 09:20:50 +0200 (CEST)</updated> <version>0.0.6</version>

<component>interfejsy</component> <due></due> <votes>0</votes> <comments> <comment id="10394" author="msobieszek" created="tue, 6 Apr 2010 09:00:16 +0200 (CEST)" >Piotrek, poprosze o stos wyjatku.</comment> <comment id="10396" author="ppachla" created="wed, 7 Apr 2010 09:11:09 +0200 (CEST)" >Dołączony zrzut ekranu.</comment> <comment id="10397" author="ppachla" created="wed, 7 Apr 2010 09:20:50 +0200 (CEST)" >Dane wejściowe to np: 1. Modulo: 400957 i Relacja: A 2. Modulo: 402405 i Relacja: C</comment> </comments> <attachments> <attachment id="10041" name="assignbmaccountcoowner g1042.jpg" size="119003" author="ppachla" created="wed, 7 Apr 2010 09:10:38 +0200 (CEST)" /> </attachments> <subtasks> </subtasks> <customfields> <customfield id="customfield_10005" <customfieldname>zgłaszający</customfieldname> <customfieldvalue><![cdata[zespó³ testowy]]></customfieldvalue> <customfield id="customfield_10004" <customfieldname>środowisko</customfieldname> <customfieldvalue><![cdata[testowe]]></customfieldvalue> <customfield id="customfield_10003" <customfieldname>wykryto w</customfieldname> <customfieldvalue><![cdata[testach integracyjnych]]></customfieldvalue> </item> </channel> </rss> </customfields>

Input file : XSLT C:\Documents and Settings\admin\Pulpit\jira\layout.xslt <?xml version="1.0" encoding="windows-1250"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <xsl:output method="html"/> <xsl:template match="xml"> <html> <HEAD> </HEAD> <body style="text-align: center; background-color: #eeeeee; "> <xsl:apply-templates/> </body> </html> <xsl:template match="channel"> <center> <TABLE BORDER="1" WIDTH="100%" style="border: 0px dashed black"> <TR style="background-color: silver"><td>title</td><td>description</td><td>summary</td><td>priority</td><td>statu s</td><td>resolution</td><td>assignee</td><td>reporter</td><td>created</td><td>resol ved</td><td>comments1</td><td>comments2</td><td>comments3</td><td>comments4</td><td> comments5</td><td>comments6</td><td>comments7</td><td>comments8</td><td>comments9</t D><TD>comments10</TD></TR> <xsl:for-each select = "item"> <TR> <TD><xsl:value-of select="title"/></td> <TD><xsl:value-of select="translate(description, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" disable-output-escaping = "yes"/></td> <TD><xsl:value-of select="summary"/></td> <TD><xsl:value-of select="priority"/></td> <TD><xsl:value-of select="status"/></td> <TD><xsl:value-of select="resolution"/></td> <TD><xsl:value-of select="assignee"/></td> <TD><xsl:value-of select="reporter"/></td> <TD><xsl:value-of select="created"/></td> <TD><xsl:value-of select="resolved"/><br/></td> <xsl:call-template name="comment"> <xsl:with-param name="cmnt" select="comments/comment[1]" /> </xsl:call-template> Translate == PL/SQL Translate. You can also use other functions described on wc3.org website disable-output-escaping = execute statements like <BR/> (go to new line) instead of writing <BR/> xsl:call-template call subprocedure comment with param cmnt

<xsl:call-template name="comment"> <xsl:with-param name="cmnt" select="comments/comment[2]" /> </xsl:call-template> <xsl:call-template name="comment"> <xsl:with-param name="cmnt" select="comments/comment[3]" /> </xsl:call-template> </TR> </xsl:for-each> </TABLE> </center> <xsl:template name="comment"> <xsl:param name="cmnt"/> <td> <xsl:choose> <xsl:when test="$cmnt"> <b><xsl:value-of select="$cmnt/." disable-output-escaping = "yes"/></b><br/><br/> <xsl:value-of select="$cmnt/@author"/><br/><br/> <xsl:value-of select="$cmnt/@created"/><br/><br/> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </td> [2] = look for second instance of element comment in comments xsl:template procedure called by xsl:call-template. Choose = PL/SQL case of $cmnt reference do parameter of this procedure. = element value test = check whether does element exist <xsl:otherwise> </xsl:otherwise> - set single char (required in order <td> to be inserted) </xsl:stylesheet> Result file Not necessary Xpath simple example <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" > <xsl:output method="xml"/> <xsl:template match="/"> <xsl:copy-of xmlns:v11="http://policja.gov.pl/enterpriseobjectlibrary/common/v1" select="//v11:picture/text()"/> </xsl:stylesheet>

More See also SORT option Look for w3schools free good quality studies Open issues Does not work <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <TD><xsl:value-of select="fn:upper-case(description)" disable-output-escaping = "yes"/></td>