Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

XSL in der Praxis Anwendungsbeispiele für die eXtensible Stylesheet Language Andreas Kühne kuehne@klup.de XML One 2000.

Ähnliche Präsentationen


Präsentation zum Thema: "XSL in der Praxis Anwendungsbeispiele für die eXtensible Stylesheet Language Andreas Kühne kuehne@klup.de XML One 2000."—  Präsentation transkript:

1 XSL in der Praxis Anwendungsbeispiele für die eXtensible Stylesheet Language Andreas Kühne XML One 2000

2 Wozu XSL ? DOM XQL XMI XXL ? XML XUL SAX XLE XPointer

3 XSL-Familie XSL Transformation ( XSLT ) http://www.w3.org/TR/xslt
XML Path Language ( XPath ) Formatting Objects ( FO )

4 Formatting Objects Layout- und Darstellungsinformationen
eng angelehnt an CSS

5 XPath Selektionssprache zur Auswahl von Mengen von Elementen
Navigation innerhalb des XML-Baums Formulierung von Bedingungen Logische Operatoren

6 XSLT Transformationssprache zur Überführung eines XML-Dokumentes in eine andere Struktur / Format Deklarativ, nicht prozedural Regelbasiert

7 XPath Beispiele Pfad : ‘/’ Resultat : Wurzelelement Person Name
Adresse PLZ Ort Strasse

8 XPath Beispiele Pfad : ‘//PLZ’ Resultat : Element mit dem Namen
Person Resultat : Element mit dem Namen ‘PLZ’ irgendwo im Dokument Name Adresse PLZ Ort Strasse

9 XPath Beispiele Pfad : ‘/*/Adresse [ ./Ort=“Köln”]’ Resultat :
Person Resultat : Adress-Element, dessen Kind- Element ‘Ort’ den Wert ‘Köln’ hat Name Adresse PLZ Ort ‘Köln’ Strasse

10 Transformation XSLT Dokument A Dokument B

11 XSLT Stylesheet <xslt:stylesheet
xmlns:xslt=“ xmlns=“ > ... </xslt:stylesheet>

12 XSLT Template <xsl:template match=“/” > <html>
<head> <title>A Stock Order</title> </head> <xsl:apply-templates select=“order”> </html> <xsl:template />

13 XSL Tutorial

14 Einige XSLT Parser Xalan Microsoft XMLParser XSL:P The XML Cover Pages
C++ und Java-Versionen Microsoft XMLParser XSL:P Java mit ECMAScript-Einbettung The XML Cover Pages Übersicht über Parser, Tools, Newsgroups usw.

15 XSLT Editor

16 Parser API Quelle : Xalan-Dokumentation, http://www.apache.org
// Instantiate an XSLTProcessor. org.apache.xalan.xslt.XSLTProcessor processor = org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(); // Create the 3 objects the XSLTProcessor needs // to perform the transformation. org.apache.xalan.xslt.XSLTInputSource xmlSource = new org.apache.xalan.xslt.XSLTInputSource (xmlSourceURL); org.apache.xalan.xslt.XSLTInputSource xslSheet = new org.apache.xalan.xslt.XSLTInputSource (xslURL); org.apache.xalan.xslt.XSLTResultTarget xmlResult = new org.apache.xalan.xslt.XSLTResultTarget (outputURL); // Perform the transformation. processor.process(xmlSource, xslSheet, xmlResult); Quelle : Xalan-Dokumentation,

17 Anwendungsbeispiele Besser als printf Code Generator EAI Infrastruktur
Sprach- und plattformunabhängiges Meldungskonzept Code Generator Testmethoden aus dem Objektmodell erzeugen EAI Infrastruktur Realisierung einer Integrationsarchitektur

18 Besser als printf Meldungen eines C-Programms : printf( “Sie haben %d neue Mails”, nAnzahl ); Ausgabe mittels C++ Streams : cout << “Sie haben “ << nAnzahl << “ neue Mails” << endl; Java-Version : System.out.println( “Sie haben “ + nAnzahl + “ neue Mails” );

19 Printf reicht doch, oder ?
Internationalierung Wie unterstützt man mehrere Sprachen ? Multi-Channel-Fähigkeit Wie nutzt man verschiedene Ausgabemedien (Browser, WAP, Pager, Konsole, … ) ? Mandantenfähigkeit Outsourcing-Dienstleister ?

20 Indirektion mittels XSLT
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl= " <xsl:template match="/message"> Sie haben <xsl:value-of select=“anzahl“/> neue Mails. </xsl:template> </xsl:stylesheet> Transformationsregel <?xml version="1.0"?> <message> <anzahl>3</anzahl> ... </message> Daten-Document “Sie haben 3 neue Mails.”

21 Codefragment : Document erzeugen
... Message msg = new Message( “Mail Info” ); msg.append( “anzahl”, nMails ); for( int i = 0; i < nMails; i++ ) { msg.append( “mail/sender”, mails[ i ].sender() ); msg.append( “mail/subject”, mails[ i ].subject() ); } msg.send(); Codefragment zum Erzeugen einer Meldung, in Java.

22 Beispiel-Document Erzeugtes Daten-Document <?xml version="1.0"?>
<message> <anzahl>3</anzahl> <mail> <sender>Heinz Meier</sender> <subject>Terminbestätigung Donnerstag</subject> </mail> <subject>I love you</subject> <sender>MailMaster</sender> <subject>!! Virenwarnung !!</subject> </message> Erzeugtes Daten-Document

23 Ein Document, verschiedene Medien
Daten- Document wml.xsl html.xsl text.xsl 3 neue Mails !

24 Dimensionen von Ausgabeformaten
WML Medien HTML Sprachen Text Mandanten

25 Codegenerator Metainformationen liegen i. d. R. in einem Objektmodell bereit. Erstellung von Testmethoden ist eine unbeliebte und fehlerträchtige Aufgabe. Generierung von Testmethoden aus dem Objektmodell kann sinnvolle Ergänzung darstellen.

26 XML Metadata Interchange Format (XMI )
Von der OMG standardisiertes Format zur Darstellung Metainformationen ( z.B. Objektmodelle, Use Cases, Sequenzdiagramme ). Breite Unterstützung ( ArgoUML, Rose, TogetherJ ). Tool zur Transformierung *.mdl nach *.xmi bei IBM

27 XML Metadata Interchange Format (XMI )
UML-Meta-Metastruktur. Bekannte Begriffe der UML werden genutzt. Unhandliche DTD ( ca. 500 kBytes )

28 XMI-Modell Package ‚Foundation.Core‘, View ‚Backbone‘

29 Mini-Modell Simple.mdl Simple.mdl xmiToolkit Simple.xmi

30 XMI Document

31 Transformation ‚XMI zu Code‘ (1)
<?xml version='1.0'?> <xsl:stylesheet xmlns:xsl=' <xsl:output method="text" media-type="text/plain"/> <xsl:template match="/"> // Test-Methoden <xsl:apply-templates select="//Foundation.Core.Class </xsl:template> <xsl:template match="Foundation.Core.Class"> <xsl:variable name="className" select="Foundation.Core.ModelElement.name" /> <xsl:apply-templates select=".//Foundation.Core.Operation ]"> <xsl:with-param name="className" select="$className" /> </xsl:apply-templates> Selektion der Klassen

32 Transformation ‚XMI zu Code‘(2)
<xsl:template match="Foundation.Core.Operation"> <xsl:param name="className" /> <xsl:variable name="methodName"><xsl:value-of select="$className" />::<xsl:value-of select="Foundation.Core.ModelElement.name" /></xsl:variable> /* * Test fuer Methode : '<xsl:value-of select="$methodName" />' */ cout << "<xsl:value-of select="$methodName" />() = " << <xsl:value-of select="$methodName" />( <xsl:for-each select=".//Foundation.Core.Parameter and <xsl:variable name="idref" <xsl:variable name="type" select="//Foundation.Data_Types.Primitive <xsl:choose> <xsl:when test='$type="String"'> "TEST" </xsl:when> <xsl:when test='$type="Long"'> 123 <xsl:otherwise> // Fehler, Unerwarteter Typ eines Parameter </xsl:otherwise> </xsl:choose> <xsl:if test="position() != last()">, </xsl:if> </xsl:for-each>) << endl; </xsl:template> </xsl:stylesheet> Selektion der Methoden und Parameter

33 Transformation ‚XMI zu Code‘(3)
// Test-Methoden /* * Test fuer Methode : 'Auto::holeGeschwindigkeit' */ cout << "Auto::holeGeschwindigkeit() = " << Auto::holeGeschwindigkeit( ) << endl; * Test fuer Methode : 'Auto::setzeFhrgstNr' cout << "Auto::setzeFhrgstNr() = " << Auto::setzeFhrgstNr( 123 Erzeugter Code

34 EAI Infrastruktur IT-Abteilungen unter Stress: Data Warehouse
Customer Relationship Management Enterprise Resource Planning Workflow eCommerce Merger / Aquisitions Wartung / Weiterentwicklung von ‘Altlasten’ % Verfügbarkeit ist selbstverständlich

35 Anwendungs- und Schnittstellen-Spaghetti
Down- load file Screen scrape Trans- action Message queue Sockets ORB RPC CICS gateway APPC

36 Die Wartungslücke bei Paketlösungen
bis zum Jahr 2003 werden mindestens 66% aller Anpassungen nur außerhalb der Produkte und Entwicklungstools der Paketanbieter realisiert werden können Strategic Planning Assumption Through 2003, at least 66 percent of packaged-application maintenance activity will be managed outside of package vendors’ applications development tools (0.8 probability). Schnittstellen- Management Metadaten-/Versions- Management Markt- und User- Anforderungen Erweiterung / Migration von Anpassungen Parameter Migration Daten Migration Migrationsunterstützung / -fähigkeit durch den Anbieter Standard Releases 1997 1998 1999 2000 2001 2002 2003 Key Issue: How should users consider integration architecture in their selection of packaged applications? Vendors have come a long way. Ten years ago, the state of the art in release migration was the source code comparison tool and lots of coffee. Today, when vendors are asked about upgrade management, they paint pictures of repositories obligingly flowing from release to release while rippling to the nuance of user customization. Reality is less fluid. While “vanilla” application versions migrate well, user extensions are still painful — particularly when their function overlaps a vendor enhancement. This is particularly troublesome to enterprises when customizations get ahead of the industry “flavors” of packaged applications. Large enterprises are uncovering new categories of release management issues. An enterprise may wish to maintain multiple production instances, each with business-specific variations, yet derive and upgrade all instances from a common, base definition. Vendors’ vision has yet to extend beyond a “one instance for one customer” vision. Only a small number of vendors can support release rollbacks. Action Item: Enterprises should plan to use vendor migration tools to their full capabilities but plan to supplement them with external project and version management tools. Quelle

37 Die Integrationsproblematik verlagert sich
Key Issue Analysis A current and rapidly rising demand for application system interconnectivity must be serviced by an immature, emerging set of integration strategies. Entwicklung der Implementierung neuer Anwendungen nach unterschiedlichen Realisierungsansätzen 100% Integration von Paketlösungen Integration über Architektur “Selbst-gestrickte”, eigene Integrationslösung 1997 1998 1999 2000 2001 2002 2003 Key Issue: How will the implementation of the integration elements of packaged applications evolve? As users set their sights enterprisewide and beyond, the complexity and fragmentation of technology become apparent. Using the integrated packaged application is one way to reduce complexity through common technology. However, vendors oversell and enterprises often wishfully estimate the true scope of package integration. Even the broadest integrated packages have an edge, at which point custom development and interfaces to other packages begin. Application vendors often have a “center of the universe” philosophy, biasing them toward point-to-point integration methods. Because as much as 30 percent of implementation costs can be related to application integration, enterprises should evaluate not only the suitability of the vendor’s single application choice, but also how well the application can contribute to the “city plan” of an enterprise application integration framework. As the process-sharing agenda for enterprises broadens, they will increasingly look for technology that provides leverage against the high cost of labor interface construction. While there will be no panacea, inroads will be made in lowering cost — mostly by vendor architectures that facilitate integration and, to a lesser extent, by business semantic brokers or “processware.” Quelle

38 Warum ist so eine EAI-Infrastruktur / Architektur wichtig?
Liefert eine Anleitung und hilft Geschäftsprozeß- und technische Komplexitäten umzusetzen Führt zu verkürzten Auslieferungszeiten, geringeren Wartungs- und Anpassungsaufwänden Stellt Skalierbarkeit, Flexibilität, Performance und andere wichtige Systemanforderungen sicher Hilft Software-Entwicklungsprojekte in kleinere Einheiten zu zerlegen und Parallelentwicklungen zu koordinieren Minimiert oder verhindert langfristig “big-bang” Integrationsprobleme Spart mittel- und langfristig enorme Kosten

39 Wo ist die Integrationsstrategie ?
Key Issues Wo ist die Integrationsstrategie ? Which style of integration will be most useful to mainstream enterprises: data-centric, object-centric or message-centric? • Will data-centric approaches remain dominant in application integration? Host-basierte Anwendungen Gekaufte Standardpakete, Komplettlösungen eigene, teilweise redundante Datenbasis eigene, teilweise redundante Datenbasis Anwendungen bedingt durch Mergers, Acquisitions und / oder Partner Neue Anwendungen Data-centric approaches reflect the historical importance of data in “data processing.” There are two major data-centric techniques: batch file transfer and direct data integration. These have different characteristics and uses. Batch transfer moves groups of records at a time. Direct data integration implies real-time read or write access to databases or files that are owned by other application systems, using database gateways, remote file systems or other data management middleware. Data-centric approaches account for the majority of all real-world integration today. They can address all three forms of integration (data consistency, multistep processes and composite applications). They are the most traditional, most obvious, best understood and easiest to implement of the integration approaches. However, data-centric integration has inherent limitations which have given rise to an interest in objects and messages for some integration problems. Action Item: Developers must avoid the temptation to attack all integration problems with data-centric approaches. Sometimes they are the best approach, sometimes not.

40 Drei Integrationsansätze gegenübergestellt
Key Issue Drei Integrationsansätze gegenübergestellt How will the demands of application integration affect IS architecture during the next five years? Die Daten-Zentrierte Integration Multistep Process Message-Orientierte Integration (MOI) Composite Application Pattern (CAP) • Mehrere Prozesse • Mehrere Schritte • One-way, asynchrone Interaktionen • im Batch oder sofort, individuelle Datenbereitstellg. • Systeme sind physisch unabhängig • Systeme sind logisch unabhängig • Ein Geschäftsprozeß • im Batch oder sofort, individuelle Daten-bereitstellungen • Systeme sind logisch abhängig • One step • bilaterale, synchrone Interaktionen • Sofortige, individuelle Datenbereitstellung • Systeme sind physisch abhängig Application integration consists of three basic kinds of relationships. The goal of a data consistency pattern (left column above) is to get redundant data stored in multiple systems to “agree on the facts.” Data may be reconciled using infrequent batch runs or using near-real-time, “zero-latency enterprise” (ZLE) transfers of individual updates as soon they are recognized. A multistep process (center column) is the most common form of integration because it addresses so many business needs. A multistep process may involve human intervention and/or re-entering data, or it may be automated and nearly seamless, as in a “straight-through processing” (STP) strategy. In either case, the applications are logically interdependent because each step is driven by the work of another system earlier in the process. Interactive, composite applications (right column) represent the most closely knit integration pattern. They always work in real time (ZLE). Composite applications are rapidly growing in popularity, as enterprises seek to provide more customer-focused marketing and service. A composite application generally appears to be a new Web application to the end user, but behind the scenes, it may invoke one or more mainframe transactions, and/or calls to packaged Unix or NT applications. Action Item: Enterprises must employ a blend of data consistency, multistep and composite application integration to address their business problems. No one form of integration is “right” or “wrong.”

41 Hub ‘n’ Spoke - Architektur
Integrations- Infrastruktur

42 Die Aufgaben der Speiche
Technische Anpassung Ort Betriebssystem Programmiersprache Inhaltliche Anpassung Semantik Format Abstraktion / Spezialisierung Nabe

43 Realisierung der Speiche
1. Umsetzung der Daten in ein Document. 2. Transformation mittels XSLT. 3. Transport der serialisierten, transformierten Daten ( z.B. mit CORBA, RMI, COM+ ). 1 2 3 Nabe

44 Realisierung der Speiche (1)
Abbilden einer Struktur in ein Baum ‘per Hand’ ( siehe ‘msg.append()’ ). Generierung des Adapters aus vorhandenen Modellen. Zugriff auf Daten aus einer JDBC-DB mittels XLE. Extraktion von Daten aus beliebigen Textquellen ( z.B. HTML ) mit JEDI. 1 2 3 Nabe

45 Realisierung der Speiche (2)
Einsatz von XSLT Umsetzung von Inhalten: ‘Wahr’ -> ‘true’ Umbenennung von Knoten und Attributen: ‘Versicherter’ -> ‘Kunde’ Umstrukturierung von Dokumenten: ‘Adresse’ -> ‘Lieferanschrift’ und ‘Rechnungsanschrift’ 1 2 3 Nabe

46 Realisierung der Speiche (3)
Transport durch Standard-Middleware ( z.B. CORBA ) Sprach- und Betriebssystemunabhängigkeit. Transparenter Transportmechanismus. Höherwertige Dienste stehen bereit ( z.B. Security-Service ). Transaktionssicherheit bei Einsatz eines OTS. 1 2 3 Nabe

47 Inkrementelle Geschäftspartnerschaften
Opportunity Gap Potential Vorteile / Vorsprung aufgrund von konsequenter Interenterprise Daten- und Prozeßintegration Lost Opportunity Ohne durchgängige Integrationslösung Inkrementelle Geschäftspartnerschaften

48 Effiziente, leading-edge-
Zweiteiliger Ansatz Effiziente, leading-edge- Lösungen Mainframe Servicequalität Verfügbarkeit Sicherheit Produktivität Time-to-Market Opportunistische System- / Basis- Anwendungen Anwendungen Geringe Einstiegs- gekaufte “Komplettlösung” kosten Langfristige Machbarkeit Verläßlichkeit Quelle

49 XSLT Fazit : Flexibles Werkzeug. Standardisiert durch W3C.
Breite Unterstützung in der Industrie. Open Source Implementierungen. Weitschweifigkeit. Proprietäre Erweiterungs-mechanismen. Bewährungsprobe im Hochlastbereich steht noch aus.

50 Die Entwicklung Die wichtigsten Motoren für EAI und das “flexible Unternehmen” Im neuen Millennium E-Business DataWarehouse, DataMining CRM, Supply-Chain-Mgmt, ERP, Workflow Process Integration Grad der Prozeß- Ausnahmen Hoch Gering Prozeß-Komplexität In der 80iger-90igern Eigene Lösungen Rechnungs- u. Finanzwesen Dokumenten-Mgmt

51 Kritische Erfolgsfaktoren
Anforderungen an das Unternehmens-Management Entwicklung flexibler Geschäftsmodelle Redefinition / Reengineering von Rollen und Funktionen Entwicklung neuer Geschäftsprozesse Anforderungen ans IT-Management Strategie zur schnellen und sicheren Anwendungsintegration (EAI-Strategie) Flexibilität — Build/Buy/Outsource Effizientes Infrastruktur-Management absolute Gewährleistung von Sicherheit, Verfügbarkeit und Datenschutz

52 Mergers&Acquisitions
E-Commerce Virtuelle Unternehmen Kundenspezifische Anforderungen Steigender Wettbewerbsdruck Steigende Markt- segmentierung bedingen E A I Neue Geschäftsfelder, Vertriebskanäle Globalisierung Schnelligkeit Time to Market Outsourcing Partner, Mergers&Acquisitions Interenterprise Application Integration

53 EAI Infrastruktur Enterprise Application Integration ( EAI ) ist die kommende Herausforderung. Notwendigkeit einer umfassenden technischen Interoperabilität. Notwendigkeit der organisatorischen Anpassung an eine gemeinsame Herausforderung.


Herunterladen ppt "XSL in der Praxis Anwendungsbeispiele für die eXtensible Stylesheet Language Andreas Kühne kuehne@klup.de XML One 2000."

Ähnliche Präsentationen


Google-Anzeigen