What is the common theme among Web services, Web Methods, and .NET? It's XML, of course. The world of ERP and enterprise software seems to be going the way of the XML document. Whether you are mapping IDOCS via XML for batch processing or making synchronous XML calls via a Web service, the XML document is here to stay.
At this point, much of the focus for XML has remained on backend, business-to-business transactions. Wouldn't it be great to use XML as a common source for middleware and front-end transactions, as well? I have been asked this question numerous times, so I thought I would throw out one possible medium and suggest a few tool implementations to do so. If you haven't guessed already, I am talking about XML stylesheets or XSLT.
XSLT describes a mechanism for transformation XML documents into other documents formats using a stylesheet. Stylesheets can transform XML documents into a wide variety of plain text document formats, but the most popular is XML to HTML transformation. If your company is already using XML for inter-system communication, XSLT brings that information out to a cohesive user interface via a Web browser. If your company requires a single data source, multiple output solution, then XML and XSLT might be the optimal combination. Here is a quick example:
This is the original XML document: <?xml version="1.0" encoding="UTF-8"?> <ejsap title="EJSAP Title"> <ejsap-data title="EJSAP"> <p>Welcome to Ejsap</p> </ejsap-data> </ejsap> This is the XML Stylesheet: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="https://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" indent="yes"/> <xsl:template match="ejsap"> <html> <head><title><xsl:value-of select="@title"/></title></head> <body> <xsl:apply-templates select="ejsap-data"/> </body> </html> </xsl:template> <xsl:template match="ejsap-data"> <b><xsl:value-of select="@title"/></b> <xsl:apply-templates/> <br/> </xsl:template> </xsl:stylesheet> The output looks like this: ---Web output--- EJSAP Welcome to Ejsap ---End output---
Not terribly exciting, but it shows the division between data and display when using a standard XML data source and a stylesheet. XSLT demonstrates the power of a common data source for multiple outputs within an organization. One of the greatest challenges faced for the SAP middleware developer is access to the vast amount of data stored in SAP. By combining readily available tools such as webMethods with open source XSLT implementations such as Xalan, your company can reap the benefit of XML, regardless of the application tier you are working on. The Apache group provides a great set of Java tools to implement XSLT in your SAP/Java applications. Check out Xalan for more information and downloads. They also have a great links section, here.
Author Austin Sincock is a freelance Java/SAP consultant who contributes regularly to Web and print journals. He can be reached at firstname.lastname@example.org. Check out his upcoming book Enterprise Java for SAP.