<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-536753434200159121</id><updated>2009-10-16T17:52:05.304-07:00</updated><title type='text'>Essential Steps To MS Technologies</title><subtitle type='html'>This site is made only for developer who are doing work on MS Technologies.Please try to share your thoughts &amp; share the topics that you think helpfull to others</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-6934618049777831476</id><published>2009-05-19T00:42:00.001-07:00</published><updated>2009-05-19T00:42:25.784-07:00</updated><title type='text'>test image 2</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_1EZkGmmHBwc/ShJi3ITla1I/AAAAAAAAAvg/GJDeiTR1h2I/s1600-h/2.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5337437207649413970" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 204px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_1EZkGmmHBwc/ShJi3ITla1I/AAAAAAAAAvg/GJDeiTR1h2I/s400/2.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-6934618049777831476?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/6934618049777831476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=6934618049777831476' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/6934618049777831476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/6934618049777831476'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2009/05/test-image-2.html' title='test image 2'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1EZkGmmHBwc/ShJi3ITla1I/AAAAAAAAAvg/GJDeiTR1h2I/s72-c/2.JPG' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-3322840713330623170</id><published>2009-05-19T00:36:00.001-07:00</published><updated>2009-05-19T00:36:26.433-07:00</updated><title type='text'>test Image</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_1EZkGmmHBwc/ShJhdZowaYI/AAAAAAAAAvY/hJfvXYkYQUs/s1600-h/1.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5337435666113390978" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 150px; CURSOR: hand; HEIGHT: 100px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_1EZkGmmHBwc/ShJhdZowaYI/AAAAAAAAAvY/hJfvXYkYQUs/s400/1.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-3322840713330623170?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/3322840713330623170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=3322840713330623170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/3322840713330623170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/3322840713330623170'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2009/05/test-image.html' title='test Image'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1EZkGmmHBwc/ShJhdZowaYI/AAAAAAAAAvY/hJfvXYkYQUs/s72-c/1.JPG' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-3226667702683610063</id><published>2008-03-16T21:51:00.001-07:00</published><updated>2008-03-16T21:51:29.445-07:00</updated><title type='text'>Hello</title><content type='html'>Test Blog&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-3226667702683610063?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/3226667702683610063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=3226667702683610063' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/3226667702683610063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/3226667702683610063'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2008/03/hello.html' title='Hello'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-8223986337086147333</id><published>2008-03-16T21:50:00.001-07:00</published><updated>2008-03-16T21:50:51.478-07:00</updated><title type='text'>Hi</title><content type='html'>Test&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-8223986337086147333?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/8223986337086147333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=8223986337086147333' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/8223986337086147333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/8223986337086147333'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2008/03/hi.html' title='Hi'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-5255288112167966101</id><published>2007-09-08T03:07:00.000-07:00</published><updated>2007-09-08T03:10:17.881-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XSLT'/><title type='text'>XSLT</title><content type='html'>What is XSLT?&lt;br /&gt;XSLT, which stands for eXtensible Stylesheet Language: Transformations, is a language which, according to the very first sentence in the specification (found at http://www.w3.org/TR/xslt), is primarily designed for transforming one XML document into another. However, XSLT is more than capable of transforming XML to HTML and many other text-based formats, so a more general definition might be as follows:&lt;br /&gt;XSLT is a language for transforming the structure of an XML document.&lt;br /&gt;Why should you want to do that? In order to answer this question properly, we first need to remind ourselves why XML has proved such a success and generated so much excitement.&lt;br /&gt;Why Transform XML?&lt;br /&gt;XML is a simple, standard way to interchange structured textual data between computer programs. Part of its success comes because it is also readable and writable by humans,, using nothing more complicated than a text editor, but this doesn't alter the fact that it is primarily intended for communication between software systems. As such, XML satisfies two compelling requirements:&lt;br /&gt;Separating data from presentation. The need to separate information (such as a weather forecast) from details of the way it is to be presented on a particular device. This need is becoming ever more urgent as the range of internet-capable devices grows. Organizations that have invested in creating valuable information sources need to be able to deliver them not only to the traditional PC-based web browser (which itself now comes in many flavors), but also to TV sets and WAP phones, not to mention the continuing need to produce print-on-paper.&lt;br /&gt;Transmitting data between applications. The need to transmit information (such as orders and invoices) from one organization to another without investing in bespoke software integration projects. As electronic commerce gathers pace, the amount of data exchanged between enterprises increases daily and this need becomes ever more urgent.&lt;br /&gt;Of course, these two ways of using XML are not mutually exclusive. An invoice can be presented on the screen as well as being input to a financial application package, and weather forecasts can be summarized, indexed, and aggregated by the recipient instead of being displayed directly. Another of the key benefits of XML is that it unifies the worlds of documents and data, providing a single way of representing structure regardless of whether the information is intended for human or machine consumption. The main point is that, whether the XML data is ultimately used by people or by a software application, it will very rarely be used directly in the form it arrives: it first has to be transformed into something else.&lt;br /&gt;In order to communicate with a human reader, this something else might be a document that can be displayed or printed: for example an HTML file, a PDF file, or even audible sound. Converting XML to HTML for display is probably the most common application of XSLT today, and it is the one I will use in most of the examples in this book. Once you have the data in HTML format, it can be displayed on any browser.&lt;br /&gt;In order to transfer data between different applications we need to be able to transform data from the data model used by one application to the model used in another. To load the data into an application, the required format might be a comma-separated-values file, a SQL script, an HTTP message, or a sequence of calls on a particular programming interface. Alternatively, it might be another XML file using a different vocabulary from the original. As XML-based electronic commerce becomes widespread, so the role of XSLT in data conversion between applications also becomes ever more important. Just because everyone is using XML does not mean the need for data conversion will disappear. There will always be multiple standards in use. For example, the newspaper industry is likely to use different formats for exchanging news articles from the format used in the broadcasting industry. Equally, there will always be a need to do things like extracting an address from a purchase order and adding it to an invoice. So linking up enterprises to do e-commerce will increasingly become a case of defining how to extract and combine data from one set of XML documents to generate another set of XML documents: and XSLT is the ideal tool for the job.&lt;br /&gt;At the end of this chapter we will come back to specific examples of when XSLT should be used to transform XML. For now, I just wanted to establish a feel for the importance and usefulness of transforming XML. Before we move on to discuss XSLT in more detail and have a first look at how it works, let's take a look at an example that clearly demonstrates the variety of formats to which we can transform XML, using XSLT.&lt;br /&gt;An Example: Transforming Music&lt;br /&gt;There is an excellent registry of XML vocabularies and schemas at http://www.xml.org/xmlorg_registry/index.shtml.&lt;br /&gt;If you look there, you will find half a dozen different XML schemas for describing music. These were all invented with different purposes in mind: a markup language used by a publisher for printing sheet music has different requirements from one designed to let you listen to the music from a browser. MusicML, for example, is oriented to displaying music notation graphically; ChordML is designed for encoding the harmonic accompaniment to vocal lyrics; MusicXML is designed to represent musical scores, specifically western musical notation from the 17th century onwards, while the rather more academic Music Markup Language (MML) from the University of Pretoria is designed for serious musicological analysis, embracing Eastern and African as well as Western musical idioms.&lt;br /&gt;So you could use XSLT to process marked-up music in many different ways:&lt;br /&gt;You could use XSLT to convert music from one of these representations to another, for example from MusicXML to MML.&lt;br /&gt;You could use XSLT to convert music from any of these representations into visual music notation, by generating the XML-based vector graphics format SVG.&lt;br /&gt;You could use XSLT to play the music on a synthesizer, by generating a MIDI (Musical Instrument Digital Interface) file.&lt;br /&gt;You could use XSLT to perform a musical transformation, such as transposing the music into a different key.&lt;br /&gt;You could use XSLT to extract the lyrics, into HTML or into a text-only XML document.&lt;br /&gt;As you can see, XSLT is not just for converting XML documents to HTML!&lt;br /&gt;How does XSLT transform XML?&lt;br /&gt;By now you are probably wondering exactly how XSLT goes about processing an XML document in order to convert it into the required output. There are usually two aspects to this process:&lt;br /&gt;The first stage is a structural transformation, in which the data is converted from the structure of the incoming XML document to a structure that reflects the desired output.&lt;br /&gt;The second stage is formatting, in which the new structure is output in the required format such as HTML or PDF.&lt;br /&gt;The second stage covers the ground we discussed in the previous section; the data structure that results from the first stage can be output as HTML, a text file or as XML. HTML output allows the information to be viewed directly in a browser by a human user or be input into any modern word processor. Plain text output allows data to be formatted in the way an existing application can accept, for example comma-separated values or one of the many text-based data interchange formats that were developed before XML arrived on the scene. Finally, XML output allows the data to be supplied to one of the new breed of applications that accepts XML directly. Typically this will use a different vocabulary of XML tags from the original document: for example an XSLT transformation might take the monthly sales figures as its XML input and produce a histogram as its XML output, using the XML-based SVG standard for vector graphics. Or you could use an XSLT transformation to generate VoxML output, for aural rendition of your data.&lt;br /&gt;Links to information about Motorola's VoxML Voice Markup Language can be found at &lt;a href="http://www.oasis-open.org/cover/voxML.html"&gt;http://www.oasis-open.org/cover/voxML.html&lt;/a&gt;&lt;br /&gt;Let's now delve into the first stage, transformation – the stage with which&lt;br /&gt;XSLT is primarily concerned and which makes it possible to provide output in all of these formats. This stage might involve selecting data, aggregating and grouping it, sorting it, or performing arithmetic conversions such as changing centimeters to inches.&lt;br /&gt;So how does this come about? Before the advent of XSLT, you could only process incoming XML documents by writing a custom application. The application wouldn't actually need to parse the raw XML, but it would need to invoke an XML parser, via a defined Application Programming Interface (API), to get information from the document and do something with it. There are two principal APIs for achieving this: the Simple API for XML (SAX) and the Document Object Model (DOM).&lt;br /&gt;The SAX API is an event-based interface in which the parser notifies the application of each piece of information in the document as it is read. If you use the DOM API, then the parser interrogates the document and builds a tree-like object structure in memory. You would then write a custom application (in a procedural language such as C++, Visual Basic, or Java, for example), which could interrogate this tree structure. It would do so by defining a specific sequence of steps to be followed in order to produce the required output. Thus, whatever parser you use, this process has the same principal drawback: every time you want to handle a new kind of XML document, you have to write a new custom program, describing a different sequence of steps, to process the XML.&lt;br /&gt;Both the DOM and the SAX APIs are fully described in the Wrox Press book Professional XML, ISBN 1-861003-11-0.&lt;br /&gt;So how is using XSLT to perform transformations on XML better than writing "custom applications"? Well, the design of XSLT is based on a recognition that these programs are all very similar, and it should therefore be possible to describe what they do using a high-level declarative language rather than writing each program from scratch in C++, Visual Basic, or Java. The required transformation can be expressed as a set of rules. These rules are based on defining what output should be generated when particular patterns occur in the input. The language is declarative, in the sense that you describe the transformation you require, rather than providing a sequence of procedural instructions to achieve it. XSLT describes the required transformation and then relies on the XSLT processor to decide the most efficient way to go about it.&lt;br /&gt;XSLT still relies on an XML parser –  be it a DOM parser or a SAX-compliant one – to convert the XML document into a tree structure. It is the structure of this tree representation of the document that XSLT manipulates, not the document itself. If you are familiar with the DOM, then you will be happy with the idea of treating every item in an XML document (elements, attributes, processing instructions etc.) as a node in a tree. With XSLT we have a high-level language that can navigate around a node tree, select specific nodes and perform complex manipulations on these nodes.&lt;br /&gt;The XSLT tree model is similar in concept to the DOM but it is not the same. The full XSLT processing model is discussed in Chapter 2.&lt;br /&gt;The description of XSLT given thus far (a declarative language that can navigate to and select specific data and then manipulate that data) may strike you as being similar to that of the standard database query language, SQL. Let's take a closer look at this comparison.&lt;br /&gt;XSLT and SQL: an Analogy&lt;br /&gt;I like to think of an analogy with relational databases. In a relational database, the data consists of a set of tables. By themselves, the tables are not much use, the data might as well be stored in flat files in comma-separated values format. The power of a relational database doesn't come from its data structure; it comes from the language that processes the data, SQL. In the same way, XML on its own just defines a data structure. It's a bit richer than the tables of the relational model, but by itself it doesn't actually do anything very useful. It's when we get a high-level language expressly designed to manipulate the data structure that we start to find we've got something interesting on our hands, and for XML data that language is XSLT.&lt;br /&gt;Superficially, SQL and XSLT are very different languages. But if you look below the surface, they actually have a lot in common. For starters, in order to process specific data, be it in a relational database or an XML document, the processing language must incorporate a declarative query syntax for selecting the data that needs to be processed. In SQL, that's the SELECT statement. In XSLT, the equivalent is the XPath expression.&lt;br /&gt;The XPath expression language forms an essential part of XSLT, though it is actually defined in a separate W3C Recommendation (http://www.w3.org/TR/xpath) because it can also be used independently of XSLT (the relationship between XPath and XSLT is discussed further on page 26).&lt;br /&gt;The XPath query syntax is designed to retrieve nodes from an XML document, based on a path through the XML document or the context in which the node appears. It allows access to specific nodes, while preserving the hierarchy and structure of the document. XSLT is then used to manipulate the results of these queries (rearranging selected nodes, constructing new nodes etc).&lt;br /&gt;There are further similarities between XSLT and SQL:&lt;br /&gt;Both languages augment the basic query facilities with useful additions for performing basic arithmetic, string manipulation, and comparison operations.&lt;br /&gt;Both languages supplement the declarative query syntax with semi-procedural facilities for describing the sequence of processing to be carried out, and they also provide hooks to escape into conventional programming languages where the algorithms start to get too complex.&lt;br /&gt;Both languages have an important property called closure, which means that the output has the same data structure as the input. For &lt;a name="closure1"&gt;SQL&lt;/a&gt;&lt;a name="closure1pgref"&gt;&lt;/a&gt;17, this structure is tables, for XSLT it is trees – the tree representation of XML documents. The closure property is extremely valuable because it means operations performed using the language can be combined end-to-end to define bigger more complex operations: you just take the output of one operation and make it the input of the next operation. In SQL you can do this by defining views or subqueries; in XSLT you can do it by passing your data through a series of stylesheets, or (with the new XSLT 1.1 specification, currently a working draft) by capturing the output of one transformation phase as a temporary tree, and using that temporary tree as the input of another transformation phase.&lt;br /&gt;In the real world, of course, XSLT and SQL have to coexist. There are many possible relationships, but typically data will be stored in relational databases and transmitted between systems in XML. The two languages don't fit together as comfortably as one would like, because the data models are so different. But XSLT transformations can play an important role in bridging the divide. A number of database vendors have delivered products that integrate XML and SQL, though there are no standards in this area as yet. Check the vendor's web sites for the latest releases of Microsoft SQL Server 2000, and Oracle 9i.&lt;br /&gt;Before we move on to look at a simple working example of an XSLT transformation, we need to briefly discuss a few of the XSLT processors that are available to effect these transformations.&lt;br /&gt;XSLT Processors&lt;br /&gt;The principal role of an XSLT processor is to apply an XSLT stylesheet to an XML source document and produce a result document. It is important to note that each of these is an application of XML and so the underlying structure of each is a tree. So, in fact, the XSLT processor handles three trees.&lt;br /&gt;There are several XSLT processors to choose from. Here I'll mention three: Saxon, Xalan, and Microsoft MSXML3. All of these can be downloaded free of charge (but do read the licensing conditions).&lt;br /&gt;These three processors and several others are described in detail in the Appendices to this book.&lt;br /&gt;Saxon is an open source XSLT processor developed by the author of this book. It is a Java application, and can be run directly from the command prompt; no web server or browser is required. The Saxon program will transform the XML document to, say, an HTML document, which can then be placed on a web server. In this example, both the browser and web server only deal with the transformed document.&lt;br /&gt;If you are running Windows (95/98/NT/2000) the simplest way to use it is to download Instant Saxon, which is packaged as a Windows executable. You will need to have Java installed, but that will be there already if you have any recent version of Internet Explorer. On non-Windows platforms you will need to install the full Saxon product and follow the instructions that come with it. You can download Instant Saxon for free from http://users.iclway.co.uk/mhkay/saxon/index.html. Saxon will run with any XML parser that implements the SAX2 interface (in its Java form), but it comes with a copy of the Ælfred parser, so you don't need to install one separately.&lt;br /&gt;Xalan is another open source XSLT processor, available from the Apache organization at http://xml.apache.org/. Xalan was originally derived from an IBM product called LotusXSL , but it has since developed an open-source life of its own. Xalan is available in both Java and C++ versions. Like Saxon, Xalan-Java is a Java application that can be run from the command prompt. Xalan too can operate with any SAX2-compliant parser; it comes with a copy of its stable-mate parser, Xerces.&lt;br /&gt;Saxon and Xalan-Java both implement the same Java interface, known as TrAX, which I will describe in Appendix F: this means you can write applications that work with either processor. Both are highly conformant to the XSLT 1.0 specification, so your stylesheets will be fully portable; but they have different capabilities in terms of what they can do beyond the requirements of the standard. Both products are more fully described in Appendices to this book.&lt;br /&gt;Alternatively, you can run XSLT stylesheets actually within Internet Explorer. The production versions of IE5 and IE5.5 are shipped with a processor that handles a Microsoft dialect of XSLT loosely based on an early 1998 working draft of the W3C specification: this language (which I'll call working-draft XSL or WD-xsl) is quite different from the final version, and I strongly recommend you to avoid it. Microsoft now provide a fully-conformant implementation of the final XSLT 1.0 specification, which is known as MSXML3. In due course this will probably be shipped as standard with Internet Explorer 6, but in the meantime you can download it separately from http://msdn.microsoft.com and install it for use with IE5 or IE5.5.&lt;br /&gt;Download and install both the SDK and the run-time package. You should also download and install a program called xmlinst.exe. Run this program to establish MSXML3 as the default XML processor to be used by Internet Explorer (if you don't do this, IE5 will try to use the old WD-xsl processor). The big advantage of Microsoft's technology is that the XSLT processing can take place on the browser.&lt;br /&gt;I've avoided talking about specific products in most of the book, because the information is likely to change quite rapidly. The products that I've described in the Appendices are reasonably stable by now, but new products are constantly appearing. It's best to get the latest status from the web. Some good places to start are:&lt;br /&gt;&lt;a href="http://www.w3.org/Style/XSL"&gt;http://www.w3.org/Style/XSL&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.xslinfo.com/"&gt;http://www.xslinfo.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.xml.com/"&gt;http://www.xml.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.oasis-open.org/cover"&gt;http://www.oasis-open.org/cover&lt;/a&gt;&lt;br /&gt;&lt;a name="helloworld"&gt;An Example Stylesheet&lt;/a&gt;&lt;br /&gt;Now we're ready to take a look at an example of using XSLT to transform a very simple XML document.&lt;br /&gt;Example: A "Hello, world!" XSLT Stylesheet&lt;br /&gt;Kernighan and Ritchie in their classic The C Programming Language originated the idea of presenting a trivial but complete program right at the beginning of the book, and ever since then the "Hello world" program has been an honored tradition. Of course, a complete description of how this example works is not possible until all the concepts have been defined, so if you feel I'm not explaining it fully, don't worry – the explanations will come later.&lt;br /&gt;Input&lt;br /&gt;What kind of transformation would we like to do? Let's try transforming the following XML document:&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;&lt;br /&gt;&lt;?xml-stylesheet type="text/xsl" href="hello.xsl"?&gt;&lt;br /&gt;&lt;greeting&gt;Hello, world!&lt;/greeting&gt;&lt;br /&gt;A simple node-tree-representation of this document would look as follows:&lt;br /&gt;There is one root node per document. The root node in the XSLT model performs the same function as the document node in the DOM model. The XML declaration is not visible to the parser and, therefore, is not included in the tree.&lt;br /&gt;I've deliberately made it easy by including an &lt;?xml-stylesheet?&gt;processing instruction in the source XML file. Many XSLT processors will use this to identify the stylesheet if you don't specify a different stylesheet to use. The href attribute gives the relative URI of the default stylesheet for this document.&lt;br /&gt;Output&lt;br /&gt;Our required output is the following HTML, which will simply change the browser title to "Today's Greeting" and display whatever greeting is in the source XML file:&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;Today's greeting&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;p&gt;Hello, world!&lt;/p&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;XSLT Stylesheet&lt;br /&gt;Without any more ado, here's the XSLT stylesheet hello.xsl to effect the transformation:&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;&lt;br /&gt;&lt;xsl:stylesheet&lt;br /&gt;version="1.0"&lt;br /&gt;xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;&lt;br /&gt;&lt;xsl:template match="/"&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;Today's greeting&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;p&gt;&lt;xsl:value-of select="greeting"&gt;&lt;/p&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/xsl:template&gt;&lt;br /&gt;&lt;/xsl:stylesheet&gt;&lt;br /&gt;Running the Stylesheet&lt;br /&gt;You can run this stylesheet using any of the three processors described in the previous section.&lt;br /&gt;Saxon&lt;br /&gt;With Saxon, the steps (for a Windows platform) are:&lt;br /&gt;Download the Instant Saxon processor&lt;br /&gt;Install the executable saxon.exe in a suitable directory, and make this the current directory&lt;br /&gt;Using Notepad, type the two files above into hello.xml and hello.xsl respectively, within this directory (or get them from the Wrox web site at http://www.wrox.com)&lt;br /&gt;Bring up an MSDOS-style console window (using Start  Programs  MSDOS Prompt on Windows 98 or NT, or look in the Accessories menu under Windows 2000)&lt;br /&gt;Type the following at the command prompt:saxon hello.xml hello.xsl&lt;br /&gt;Admire the HTML displayed on the standard output&lt;br /&gt;If you want to view the output using your browser, simply save the command line output as an HTML file, in the following manner:&lt;br /&gt;saxon hello.xml hello.xsl &gt;hello.html&lt;br /&gt;Because you're using the default stylesheet for this source XML document, you could also write:&lt;br /&gt;saxon -a hello.xml &gt;hello.html&lt;br /&gt;Xalan-Java&lt;br /&gt;The procedure is very similar if you use Xalan-Java. However, Xalan doesn't have a special version packaged for the Windows platform in the way Saxon does, so you'll have to run the application explicitly under Java (you can also do this with Saxon if you use the full version).&lt;br /&gt;You will need to install a Java Virtual Machine. Xalan doesn't support the Microsoft Virtual Machine that comes with Internet Explorer (because it requires features from later versions of Java), so you'll need to do this separately. I usually use Sun's JDK 1.3, which you can get from http://java.sun.com/j2se/1.3/. Installing this is very straightforward, though it's a large download.&lt;br /&gt;Having downloaded Xalan-Java 2 as a .zip file, you need to unpack it into a suitable directory. There are two important files that must be accessible to the Java Virtual Machine. These are xalan.jar (containing the code of the XSLT processor) and xerces.jar (holding the XML parser), both found in the bin directory. To tell the Java VM where to find this file, they must be present in the CLASSPATH environment variable. You can set this variable in your autoexec.bat file, or whatever other script your operating system executes when you log in; on Windows NT and Windows 2000 you set environment variables using the Systemicon on the control panel. An alternative is to enter the classpath as part of the command that invokes the application.&lt;br /&gt;I usually move all the .jar files I need to a directory such as c:\jars and then set the classpath as follows:&lt;br /&gt;SET CLASSPATH=.;c:\jars\xalan.jar;c:\jars\xerces.jar&lt;br /&gt;Note that it is the .jar files themselves that must be on the classpath, not the directory containing them.&lt;br /&gt;The command to run the "hello world" transformation under Xalan is then:&lt;br /&gt;java org.apache.xalan.xslt.Process -in hello.xml -xsl hello.xsl&lt;br /&gt;It should give the same result as Saxon. Because you're using the default stylesheet, you could simplify this to:&lt;br /&gt;java org.apache.xalan.xslt.Process -in hello.xml&lt;br /&gt;If you want to direct the output to a specific file, use the -out option.&lt;br /&gt;MSXML3&lt;br /&gt;Finally, you can run the stylesheet actually within Internet Explorer.&lt;br /&gt;Once you have installed MSXML3 as your default XSLT processor, you should simply be able to double-click on the hello.xml file, which will bring up IE5 and load hello.xml into the browser. IE5 reads the XML file, discovers what stylesheet is needed, loads the stylesheet, executes it to perform the transformation, and displays the resulting HTML. If you don't see the text "Hello, world!" on the screen, but just the XML file, this is because you're using the original WD-xsl interpreter that Microsoft issued with IE5, not the MSXML3 version. If you see the stylesheet displayed, this also indicates that you haven't completed the installation process correctly. Remember to run the xmlinst.exe program.&lt;br /&gt;How it Works&lt;br /&gt;If you've succeeded in running this example, or even if you just want to get on with reading the book, you'll want to know how it works. Let's dissect it:&lt;br /&gt;&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;&lt;br /&gt;This is just the standard XML heading. The interesting point is that an XSLT stylesheet is itself an XML document. I'll have more to say about this later in the chapter. I've used iso-8859-1 character encoding (which is the official name for the character set that Microsoft sometimes calls "ANSI") because in Western Europe and North America it's the character set that most text editors support. If you've got a text editor that supports UTF-8 or some other character encoding, feel free to use that instead.&lt;br /&gt;&lt;xsl:stylesheet&lt;br /&gt;   version="1.0"&gt;&lt;br /&gt;   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&lt;br /&gt;This is the standard XSLT heading. In XML terms it's an element start tag, and it identifies the document as a stylesheet. The xmlns:xsl attribute is an XML Namespace declaration, which indicates that the prefix xsl is going to be used for elements defined in the W3C XSLT specification. XSLT makes extensive use of XML namespaces, and all the element names defined in the standard are prefixed with this namespace to avoid any clash with names used in your source document. The version attribute indicates that the stylesheet is only using features from version 1.0 of the XSLT standard.&lt;br /&gt;Let's move on:&lt;br /&gt;&lt;xsl:template match="/"&gt;&lt;br /&gt;An &lt;xsl:template&gt; element defines a template rule to be triggered when a particular part of the source document is being processed. The attribute match="/" indicates that this particular rule is triggered right at the start of processing the source document. Here «/» is an XPath expression which identifies the root node of the document: an XML document has a hierarchic structure, and in the same way as UNIX uses the special filename «/» to indicate the root of a hierarchic filestore, XPath uses «/» to represent the root of the XML content hierarchy. The DOM model calls this the Document object, but in XPath it is called the root.&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;Today's greeting&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;p&gt;&lt;xsl:value-of select="greeting"&gt;&lt;/p&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;Once this rule is triggered, the body of the template says what output to generate. Most of the template body here is a sequence of HTML elements and text to be copied into the output file. There's one exception: an &lt;xsl:value-of&gt; element, which we recognize as an XSLT instruction because it uses the namespace prefix xsl. This particular instruction copies the value of a node in the source document to the output document. The select attribute of the element specifies the node for which the value should be evaluated. The XPath expression «greeting» means: "find the set of all &lt;greeting&gt; elements that are children of the node that this template rule is currently processing". In this case, this means the &lt;greeting&gt; element that's the outermost element of the source document. The &lt;xsl:value-of&gt; instruction then extracts the text node of this element, and copies it to the output at the relevant place, in other words within the generated &lt;p&gt; element.&lt;br /&gt;All that remains is to finish what we started:&lt;/xsl:template&gt;&lt;br /&gt;&lt;/xsl:stylesheet&gt;&lt;br /&gt;In fact, for a simple stylesheet like the one shown above, you can cut out some of the red tape. Since there is only one template rule, the &lt;xsl:template&gt; element can actually be omitted. The following is a complete, valid stylesheet equivalent to the preceding one:&lt;html xsl:version="1.0"&lt;br /&gt;xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;Today's greeting&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;p&gt;&lt;xsl:value-of select="greeting"&gt;&lt;/p&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;This simplified syntax is designed to make XSLT look familiar to people who have learned to use proprietary template languages which allow you to write a skeleton HTML page with special tags (analogous to &lt;xsl:value-of&gt;) to insert variable data at the appropriate place. But as we'll see, XSLT is much more powerful than that.&lt;br /&gt;Why would you want to place today's greeting in a separate XML file and display it using a stylesheet? One reason is that you might want to show the greeting in different ways depending on the context; for example, it might be shown differently on a different device. In this case you could write a different stylesheet to transform the same source document in a different way. This raises the question of how a stylesheet gets selected at run-time. There is no single answer to this question. As we saw above, Saxon and Xalan have interfaces that allow you to nominate both the stylesheet and the source document to use. The same thing can also be achieved with the Microsoft XSLT product, though it requires you to write an HTML page containing some script code  to control the transformation: the &lt;?xml-stylesheet?&gt; processing instruction which I used in the example above only works if you want to use the same stylesheet every time.&lt;br /&gt;It's time now to take a closer look at the relationship between XSLT and XPath and other XML-related technologies.&lt;br /&gt;The Place of XSLT in the XML Family&lt;br /&gt;XSLT is published by the World Wide Web Consortium (W3C) and fits into the XML family of standards, most of which are also developed by W3C. In this section I will try to explain the sometimes-confusing relationship of XSLT to other related standards and specifications.&lt;br /&gt;XSLT and XSL&lt;br /&gt;XSLT started life as part of a bigger language called XSL (Extensible Stylesheet Language). As the name implies, XSL was (and is) intended to define the formatting and presentation of XML documents for display on screen, on paper, or in the spoken word. As the development of XSL proceeded, it became clear that this was usually a two-stage process; first a structural transformation, in which elements are selected, grouped and reordered, and then a formatting process in which the resulting elements are rendered as ink on paper, or pixels on the screen. It was recognized that these two stages were quite independent, so XSL was split into two parts, XSLT for defining transformations, and "the rest" – which is still officially called XSL, though some people prefer to call it XSL-FO (XSL Formatting Objects) – for the formatting stage.&lt;br /&gt;XSL Formatting is nothing more than another XML vocabulary, in which the objects described are areas of the printed page and their properties. Since this is just another XML vocabulary, XSLT needs no special capabilities to generate this as its output. XSL Formatting is outside the scope of this book. It's a big subject (the draft specification currently available is far longer than XSLT), the standard is not completely finalized, and the products that implement it are still incomplete. What's more, you're far less likely to need it than to need XSLT. XSL Formatting provides wonderful facilities to achieve high-quality typographical output of your documents. However, for most people translating documents into HTML for presentation by a standard browser is quite good enough, and that can be achieved using XSLT alone, or if necessary, by using XSLT in conjunction with Cascading Style Sheets (CSS or CSS2), which I shall return to shortly.&lt;br /&gt;The XSL Formatting specifications, which at the time of writing are at Candidate Recommendation status, can be found at http://www.w3.org/TR/xsl. A Candidate Recommendation is a specification that W3C has published for final comments, which will normally become a formal Recommendation when those comments have been dealt with. The conditions for XSL Formatting Objects to become a full Recommendation also require evidence that all its constructs have been successfully implemented, and that different implementations are interoperable.&lt;br /&gt;XSLT and XPath&lt;a name="relationship"&gt;&lt;/a&gt;&lt;br /&gt;Halfway through the development of XSLT, it was recognized that there was a significant overlap between the expression syntax in XSLT for selecting parts of a document, and the XPointer language being developed for linking from one document to another. To avoid having two separate but overlapping expression languages, the two committees decided to join forces and define a single language, XPath, which would serve both purposes. XPath version 1.0 was published on the same day as XSLT, 16 November 1999.&lt;br /&gt;XPath acts as a sublanguage within an XSLT stylesheet. An XPath expression may be used for numerical calculations or string manipulations, or for testing Boolean conditions, but its most characteristic use (and the one that gives it its name) is to identify parts of the input document to be processed. For example, the following instruction outputs the average price of all the books in the input document:&lt;br /&gt;&lt;xsl:value-of select="sum(//book/@price) div count(//book)"&gt;&lt;br /&gt;Here the &lt;xsl:value-of&gt; element is an instruction defined in the XSLT standard, which causes a value to be written to the output document. The select attribute contains an XPath expression, which calculates the value to be written: specifically, the total of the price attributes on all the &lt;book&gt; elements, divided by the number of &lt;book&gt; elements.&lt;br /&gt;The XPath specification is increasingly taking on a life of its own, separate from XSLT. For example, several DOM implementations (including Microsoft's) allow you to select nodes within a DOM tree structure using a method such as selectNodes(XPath), and such a feature is being considered for the next version of the standard, DOM3. XPath is also used within other W3C specifications including XPointer and XQuery.&lt;br /&gt;The separation of XPath from XSLT works reasonably well, but there are places where the split seems awkward, and there are many cases where it's difficult to know which document to read to find the answer to a particular question. For example, an XPath expression can contain a reference to a variable, but creating the variable and giving it an initial value is the job of XSLT. Another example: XPath expressions can call functions, and there is a range of standard functions defined. Those whose effect is completely freestanding, such as string-length(), are defined in the XPath specification, whereas additional functions whose behavior relies on XSLT definitions, such as key(), are defined in the XSLT specification.&lt;br /&gt;Because the split is awkward, I've written this book as if XSLT+XPath were a single language. For example, all the standard functions are described together in Chapter 7. In the reference sections, I've tried to indicate where each function or other construct is defined in the original standards, but the working assumption is that you are using both languages together and you don't need to know where one stops and the other one takes over. The only downside of this approach is that if you want to use XPath on its own, for example when using the DOM selectNodes() method, then you need to check the description of the function in Chapter 7 to see whether it is part of the XPath core or whether it is an XSLT addition.&lt;br /&gt;XSLT and Internet Explorer 5&lt;br /&gt;Very soon after the first draft proposals for XSL were published, back in 1998, Microsoft shipped a partial implementation as a technology preview for use with IE4. This was subsequently replaced with a rather different implementation when IE5 came out. This second implementation, known as MSXSL, remained in the field essentially unchanged until very recently, and is still being shipped with every copy of IE5 and IE5.5, and also with Windows 2000. Unfortunately, though, Microsoft jumped the gun, and the XSLT standard changed and grew, so that when the XSLT Recommendation version 1.0 was finally published on 16 November 1999, it bore very little resemblance to the initial Microsoft product.&lt;br /&gt;A Recommendation is the most definitive of documents produced by the W3C. It's not technically a standard, because standards can only be published by government-approved standards organizations. But I will often refer to it loosely as "the standard" in this book.&lt;br /&gt;Many of the differences, such as changes of keywords, are very superficial but some run much deeper; for example, changes in the way the equals operator is defined.&lt;br /&gt;So the Microsoft IE5 dialect of XSL, which I refer to as WD-xsl, is also outside the scope of this book. Please don't assume that anything in this book is relevant to the original Microsoft XSL as even where the syntax appears similar to XSLT, the meaning of the construct may be completely different.&lt;br /&gt;You can find information about WD-xsl in the Wrox book XML IE5 Programmer's Reference, ISBN 1-861001-57-6.&lt;br /&gt;As we've already seen, Microsoft's MSXML3 is a full implementation of the XSLT 1.0 specification, but at the time of writing you have to download and install this separately. MSXML3 actually supports both the old WD-xsl dialect and the newer XSLT 1.0 language; it decides which is in use based on the namespace URI of the &lt;xsl:stylesheet&gt; element.&lt;br /&gt;Microsoft has also released a &lt;a name="microsoftconverter"&gt;converter&lt;/a&gt; to upgrade stylesheets from WD-xsl to XSLT 1.0. However, this isn't the end of the story, because, of course, there are millions of copies of IE5 installed that only support the old version. If you want to develop a web site that delivers XML to the browser and relies on the browser interpreting its XSLT stylesheet, you've currently got your work cut out to make sure all your users can handle it. Microsoft do provide a CAB file installer to help with the roll-out of MSXML3 — check the MSDN web site for details.&lt;br /&gt;If you are using Microsoft technology on the server, there is an ISAPI extension called XSLISAPI that allows you to do the transformation in the browser where it's supported, and on the server otherwise. Unless you're in control of the browser configuration, however, server-side transformation of XML to HTML, driven from ASP pages or from Java servlets, is really the only practical option today for a serious project.&lt;br /&gt;There's more information about Microsoft's XML products in Appendix A – but do be aware that it will become out of date very rapidly.&lt;br /&gt;XSLT and XML&lt;br /&gt;XSLT is essentially a tool for transforming XML documents. At the start of this chapter we discussed the reasons why this is important, but now we need to look a little more precisely at the relationship between the two. There are two particular aspects of XML that XSLT interacts with very closely: one is XML Namespaces; the other is the XML Information Set. These are discussed in the following sections.&lt;br /&gt;XML Namespaces&lt;a name="namespacespgref"&gt;&lt;/a&gt;&lt;a name="namespaces"&gt;&lt;/a&gt;28&lt;br /&gt;XSLT is designed on the basis that XML namespaces are an essential part of the XML standard. So when the XSLT standard refers to an XML document, it really means an XML document that also conforms to the XML Namespaces specification, which can be found at http://www.w3.org/TR/&lt;a name="_Hlt479009329"&gt;R&lt;/a&gt;EC-xml-names.&lt;br /&gt;For a full explanation of XML Namespaces, see Chapter 7 of the Wrox Press book Professional XML, ISBN 1-861003-11-0.&lt;br /&gt;Namespaces play an important role in XSLT. Their purpose is to allow you to mix tags from two different vocabularies in the same XML document. For example, in one vocabulary &lt;table&gt; might mean a two-dimensional array of data values, while in another vocabulary &lt;table&gt; refers to a piece of furniture. Here's a quick reminder of how they work:&lt;br /&gt;Namespaces are identified by a Unique Resource Identifier (URI). This can take a number of forms. One form is the familiar URL, for example http://www.wrox.com/namespace. Another form, not fully standardized but being used in some XML vocabularies (see, for example, http://www.biztalk.org) is a URN, for example urn:java:com.icl.saxon. The detailed form of the URI doesn't matter, but it is a good idea to choose one that will be unique. One good way of achieving this is to use the URL of your own web site. But don't let this confuse you into thinking that there must be something on the web site for the URL to point to. The namespace URI is simply a string that you have chosen to be different from other people's namespace URIs; it doesn't need to point to anything.&lt;br /&gt;Since namespace URIs are often rather long and use special characters such as «/», they are not used in full as part of the element and attribute names. Instead, each namespace used in a document can be given a short nickname, and this nickname is used as a prefix of the element and attribute names. It doesn't matter what prefix you choose, because the real name of the element or attribute is determined only by its namespace URI and its local name (the part of the name after the prefix). For example, all my examples use the prefix xsl to refer to the namespace URI http://www.w3.org/1999/XSL/Transform, but you could equally well use the prefix xslt, so long as you use it consistently.&lt;br /&gt;For element names, you can also declare a default namespace URI, which is to be associated with unprefixed element names. The default namespace URI, however, does not apply to unprefixed attribute names.&lt;br /&gt;A namespace prefix is declared using a special pseudo-attribute within any element tag, with the form:&lt;br /&gt;xmlns:prefix = "namespace-URI"&lt;br /&gt;This declares a namespace prefix, which can be used for the name of that element, for its attributes, and for any element or attribute name contained in that element. The default namespace, which is used for elements having no prefix (but not for attributes), is similarly declared using a pseudo-attribute:&lt;br /&gt;xmlns = "namespace-URI"&lt;br /&gt;XSLT can't be used to process an XML document unless it conforms to the XML Namespaces Recommendation. In practice this isn't a problem, because most people are treating XML Namespaces as an intrinsic part of the XML standard, rather than a bolt-on optional extra. It does have certain implications, though. In particular, serious use of Namespaces is virtually incompatible with serious use of Document Type Definitions, because DTDs don't recognize the special significance of prefixes in element names; so a consequence of backing Namespaces is that XSLT provides very little support for DTDs, choosing instead to wait for the replacement facility, XML Schemas.&lt;br /&gt;The XML Information Set&lt;br /&gt;XSLT is designed to work on the information carried by an XML document, not on the raw document itself. This means that, as an XSLT programmer, you are given a tree view of the source document in which some aspects are visible and others are not. For example, you can see the attribute names and values, but you can't see whether the attribute was written in single or double quotes, you can't see what order the attributes were in, and you can't tell whether or not they were written on the same line.&lt;br /&gt;One messy detail is that there have been many attempts to define exactly what constitutes the essential information content of a well-formed XML document, as distinct from its accidental punctuation. All attempts so far have come up with slightly different answers. The most recent, and the most definitive, attempt to provide a common vocabulary for the content of XML documents is the XML Information Set definition (usually called "the infoset"), which may be found at http://www.w3.org/TR/xml-infoset.&lt;br /&gt;Unfortunately this came too late to make all the standards consistent. For example, some treat comments as significant, others not; some treat the choice of namespace prefixes as significant, others take them as irrelevant. I shall describe in Chapter 2 exactly how XSLT (or more accurately, XPath) defines the tree model of XML, and how it differs in finer points of detail from some of the other definitions such as the Document Object Model or DOM.&lt;br /&gt;One piece of jargon you will start hearing more often is the concept of the post-schema-validation infoset or PSVI. This contains the significant information from the source document, augmented with information taken from its XML schema. It therefore allows you to find out not only that the value of an attribute was «17.3», but also that the attribute was described in the schema as a non-negative decimal number. XSLT isn't yet able to use this information, but it features strongly in the published requirements list for the next version, XSLT 2.0.&lt;br /&gt;XSL and &lt;a name="css"&gt;CSS&lt;/a&gt;&lt;br /&gt;Why are there two stylesheet languages, XSL (that is, XSLT plus XSL Formatting Objects) as well as Cascading Style Sheets (CSS and CSS2)?&lt;br /&gt;It's only fair to say that in an ideal world there would be a single language in this role, and that the reason there are two is that no-one has been able to invent something that achieved the simplicity and economy of CSS for doing simple things, combined with the power of XSL for doing more complex things.&lt;br /&gt;CSS (by which I include CSS2, which greatly extends the degree to which you can control the final appearance of the page) is mainly used for rendering HTML, but it can also be used for rendering XML directly, by defining the display characteristics of each XML element. However, it has serious limitations. It cannot reorder the elements in the source document, it cannot add text or images, it cannot decide which elements should be displayed and which omitted, it cannot calculate totals or averages or sequence numbers. In other words, it can only be used when the structure of the source document is already very close to the final display form.&lt;br /&gt;Having said this, CSS is simple to write, and it is very economical in machine resources. It doesn't reorder the document, so it doesn't need to build a tree representation of the document in memory, and it can start displaying the document as soon as the first text is received over the network. Perhaps most important of all, CSS is very simple for HTML authors to write, without any programming skills. In comparison, XSLT is far more powerful, but it also consumes a lot more memory and processor power, as well as training budget.&lt;br /&gt;It's often appropriate to use both tools together. Use XSLT to create a representation of the document that is close to its final form, in that it contains the right text in the right order, and then use CSS to add the finishing touches, by selecting font sizes, colors, and so on. Typically (today) you would do the XSLT processing on the server, and the CSS processing on the client (in the browser), so another advantage of this approach is that you reduce the amount of data sent down the line, which should improve response time for your users as well as postponing the next expensive bandwidth increase.&lt;br /&gt;The History of XSL&lt;br /&gt;&lt;a name="xslhistory"&gt;Like most of the XML family of &lt;/a&gt;standards, XSLT was developed by the World Wide Web Consortium (W3C), a coalition of companies orchestrated by Tim Berners-Lee, the inventor of the web. There is an interesting page on the history of XSL, and styling proposals generally, at http://www.w3.org/Style/History/.&lt;br /&gt;Pre-history&lt;br /&gt;HTML was originally conceived by Berners-Lee as a set of tags to mark the logical structure of a document; headings, paragraphs, links, quotes, code sections, and the like. Soon people wanted more control over how the document looked, they wanted to achieve the same control over the appearance of the delivered publication as they had with printing and paper. So HTML acquired more and more tags and attributes to control presentation; fonts, margins, tables, colors, and all the rest that followed. As it evolved, the documents being published became more and more browser-dependent, and it was seen that the original goals of simplicity and universality were starting to slip away.&lt;br /&gt;The remedy was widely seen as separation of content from presentation. This was not a new concept; it had been well developed through the 1980s in the development of Standard Generalized Markup Language (SGML), whose architecture in turn was influenced by the elaborate (and never implemented) work done in the ISO Open Document Architecture (ODA) standards.&lt;br /&gt;Just as XML was derived as a greatly simplified subset of SGML, so XSLT has its origins in an SGML-based standard called DSSSL (Document Style Semantics and Specification Language). DSSSL (I pronounce it Dissel) was developed primarily to fill the need for a standard device-independent language to define the output rendition of SGML documents, particularly for high-quality typographical presentation. SGML was around for a long time before DSSSL appeared in the early 1990s, but until then the output side had been handled using proprietary and often extremely expensive tools, geared towards driving equally expensive phototypesetters, so that the technology was only really taken up by the big publishing houses.&lt;br /&gt;C. M. Sperberg-McQueen and Robert F. Goldstein presented an influential paper at the WWW '94 conference in Chicago under the title A Manifesto for Adding SGML Intelligence to the World-Wide Web. You can find it at: http://www.ncsa.uiuc.edu/SDG/IT94/Proceedings/Autools/sperberg-mcqueen/sperberg.html.&lt;br /&gt;The authors presented a set of requirements for a stylesheet language, which is as good a statement as any of the aims that the XSL designers were trying to meet. As with other proposals from around that time, the concept of a separate transformation language had not yet appeared, and a great deal of the paper is devoted to the rendition capabilities of the language. There are many formative ideas, however, including the concept of fallback processing to cope with situations where particular features are not available in the current environment.&lt;br /&gt;It is worth quoting some extracts from the paper here:&lt;br /&gt;Ideally, the style sheet language should be declarative, not procedural, and should allow style sheets to exploit the structure of SGML documents to the fullest. Styles must be able to vary with the structural location of the element: paragraphs within notes may be formatted differently from paragraphs in the main text. Styles must be able to vary with the attribute values of the element in question: a quotation of type "display" may need to be formatted differently from a quotation of type "inline". They may even need to vary with the attribute values of other elements: items in numbered lists will look different from items in bulleted lists.&lt;br /&gt;At the same time, the language has to be reasonably easy to interpret in a procedural way: implementing the style sheet language should not become the major challenge in implementing a Web client.&lt;br /&gt;The semantics should be additive: It should be possible for users to create new style sheets by adding new specifications to some existing (possibly standard) style sheet. This should not require copying the entire base style sheet; instead, the user should be able to store locally just the user's own changes to the standard style sheet, and they should be added in at browse time. This is particularly important to support local modifications of standard DTDs.&lt;br /&gt;Syntactically, the style sheet language must be very simple, preferably trivial to parse. One obvious possibility: formulate the style sheet language as an SGML DTD, so that each style sheet will be an SGML document. Since the browser already knows how to parse SGML, no extra effort will be needed.&lt;br /&gt;We recommend strongly that a subset of DSSSL be used to formulate style sheets for use on the World Wide Web; with the completion of the standards work on DSSSL, there is no reason for any community to invent their own style-sheet language from scratch. The full DSSSL standard may well be too demanding to implement in its entirety, but even if that proves true, it provides only an argument for defining a subset of DSSSL that must be supported, not an argument for rolling our own. Unlike home-brew specifications, a subset of a standard comes with an automatically predefined growth path. We expect to work on the formulation of a usable, implementable subset of DSSSL for use in WWW style sheets, and invite all interested parties to join in the effort.&lt;br /&gt;In late 1995, a W3C-sponsored workshop on stylesheet languages was held in Paris. In view of the subsequent role of James Clark as editor of the XSLT Recommendation, it is interesting to read the notes of his contribution on the goals of DSSSL, which can be found at http://www.w3.org/Style/951106_Workshop/report1.html#clark.&lt;br /&gt;What follows is a few selected paragraphs from these notes:&lt;br /&gt;DSSSL contains both a transformation language and a formatting language. Originally the transformation was needed to make certain kinds of styles possible (such as tables of contents). The query language now takes care of that, but the transformation language survives because it is useful in its own right.&lt;br /&gt;Both simple and complex designs should be possible, and the styles should be suitable for batch formatting as well as interactive applications. Existing systems should be able to support DSSSL with only minimal changes (a DSSSL parser is obviously needed).&lt;br /&gt;The language is strictly declarative, which is achieved by adopting a functional subset of Scheme. Interactive style sheet editors must be possible.&lt;br /&gt;A DSSSL style sheet very precisely describes a function from SGML to a flow object tree. It allows partial style sheets to be combined ('cascaded' as in CSS): some rule may override some other rule, based on implicit and explicit priorities, but there is no blending between conflicting styles.&lt;a name="dssslpgref"&gt;&lt;/a&gt;&lt;a name="dsssl"&gt;&lt;/a&gt;33&lt;br /&gt;James Clark closed his talk with the remark:&lt;br /&gt;Creating a good, extensible style language is hard!&lt;br /&gt;One suspects that the effort of editing the XSLT Recommendation didn't cause him to change his mind.&lt;br /&gt;The First XSL Proposal&lt;br /&gt;Following these early discussions, the W3C set up a formal activity to create a stylesheet language proposal. The remit for this group specified that it should be based on DSSSL.&lt;br /&gt;As an output of this activity came the first formal proposal for XSL, dated 21 August 1997. It can be found at http://www.w3.org/TR/NOTE-XSL.html.&lt;br /&gt;There are eleven authors listed. They include five from Microsoft, three from Inso Corporation, plus Paul Grosso of ArborText, James Clark (who works for himself), and Henry Thompson of the University of Edinburgh.&lt;br /&gt;The section describing the purpose of the language is worth reading:&lt;br /&gt;XSL is a stylesheet language designed for the Web community. It provides functionality beyond CSS (e.g. element reordering). We expect that CSS will be used to display simply-structured XML documents and XSL will be used where more powerful formatting capabilities are required or for formatting highly structured information such as XML structured data or XML documents that contain structured data.&lt;br /&gt;Web authors create content at three different levels of sophistication:&lt;br /&gt;   markup: relies solely on a declarative syntax&lt;br /&gt;   script: additionally uses code "snippets" for more complex behaviors&lt;br /&gt;   program: uses a full programming language&lt;br /&gt;XSL is intended to be accessible to the "markup" level user by providing a declarative solution to most data description and rendering requirements. Less common tasks are accommodated through a graceful escape to a familiar scripting environment. This approach is familiar to the Web publishing community as it is modeled after the HTML/JavaScript environment.&lt;br /&gt;The powerful capabilities provided by XSL allow:&lt;br /&gt;   formatting of source elements based on ancestry/descendency, position, and uniqueness&lt;br /&gt;   the creation of formatting constructs including generated text and graphics&lt;br /&gt;   the definition of reusable formatting macros&lt;br /&gt;   writing-direction independent stylesheets&lt;br /&gt;   extensible set of formatting objects&lt;br /&gt;The authors then explained carefully why they had felt it necessary to diverge from DSSSL, and described why a separate language from CSS (Cascading Style Sheets) was thought necessary.&lt;br /&gt;They then stated some design principles:&lt;br /&gt;XSL should be straightforwardly usable over the Internet.&lt;br /&gt;XSL should be expressed in XML syntax.&lt;br /&gt;XSL should provide a declarative language to do all common formatting tasks.&lt;br /&gt;XSL should provide an "escape" into a scripting language to accommodate more sophisticated formatting tasks and to allow for extensibility and completeness.&lt;br /&gt;XSL will be a subset of DSSSL with the proposed amendment. As XSL was no longer a subset of DSSSL, they cannily proposed amending DSSSL so it would become a superset of XSL.&lt;br /&gt;A mechanical mapping of a CSS stylesheet into an XSL stylesheet should be possible.&lt;br /&gt;XSL should be informed by user experience with the FOSI stylesheet language.&lt;br /&gt;The number of optional features in XSL should be kept to a minimum.&lt;br /&gt;XSL stylesheets should be human-legible and reasonably clear.&lt;br /&gt;The XSL design should be prepared quickly.&lt;br /&gt;XSL stylesheets shall be easy to create.&lt;br /&gt;Terseness in XSL markup is of minimal importance.&lt;br /&gt;As a requirements statement, this doesn't rank among the best. It doesn't read like the kind of list you get when you talk to users and find out what they need. It's much more the kind of list designers write when they know what they want to produce, including a few political concessions to the people who might raise objections. But if you want to understand why XSLT became the language it did, this list is certainly evidence of the thinking.&lt;br /&gt;The language described in this first proposal contains many of the key concepts of XSLT as it finally emerged, but the syntax is virtually unrecognizable. It was already clear that the language should be based on templates that handled nodes in the source document matching a defined pattern, and that the language should be free of side-effects, to allow "progressive rendering and handling of large documents". I'll explore the significance of this requirement in more detail on page 37, and discuss its implications on the way stylesheets are designed in Chapter 9. The basic idea is that if a stylesheet is expressed as a collection of completely independent operations, each of which has no external effect other than generating part of the output from its input (for example, it cannot update global variables), then it becomes possible to generate any part of the output independently if that particular part of the input changes. Whether the XSLT language actually achieves this objective is still an open question.&lt;br /&gt;Microsoft shipped their first technology preview five months after this proposal appeared, in January 1998.&lt;br /&gt;To enable W3C to make an assessment of the proposal, Norman Walsh produced a requirements summary, which was published in May 1998. It is available at http://www.w3.org/TR/WD-XSLReq.&lt;br /&gt;The bulk of his paper is given over to a long list of the typographical features that the language should support, following the tradition both before and since that the formatting side of the language gets a lot more column inches than the transformation side. But as XSLT fans that need not worry us because the success of standards has always been inversely proportional to their length.&lt;br /&gt;What Walsh has to say on the transformation aspects of the language is particularly terse, and although he clearly had reasons for thinking these features were necessary, it's a shame that he doesn't tell us why he put these in and left others, such as sorting, grouping, and totaling, out:&lt;br /&gt;Ancestors, children, siblings, attributes, content, disjunctions, negation, enumerations, computed select based upon arbitrary query expressions.&lt;br /&gt;Arithmetic Expressions; arithmetic, simple boolean comparisons, boolean logic, substrings, string concatenation.&lt;br /&gt;Data Types: Scalar types, units of measure, Flow Objects, XML Objects.&lt;br /&gt;Side effects: No global side effects.&lt;br /&gt;Standard Procedures: The expression language should have a set of procedures that are built in to the XSL language. These are still to be identified.&lt;br /&gt;User Defined Functions: For reuse. Parameterized, but not recursive.&lt;br /&gt;Following this activity, the first Working Draft of XSL (not to be confused with the Proposal) was published on 18 August 1998, and the language started to take shape, gradually converging on the final form it took in the 16 November 1999 Recommendation through a series of Working Drafts, each of which made radical changes, but kept the original design principles intact.&lt;br /&gt;The XSLT 1.0 Recommendation is still the current version at the time of writing, and the one to which most current products conform, although a working draft of XSLT 1.1 was published on December 12th, 2000. I've included the new features of XSLT 1.1 in this book, because they are already starting to appear in some products; but I've flagged them as XSLT 1.1 features to warn you that you won't find them in every product. In most cases, however, these features are based on extensions that many vendors provided in their XSLT 1.0 products, so you are likely to find something similar.&lt;br /&gt;So let's look now at the essential characteristics of XSLT as a language.&lt;br /&gt;XSLT as a Language&lt;br /&gt;What are the most significant characteristics of XSLT as a language, which distinguish it from other languages? In this section I shall pick three of the most striking features: the fact that it is written in XML syntax, the fact that it is a language free of side-effects, and the fact that processing is described as a set of independent pattern-matching rules.&lt;br /&gt;Use of XML Syntax&lt;br /&gt;As we've seen, the use of SGML syntax for stylesheets was proposed as long ago as 1994, and it seems that this idea gradually became the accepted wisdom. It's difficult to trace exactly what the overriding arguments were, and when you find yourself writing something like:&lt;xsl:variable name="y"&gt;&lt;br /&gt;&lt;xsl:call-template name="f"&gt;&lt;br /&gt;&lt;xsl:with-param name="x"&gt;&lt;br /&gt;&lt;/xsl:call-template&gt;&lt;br /&gt;&lt;/xsl:variable&gt;&lt;br /&gt;to express what in other languages would be written as «y=f(x); », then you may find yourself wondering how such a decision came to be made.&lt;br /&gt;In fact, it could have been worse: in the very early drafts, the syntax for writing what are now XPath expressions was also expressed in XML, so instead of writing select="book/author/first-name" you had to write something along the lines of:&lt;select&gt;&lt;br /&gt;&lt;path&gt;&lt;br /&gt;&lt;element type="book"&gt;&lt;br /&gt;&lt;element type="author"&gt;&lt;br /&gt;&lt;element type="first-name"&gt;&lt;br /&gt;&lt;/path&gt;&lt;br /&gt;&lt;/select&gt;&lt;br /&gt;The most obvious arguments for expressing XSLT stylesheets in XML are perhaps:&lt;br /&gt;There is already an XML parser in the browser, so it keeps the footprint small if this can be re-used.&lt;br /&gt;Everyone had got fed up with the syntactic inconsistencies between HTML/XML and CSS, and didn't want the same thing to happen again.&lt;br /&gt;The Lisp-like syntax of DSSSL was widely seen as a barrier to its adoption; better to have a syntax that was already familiar in the target community.&lt;br /&gt;Many existing popular template languages (including simple ASP and JSP pages) are expressed as an outline of the output document with embedded instructions, so this is a familiar concept.&lt;br /&gt;All the lexical apparatus is reusable, for example Unicode support, character and entity references, whitespace handling, namespaces.&lt;br /&gt;It's occasionally useful to have a stylesheet as the input or output of a transformation (witness the Microsoft XSL converter as an example), so it's a benefit if a stylesheet can read and write other stylesheets.&lt;br /&gt;Providing visual development tools easily solves the inconvenience of having to type lots of angle brackets. (Such tools are starting to become available, and I've described some of them in Appendix E.)&lt;br /&gt;Like it or not, the XML-based syntax is now an intrinsic feature of the language that has both benefits and drawbacks. It does require a lot of typing, but in the end, the number of keystrokes has very little bearing on the ease or difficulty of solving particular transformation problems.&lt;br /&gt;&lt;a name="nosideeffects"&gt;&lt;/a&gt;No Side-effects&lt;br /&gt;The idea that XSL should be a declarative language free of side-effects appears repeatedly in the early statements about the goals and design principles of the language, but no-one ever seems to explain why: what would be the user benefit?&lt;br /&gt;A function or procedure in a programming language is said to have side-effects if it makes changes to its environment; for example, if it can update a global variable that another function or procedure can read, or if it can write messages to a log file, or prompt the user. If functions have side-effects, it becomes important to call them the right number of times and in the correct order. Functions that have no side-effects (sometimes called pure functions) can be called any number of times and in any order. It doesn't matter how many times you evaluate the area of a triangle, you will always get the same answer; but if the function to calculate the area has a side-effect such as changing the size of the triangle, or if you don't know whether it has side-effects or not, then it becomes important to call it once only.&lt;br /&gt;I expand further on this concept in the section on Computational Stylesheets in Chapter 9, page &lt;a name="CompStylepgref"&gt;&lt;/a&gt;608.&lt;br /&gt;It is possible to find hints at the reason why this was considered desirable in the statements that the language should be equally suitable for batch or interactive use, and that it should be capable of progressive rendering. There is a concern that when you download a large XML document, you won't be able to see anything on your screen until the last byte has been received from the server. Equally, if a small change were made to the XML document, it would be nice to be able to determine the change needed to the screen display, without recalculating the whole thing from scratch. If a language has side effects then the order of execution of the statements in the language has to be defined, or the final result becomes unpredictable. Without side-effects, the statements can be executed in any order, which means it is possible, in principle, to process the parts of a stylesheet selectively and independently.&lt;br /&gt;Whether XSLT has actually achieved these goals is somewhat debatable. Certainly, determining which parts of the output document are affected by a small change to one part of the input document is not easy, given the flexibility of the expressions and patterns that are now permitted in the language. Equally, all existing XSLT processors require the whole document to be loaded into memory. However, it would be a mistake to expect too much too soon. When E. F. Codd published the relational calculus in 1970, he made the claim that a declarative language was desirable because it was possible to optimize it, which was not possible with the navigational data access languages in use at the time. In fact it took another fifteen years before relational optimization techniques (and, to be fair, the price of hardware) reached the point where large relational databases were commercially viable. But in the end he was proved right, and the hope is that the same principle will also eventually deliver similar benefits in the area of transformation and styling languages.&lt;br /&gt;Of course there will always be some transformations where the whole document needs to be available before you can produce any output; examples are where the stylesheet sorts the data, or where it starts with a table of contents. But there are many other transformations where the order of the output directly reflects the order of the input, and progressive rendering should be possible in such cases. At the time of writing, we are starting to see the first signs that implementors are exploiting this capability: Xalan-Java 2, for example, runs a transformation thread in parallel with the parsing thread, so the transformer can produce output before the parser has finished, and MSXML3 (from the evidence of its API) seems to be designed on a similar principle.  The Stylus Studio debugging tool, which is described in Appendix  E, tracks the dependencies between parts of the output document and the template rules that were used to generate them, so one can start to see the potential to regenerate the output selectively when small changes are made.&lt;br /&gt;What being side-effect free means in practice is that you cannot update the value of a variable. This restriction is something you may find very frustrating at first, and a big price to pay for these rather remote benefits. But as you get the feel of the language and learn to think about using it the way it was designed to be used, rather than the way you are familiar with from other languages, you will find you stop thinking about this as a restriction. In fact, one of the benefits is that it eliminates a whole class of bugs from your code! I shall come back to this subject in Chapter 9, where I outline some of the common design patterns for XSLT stylesheets, and in particular, describe how to use recursive code to handle situations where in the past you would probably have used updateable variables to keep track of the current state.&lt;br /&gt;Rule-based&lt;br /&gt;The dominant feature of a typical XSLT stylesheet is that it consists of a sequence of template rules, each of which describes how a particular element type or other construct should be processed. The rules are not arranged in any particular order; they don't have to match the order of the input or the order of the output, and in fact there are very few clues as to what ordering or nesting of elements the stylesheet author expects to encounter in the source document. It is this that makes XSLT a declarative language, because you specify what output should be produced when particular patterns occur in the input, as distinct from a procedural program where you have to say what tasks to perform in what order.&lt;br /&gt;This rule-based structure is very like CSS, but with the major difference that both the patterns (the description of which nodes a rule applies to) and the actions (the description of what happens when the rule is matched) are much richer in functionality.&lt;br /&gt;Example: Displaying a Poem&lt;br /&gt;Let's see how we can use the rule-based approach to format a poem. Again, we haven't introduced all the concepts yet, so I won't try to explain every detail of how this works, but it's useful to see what the template rules actually look like in practice.&lt;br /&gt;Input&lt;br /&gt;Let's take this poem as our XML source. The source file is called poem.xml, and the stylesheet is poem.xsl.&lt;br /&gt;Collapse&lt;poem&gt;&lt;br /&gt;&lt;author&gt;Rupert Brooke&lt;/author&gt;&lt;br /&gt;&lt;date&gt;1912&lt;/date&gt;&lt;br /&gt;&lt;title&gt;Song&lt;/title&gt;&lt;br /&gt;&lt;stanza&gt;&lt;br /&gt;&lt;line&gt;And suddenly the wind comes soft,&lt;/line&gt;&lt;br /&gt;&lt;line&gt;And Spring is here again;&lt;/line&gt;&lt;br /&gt;&lt;line&gt;And the hawthorn quickens with buds of green&lt;/line&gt;&lt;br /&gt;&lt;line&gt;And my heart with buds of pain.&lt;/line&gt;&lt;br /&gt;&lt;/stanza&gt;&lt;br /&gt;&lt;stanza&gt;&lt;br /&gt;&lt;line&gt;My heart all Winter lay so numb,&lt;/line&gt;&lt;br /&gt;&lt;line&gt;The earth so dead and frore,&lt;/line&gt;&lt;br /&gt;&lt;line&gt;That I never thought the Spring would come again&lt;/line&gt;&lt;br /&gt;&lt;line&gt;Or my heart wake any more.&lt;/line&gt;&lt;br /&gt;&lt;/stanza&gt;&lt;br /&gt;&lt;stanza&gt;&lt;br /&gt;&lt;line&gt;But Winter's broken and earth has woken,&lt;/line&gt;&lt;br /&gt;&lt;line&gt;And the small birds cry again;&lt;/line&gt;&lt;br /&gt;&lt;line&gt;And the hawthorn hedge puts forth its buds,&lt;/line&gt;&lt;br /&gt;&lt;line&gt;And my heart puts forth its pain.&lt;/line&gt;&lt;br /&gt;&lt;/stanza&gt;&lt;br /&gt;&lt;/poem&gt;&lt;br /&gt;Output&lt;br /&gt;We'll write a stylesheet such that this document appears in the browser as shown below:&lt;br /&gt;Stylesheet&lt;br /&gt;It starts with the standard header:&lt;xsl:stylesheet&lt;br /&gt;xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&lt;br /&gt;version="1.0"&gt;&lt;br /&gt;Now we'll write one template rule for each element type in the source document. The rule for the &lt;poem&gt; element creates the skeleton of the HTML output, defining the ordering of the elements in the output (which doesn't have to be the same as the input order). The &lt;xsl:value-of&gt;instruction inserts the value of the selected element at this point in the output. The &lt;xsl:apply-templates&gt;instructions cause the selected child elements to be processed, each  using its own template rule.&lt;xsl:template match="poem"&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;&lt;xsl:value-of select="title"&gt;&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;xsl:apply-templates select="title"&gt;&lt;br /&gt;&lt;xsl:apply-templates select="author"&gt;&lt;br /&gt;&lt;xsl:apply-templates select="stanza"&gt;&lt;br /&gt;&lt;xsl:apply-templates select="date"&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/xsl:template&gt;&lt;br /&gt;The template rules for the &lt;title&gt;, &lt;author&gt;, and &lt;date&gt; elements are very simple: they take the content of the element (denoted by «select="."»), and surround it within appropriate HTML tags to define its display style:&lt;xsl:template match="title"&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;h1&gt;&lt;xsl:value-of select="."&gt;&lt;/h1&gt;&lt;/div&gt;&lt;br /&gt;&lt;/xsl:template&gt;&lt;br /&gt;&lt;xsl:template match="author"&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;h2&gt;By &lt;xsl:value-of select="."&gt;&lt;/h2&gt;&lt;/div&gt;&lt;br /&gt;&lt;/xsl:template&gt;&lt;br /&gt;&lt;xsl:template match="date"&gt;&lt;br /&gt;&lt;p&gt;&lt;i&gt;&lt;xsl:value-of select="."&gt;&lt;/i&gt;&lt;/p&gt;&lt;br /&gt;&lt;/xsl:template&gt;&lt;br /&gt;The template rule for the &lt;stanza&gt; element puts each stanza into an HTML paragraph, and then invokes processing of the lines within the stanza, as defined by the template rule for lines:&lt;xsl:template match="stanza"&gt;&lt;br /&gt;&lt;p&gt;&lt;xsl:apply-templates select="line"&gt;&lt;/p&gt;&lt;br /&gt;&lt;/xsl:template&gt;&lt;br /&gt;The rule for &lt;line&gt; elements is a little more complex: if the position of the line within the stanza is an even number, it precedes the line with two non-breaking-space characters (&amp;#160;). The &lt;xsl:if&gt; instruction tests a boolean condition, which in this case calls the position() function to determine the relative position of the current line. It then outputs the contents of the line, followed by an empty HTML &lt;br /&gt; element to end the line.&lt;xsl:template match="line"&gt;&lt;br /&gt;&lt;xsl:if test="position() mod 2 = 0"&gt;&amp;#160;&amp;#160;&lt;/xsl:if&gt;&lt;br /&gt;&lt;xsl:value-of select="."&gt;&lt;br/&gt;&lt;br /&gt;&lt;/xsl:template&gt;&lt;br /&gt;And to finish off, we close the &lt;xsl:stylesheet&gt; element:&lt;/xsl:stylesheet&gt;&lt;br /&gt;Although template rules are a characteristic feature of the XSLT language, we'll see that this is not the only way of writing a stylesheet. In Chapter 9, I will describe four different design patterns for XSLT stylesheets, only one of which makes extensive use of template rules. In fact, the Hello World stylesheet I presented earlier in this chapter doesn't make any real use of template rules: it fits into the design pattern I call fill-in-the-blanks, because the stylesheet essentially contains the fixed part of the output with embedded instructions saying where to get the data to put in the variable parts.&lt;br /&gt;Beyond XSLT 1.0&lt;br /&gt;I've talked about where XSLT 1.0 came from, but where is it going next?&lt;br /&gt;After XSLT 1.0 was published, the XSL Working Group responsible for the language decided to split the requirements for enhancements into two categories; XSLT 1.1 would standardize a small number of urgent features that vendors had already found it necessary to add to their products as extensions, while XSLT 2.0 would handle the more strategic requirements that needed further research.&lt;br /&gt;XSLT 1.1&lt;br /&gt;A working draft of XSLT 1.1 was published on December 12th 2000. It describes four enhancements to the XSLT 1.0 specification:&lt;br /&gt;Multiple output documents: an &lt;xsl:document&gt; instruction, modeled on extensions provided initially in Saxon and subsequently in other products including xt, Xalan and Oracle, allowing a source document to be split into multiple output documents. (All these products are described in the appendices to this book.)&lt;br /&gt;Temporary trees: the ability to treat a tree created by one phase of processing as input to a subsequent phase of processing. This enhancement was modeled on the node-set() extension function introduced first in xt and subsequently copied in other products.&lt;br /&gt;Standard bindings to extension functions written in Java and ECMAScript. XSLT 1.0 allowed a stylesheet to call external functions, but did not say how such functions should be written, with the result that extension functions written for Xalan would not work with xt or Saxon, or vice versa. XSLT 1.1 defined a general framework for binding extension functions written in any language, with specific mappings for Java and ECMAScript (the official name for JavaScript).&lt;br /&gt;Support for the xml:base construct, a late addition to the XML core standards, which allows an XML document to specify the Base URI that should be used to resolve any relative URIs contained within the document.&lt;br /&gt;At the time of writing, XSLT 1.1 is still a working draft, and there is no official statement about when it is likely to be finalized. There have been suggestions that it would be a good idea to explore in more depth the implications of the XSLT 2.0 requirements before freezing the XSLT 1.1 spec, to avoid constraining the way the XSLT 2.0 requirements are met. One can also speculate that some vendors feel the market is still only really beginning to take XSLT 1.0 on board, and that in reality users want stability more than they want enhancements.&lt;br /&gt;Despite this, we've decided to go ahead and include definitions of XSLT 1.1 facilities in this book. In doing this, we're taking a calculated gamble that the spec will be ratified in very similar form to its published draft, and that it will be implemented in products during the course of the year (2001) – there are signs that is already starting to happen.  Meanwhile, we've taken care to flag XSLT 1.1 enhancements for what they are, so that you can check the specifications in this book against the latest W3C recommendations and the facilities offered by your chosen product before using them.&lt;br /&gt;As we went to press, the W3C had decided that XSLT 1.1 would not be progressed further than working draft stage, but would instead be used as a baseline for developing XSLT 2 (see overleaf)&lt;br /&gt;Throughout this book, references to "the XSLT 1.1 working draft" mean the draft dated December 12th 2000.&lt;br /&gt;XSLT 2.0 and XPath 2.0&lt;br /&gt;The W3C XSL Working Group, working closely with other working groups, published the requirements for XSLT 2.0 and XPath 2.0 on 14 February 2001; you can find the documents at the following URLs:&lt;br /&gt;http://www.w3.org/TR/xslt20req&lt;br /&gt;http://www.w3.org/TR/xpath20req&lt;br /&gt;The reason W3C working groups publish requirements documents is to try and get user input into the standardization process, so it would be a mistake to regard these lists of proposed enhancements as definitive. Nevertheless, they give a good indication of the thinking. Broadly, the requirements fall into three categories:&lt;br /&gt;Features that are obviously missing from the current standards and that would make users' lives much easier; for example, facilities for grouping related nodes, extra string-handling and numeric functions, and the ability to read text files as well as XML documents.&lt;br /&gt;Addition of features developed by the XML Query working group. XQuery is a specification for an SQL-like language to query a collection of XML documents and return the results, also as an XML document. The first public working draft was released on 15 February 2001 (see http://www.w3.org/TR/2001/WD-xquery-20010215/), but it is based on ideas from a number of previous proposals, notably a language called Quilt, the work of Don Chamberlin, Jonathan Robie, and Daniela Florescu. Although XQuery is designed for use in a different context, there are many overlaps in functionality with XSLT and XPath. W3C likes to keep its different standards as coherent as possible, and there are many features in the proposed XQuery specification which could usefully be added to the XPath specification to keep them in step with each other. There's a heavy dose of compromise involved here, on both sides, because some of the improvements the XML Query group has identified look great in theory, but are difficult to retrofit into a language that is already in widespread use.&lt;br /&gt;Features designed to exploit and integrate with XML Schema. The W3C XML Schema specification is now at an advanced stage (it became a Candidate Recommendation on 20 October 2000), and implementations are starting to appear in products. The schema acts as a replacement for the DTD, giving a much richer way of specifying the data types of the elements and attributes that may appear in a document. The thinking is that if the schema specifies that a particular element contains a number or a date (for example), then it ought to be possible to use this knowledge when comparing or sorting dates within a stylesheet. Achieving this without turning the current XPath language upside down (at present it is a very loosely typed language) is going to be a major challenge, and for this reason alone I would expect that development of XPath 2.0 may well take a significant length of time.&lt;br /&gt;Where to use XSLT&lt;br /&gt;In the final section of this chapter I shall try and identify what tasks XSLT is good at, and by implication, tasks for which a different tool would be more suitable. I shall also look at alternative ways of using XSLT within the overall architecture of your application.&lt;br /&gt;Broadly speaking, as I discussed at the beginning of the chapter, there are two main scenarios for using XSLT transformations: data conversion, and publishing; and we'll consider each of them separately.&lt;br /&gt;Data Conversion Applications&lt;br /&gt;Data conversion is not something that will go away just because XML has been invented. Even though an increasing number of data transfers between organizations or between applications within an organization are likely to be encoded in XML, there will still be different data models, different ways of representing the same thing, and different subsets of information that are of interest to different people (recall the example at the beginning of the chapter, where we were converting music between different XML representations and different presentation formats). So however enthusiastic we are about XML, the reality is that there are going to be a lot of comma-separated-values files, EDI messages, and any number of other formats in use for a long time to come.&lt;br /&gt;When you have the task of converting one XML data set into another XML data set, then XSLT is an obvious choice.&lt;br /&gt;It can be used for extracting the data selectively, reordering it, turning attributes into elements or vice versa, or any number of similar tasks. It can also be used simply for validating the data. As a language, XSLT is best at manipulating the structure of the information as distinct from its content: it's a good language for turning rows into columns, but for string handling (for example removing any text that appears between square brackets) it's rather laborious compared with a language like JavaScript or Perl that supports regular expressions. However, you can always tackle these problems by invoking procedures written in other languages, such as Java or Javascript, from within the stylesheet.&lt;br /&gt;XSLT is also useful for converting XML data into any text-based format, such as comma-separated values, or various EDI message formats. Text output is really just like XML output without the tags, so this creates no particular problems for the language.&lt;br /&gt;Perhaps more surprising is that XSLT can often be useful to convert from non-XML formats into XML or something else:&lt;br /&gt;In this case you'll need to write some kind of parser that understands the input format; but you would have had to do that anyway. The benefit is that once you've written the parser, the rest of the data conversion can be expressed in a high-level language. This separation also increases the chances that you'll be able to reuse your parser next time you need to handle that particular input format. I'll show you an example in Chapter 10, page &lt;a name="familytreepgref"&gt;&lt;/a&gt;656, where the input is a rather old-fashioned and distinctly non-XML format widely used for exchanging data between genealogy software packages. It turns out that it isn't even necessary to write the data out as XML before using the XSLT stylesheet to process it: all you need to do is to make your parser look like an XML parser, by making it implement one of the standard parser interfaces: SAX or DOM. Most XSLT processors will accept input from a program that implements the SAX or DOM interfaces, even if the data never saw the light of day as XML.&lt;br /&gt;One caveat about data conversion applications: today's XSLT processors all rely on holding all the data in memory while the transformation is taking place. The tree structure in memory can be as much as ten times the original data size, so in practice, the limit on data size for an XSLT conversion is a few megabytes. Even at this size, a complex conversion can be quite time-consuming, it depends very much on the processing that you actually want to do.&lt;br /&gt;One way around this is to split the data into chunks and convert each chunk separately – assuming, of course, that there is some kind of correspondence between chunks of input and chunks of output. But when this starts to get complicated, there comes a point where XSLT is no longer the best tool for the job. You might be better off, for example, loading the data into a relational or object database, and using the database query language to extract it again in a different sequence.&lt;br /&gt;If you need to process large amounts of data serially, for example extracting selected records from a log of retail transactions, then an application written using the SAX interface might take a little longer to write than the equivalent XSLT stylesheet, but it is likely to run many times faster. Very often the combination of a SAX filter application to do simple data extraction, followed by an XSLT stylesheet to do more complex manipulation, can be the best solution in such cases.&lt;br /&gt;Publishing&lt;br /&gt;The difference between data conversion and publishing is that in the former case, the data is destined for input to another piece of software, while in the latter case it is destined to be read (you hope) by human beings. Publishing in this context doesn't just mean lavish text and multimedia, it also means data; everything from the traditional activity of producing and distributing reports so that managers know what's going on in the business, to producing online phone bills and bank statements for customers, and rail timetables for the general public. XML is ideal for such data publishing applications, as well as the more traditional text publishing, which was the original home territory of SGML.&lt;br /&gt;XML was designed to enable information to be held independently of the way it is presented, which sometimes leads people into the fallacy of thinking that using XML for presentation details is somehow bad. Far from it: if you were designing a new format for downloading fonts to a printer today, you would probably make it XML-based. Presentation details have just as much right to be encoded in XML as any other kind of information. So we can see the role of XSLT in the publishing process as being converting data-without-presentation to data-with-presentation, where both are, at least in principle, XML formats.&lt;br /&gt;The two important vehicles for publishing information today are print-on-paper, and the web. The print-on-paper scene is the more difficult one, because of the high expectations of users for visual quality. XSL Formatting Objects attempts to define an XML-based model of a print file for high quality display on paper or on screen. Because of the sheer number of parameters needed to achieve this, the standard has taken a while to complete, and will probably take even longer to implement in its entirety. But the web is a less demanding environment, where all we need to do is convert the data to HTML and leave the browser to do the best it can on the display available. HTML, of course, is not XML, but it is close enough so that a simple mapping is possible. Converting XML to HTML is the most common application for XSLT today. It's actually a two-stage process: first convert to an XML-based model that is structurally equivalent to the target HTML, and then serialize this in HTML notation rather than strict XML.&lt;br /&gt;The emergence of XHTML 1.0 of course tidies up this process even further, because it is a pure XML format, but how quick the take-up of XHTML will be remains to be seen.&lt;br /&gt;When to do the Conversion?&lt;br /&gt;The process of publishing information to a user is illustrated in the diagram below:&lt;br /&gt;There are several points in such a system where XSLT transformations might be appropriate:&lt;br /&gt;Information entered by authors using their preferred tools, or customized form-filling interfaces, can be converted to XML and stored in that form in the content store.&lt;br /&gt;XML information arriving from other systems might be transformed into a different flavor of XML for storage in the content store. For example, it might be broken up into page-size chunks.&lt;br /&gt;XML can be translated into HTML on the server, when the users request a page. This can be controlled using technology such as Java servlets or Java Server Pages. On a Microsoft server you can use the XSL ISAPI extension available from http://msdn.microsoft.com/xml, or if you want more application control, you can invoke the transformation from script on ASP pages.&lt;br /&gt;XML can be sent down to the client system, and translated into HTML within the browser. This can give a highly interactive presentation of the information, and remove a lot of the processing load from the server, but it relies on all the users having a browser that can do the job.&lt;br /&gt;XML data can also be converted into its final display form at publishing time, and stored as HTML within the content store. This minimizes the work that needs to be done at display time, and is ideal when the same displayed page is presented to very many users.&lt;br /&gt;There isn't one right answer, and often a combination of techniques may be appropriate. Conversion in the browser is an attractive option once XSLT becomes widely available within browsers, but that is still some way off. Even when this is done, there may still be a need for some server-side processing to deliver the XML in manageable chunks, and to protect secure information. Conversion at delivery time on the server is a popular choice, because it allows personalization, but it can be a heavy overhead for sites with high traffic. Some busy sites have found that it is more effective to generate a different set of HTML pages for each section of the target audience in advance, and at page request time to do nothing more than select the right pre-constructed HTML page.&lt;br /&gt;Summary&lt;br /&gt;This introductory chapter described the whys and wherefores of XSLT. It tried to answer questions such as:&lt;br /&gt;What kind of language is it?&lt;br /&gt;Where does it fit into the XML family?&lt;br /&gt;Where does it come from and why was it designed the way it is?&lt;br /&gt;Where should it be used?&lt;br /&gt;You now know that XSLT is a declarative high-level language designed for transforming the structure of XML documents; that it has two major applications: data conversion and presentation; and that it can be used at a number of different points in the overall application architecture, including at data capture time, at delivery time on the server, and at display time on the browser. You also have some idea why XSLT has developed in the way it has.&lt;br /&gt;Now it's time to start taking an in-depth look inside the language to see how it does this job. In the next chapter, we'll look at the way transformation is carried out by treating the input and output as tree structures, and using patterns to match particular nodes in the input tree and define what nodes should be added to the result tree when the pattern is matched.&lt;br /&gt;Copyright © 2000 Wrox Press Ltdted into HTML within the browser. This can give a highly interactive presentation of the information, and remove a lot of the processing load from the server, but it relies on all the users having a browser that can do the job.&lt;br /&gt;XML data can also be converted into its final display form at publishing time, and stored as HTML within the content store. This minimizes the work that needs to be done at display time, and is ideal when the same displayed page is presented to very many users.&lt;br /&gt;There isn't one right answer, and often a combination of techniques may be appropriate. Conversion in the browser is an attractive option once XSLT becomes widely available within browsers, but that is still some way off. Even when this is done, there may still be a need for some server-side processing to deliver the XML in manageable chunks, and to protect secure information. Conversion at delivery time on the server is a popular choice, because it allows personalization, but it can be a heavy overhead for sites with high traffic. Some busy sites have found that it is more effective to generate a different set of HTML pages for each section of the target audience in advance, and at page request time to do nothing more than select the right pre-constructed HTML page.&lt;br /&gt;Summary&lt;br /&gt;This introductory chapter described the whys and wherefores of XSLT. It tried to answer questions such as:&lt;br /&gt;What kind of language is it?&lt;br /&gt;Where does it fit into the XML family?&lt;br /&gt;Where does it come from and why was it designed the way it is?&lt;br /&gt;Where should it be used?&lt;br /&gt;You now know that XSLT is a declarative high-level language designed for transforming the structure of XML documents; that it has two major applications: data conversion and presentation; and that it can be used at a number of different points in the overall application architecture, including at data capture time, at delivery time on the server, and at display time on the browser. You also have some idea why XSLT has developed in the way it has.&lt;br /&gt;Now it's time to start taking an in-depth look inside the language to see how it does this job. In the next chapter, we'll look at the way transformation is carried out by treating the input and output as tree structures, and using patterns to match particular nodes in the input tree and define what nodes should be added to the result tree when the pattern is matched.&lt;br /&gt;Copyright © 2000 Wrox Press Ltd&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-5255288112167966101?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/5255288112167966101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=5255288112167966101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/5255288112167966101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/5255288112167966101'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2007/09/xslt.html' title='XSLT'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-3914923970740807243</id><published>2007-09-08T02:59:00.000-07:00</published><updated>2007-09-08T03:00:41.752-07:00</updated><title type='text'>Read/Write XML files, Config files, INI files, or the Registry</title><content type='html'>&lt;a name="Introduction"&gt;Introduction&lt;/a&gt;&lt;br /&gt;I was developing a small Windows app using C#, and I decided that it would be nice to save the window's position and size when the app exited so it would be the same the next time the app was run. Having come from the MFC world, I searched for something equivalent to GetProfile and WriteProfile methods of the CWinApp class, but found nothing. I knew there was a Registry class in the Microsoft.Win32 namespace, but there was nothing available for writing to INI files. I would need to use the Win32 APIs for those. If I wanted to use an XML file, there was a whole slew of classes available in the System.Xml namespace. I also looked into using App.config files which some people had mentioned in the forums, but those supposedly were not meant to be written to...&lt;br /&gt;All these similar mechanisms, each with their own interfaces... which one to use? I just needed a simple way to persist my window's position and size somewhere to be later retrieved.&lt;br /&gt;I set my small Windows app project on the side and decided that it was time to write a new class library; one that would unify all these mechanisms into a common and simple interface: the IProfile interface. This article presents the IProfile interface and the four classes that implement it: Xml, Registry, Ini, and Config. These four classes allow reading and writing values to their respective mediums, via a common and simple interface. Enjoy!&lt;a name="Interface"&gt;&lt;br /&gt;Interface&lt;/a&gt;&lt;br /&gt;So what does this common interface look like? Here's a simplified version of it -- see IProfile.cs or AMS.Profile.chm for the complete definition:interface IProfile&lt;br /&gt;{&lt;br /&gt;void SetValue(string section, string entry, object value);&lt;br /&gt;object GetValue(string section, string entry);&lt;br /&gt;string GetValue(string section, string entry, string defaultValue);&lt;br /&gt;int GetValue(string section, string entry, int defaultValue);&lt;br /&gt;double GetValue(string section, string entry, double defaultValue);&lt;br /&gt;bool GetValue(string section, string entry, bool defaultValue);&lt;br /&gt;string[] GetEntryNames(string section);&lt;br /&gt;string[] GetSectionNames ();&lt;br /&gt;void RemoveEntry(string section, string entry);&lt;br /&gt;void RemoveSection(string section);&lt;br /&gt;bool ReadOnly&lt;br /&gt;{&lt;br /&gt;get;&lt;br /&gt;set;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;event ProfileChangingHandler Changing;&lt;br /&gt;event ProfileChangedHandler Changed;&lt;br /&gt;}&lt;br /&gt;As you can see, it's a simple interface bearing a slight resemblance to the GetProfile and WriteProfile methods of the CWinApp class. It's all based on a simple paradigm: a piece of data is associated with an entry inside of a section. The section may contain multiple entries and there may be multiple sections available. That's it! A section could be something like "Main Window", holding entries such as "X", "Y", "Width", "Height", each one having their corresponding numeric values. If you've worked with INI files in the past, this concept will be very familiar to you.&lt;br /&gt;Aside from the standard Get and Set methods used to read and write the values, the interface also allows you to retrieve the names of the available entries and sections, and to remove them if desired. It even has a ReadOnly property to prevent any changes to the profile. And to top it off, it contains two events that allow you to be notified when something in the profile (section, entry, or value) is about to change or has already changed. (I may have gone a little overboard :-) )&lt;a name="Classes"&gt;&lt;/a&gt;&lt;br /&gt;Classes&lt;br /&gt;When it came time to implement the interface, I went with the most popular mediums available. XML was number one on the list. Its popularity is just impossible to ignore. The Registry was my second choice. Although people may be turning away from it, it's still a very efficient way to read and write data to a centralized location. Lastly, I went with INI files. I realize they're practically extinct these days but some people still use them due to their simplicity. Once I had completed my classes, I decided to add one more implementation to the list: one to handle config files. From the forums and articles here at CP, I noticed several developers needing a way to write to them. So I said, "Why not?". It's somewhat similar to the XML one so it didn't take long to write.&lt;br /&gt;The result was four classes, all part of the AMS.Profile namespace: Xml, Registry, Ini, and Config. Their main objective is the implementation of IProfile based on their respective storage mediums.&lt;br /&gt;So how do these classes store their Profile data? Here's a brief synopsis of how each class works:&lt;br /&gt;Xml&lt;br /&gt;As you probably know, XML is all about storing data inside a text file in pretty much any markup-based format. So which format would I choose to organize the data using the section/entry paradigm? After considering a couple of possibilities, I decided that the format below would be preferable, since it allows section and entry names to contain spaces. It also looks cleaner and more consistent than if I had used the section and entry names themselves to name the elements.&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;br /&gt;&lt;profile&gt;&lt;br /&gt;&lt;section name="A Section"&gt;&lt;br /&gt;&lt;entry name="An Entry"&gt;Some Value&lt;/entry&gt;&lt;br /&gt;&lt;entry name="Another Entry"&gt;Another Value&lt;/entry&gt;&lt;br /&gt;&lt;/section&gt;&lt;br /&gt;&lt;section name="Another Section"&gt;&lt;br /&gt;&lt;entry name="This is cool"&gt;True&lt;/entry&gt;&lt;br /&gt;&lt;/section&gt;&lt;br /&gt;&lt;/profile&gt;&lt;br /&gt;Notice, the root element is called "profile". This is the default root name, which you may change via the class' RootName property. When you check out the class, you'll also notice that the default name of the XML file is based on the type and name of the application -- program.exe.xml or web.xml. This, of course, is also customizable.&lt;br /&gt;Registry&lt;br /&gt;For the registry, I decided to default to the old familiar path, HKEY_CURRENT_USER\Software\Company\Product, with individual sections appearing as subkeys of that. Again, this path is customizable when creating the object, or later via the RootKey and Name properties.&lt;br /&gt;The above data would appear similar to this, when viewed on the Registry editor (regedit.exe):- My Computer&lt;br /&gt;...&lt;br /&gt;- HKEY_CURRENT_USER&lt;br /&gt;...&lt;br /&gt;- Software&lt;br /&gt;...&lt;br /&gt;- AMS&lt;br /&gt;- ProfileDemo&lt;br /&gt;- A Section Name Data&lt;br /&gt;An Entry Some Value&lt;br /&gt;Another Entry Another Value&lt;br /&gt;- Another Section Name Data&lt;br /&gt;This is cool True&lt;br /&gt;Ini&lt;br /&gt;INI files are pretty much self explanatory, format-wise. Here's the above data in INI format:[A Section]&lt;br /&gt;An Entry=Some Value&lt;br /&gt;Another Entry=Another Value&lt;br /&gt;[Another Section]&lt;br /&gt;This is cool=True&lt;br /&gt;Like the XML file, the default file name will be based on the name and type of the application -- program.exe.ini or web.ini. If you don't like it, it's easy enough to change via the constructor or Name property.&lt;br /&gt;Config&lt;br /&gt;Config files are the most complex of the bunch, format and code wise. Let me begin by illustrating how the above data would look:&lt;br /&gt;Collapse&lt;configuration&gt;&lt;br /&gt;&lt;configsections&gt;&lt;br /&gt;&lt;sectiongroup name="profile"&gt;&lt;br /&gt;&lt;section name="A_Section"&lt;br /&gt;type="System.Configuration.NameValueSectionHandler,&lt;br /&gt;System, Version=1.0.3300.0, Culture=neutral,&lt;br /&gt;PublicKeyToken=b77a5c561934e089, Custom=null" /&gt;&lt;br /&gt;&lt;section name="Another_Section"&lt;br /&gt;type="System.Configuration.NameValueSectionHandler,&lt;br /&gt;System, Version=1.0.3300.0, Culture=neutral,&lt;br /&gt;PublicKeyToken=b77a5c561934e089, Custom=null" /&gt;&lt;br /&gt;&lt;/sectiongroup&gt;&lt;br /&gt;&lt;/configsections&gt;&lt;br /&gt;&lt;profile&gt;&lt;br /&gt;&lt;a_section&gt;&lt;br /&gt;&lt;add key="An Entry" value="Some Value"&gt;&lt;br /&gt;&lt;add key="Another Entry" value="Another Value"&gt;&lt;br /&gt;&lt;/a_section&gt;&lt;br /&gt;&lt;another_section&gt;&lt;br /&gt;&lt;add key="This is cool" value="True"&gt;&lt;br /&gt;&lt;/another_section&gt;&lt;br /&gt;&lt;/profile&gt;&lt;br /&gt;&lt;appsettings&gt;&lt;br /&gt;&lt;add key="App Entry" value="App Value"&gt;&lt;br /&gt;&lt;/appsettings&gt;&lt;br /&gt;&lt;/configuration&gt;&lt;br /&gt;As you can see, there's a lot more going on here than with the other formats. The profile element contains an element for each section and the values are kept as attributes of add elements. Notice that for each section, the configSections element needs to specify how to read the values contained by it. This is all standard fare, required for the framework to properly load the values and allow you to retrieve them using the System.Configuration.ConfigurationSettings class, like this:NameValueCollection section = (NameValueCollection)&lt;br /&gt;ConfigurationSettings.GetConfig("profile/A_Section");&lt;br /&gt;string value = section["An Entry"];&lt;br /&gt;Notice, there's also an "appSettings" element, which wasn't part of the other samples. I just threw it in there just to show that it may also be accessed via the Config class. If you're familiar with the System.Configuration namespace, you'll know that appSettings is the default section used for storing application-specific settings that may be read using the ConfigurationSettings.AppSettings property:string value = ConfigurationSettings.AppSettings["App Entry"];&lt;br /&gt;Well, the Config class also allows you to read (and of course, write) to that section, as follows:Config config = new Config();&lt;br /&gt;config.GroupName = null; // don't use the "profile" group&lt;br /&gt;...&lt;br /&gt;string value = config.GetValue("appSettings", "App Entry", null);&lt;br /&gt;config.SetValue("appSettings", "Update Date", DateTime.Today);&lt;br /&gt;One thing to keep in mind for Windows apps is that .NET caches the config data as it reads it, so any subsequent updates to it on the file will not be seen by the System.Configuration classes. The Config class, however, has no such problem since the data is read from the file every time, unless buffering is active.&lt;br /&gt;Like the Xml and Ini classes, the default file name will be based on the name and type of the application -- program.exe.config or web.config. This is the name expected by the .NET framework classes, but you can still change it if you want. Keep in mind that writing to web.config causes the application to end along with all the active Sessions.&lt;a name="Usage"&gt;&lt;/a&gt;&lt;br /&gt;Usage&lt;br /&gt;So now that you've seen the classes, how do you go about using them in your code? Well, I packaged them inside their own DLL, called AMS.Profile.dll. This makes them easy to use in your various projects, without having to recompile them everywhere. Simply add the DLL to your project's References, which is done as follows inside Visual Studio .NET:&lt;br /&gt;Open your own project inside Visual Studio .NET.&lt;br /&gt;Inside the Solution Explorer toolbox, right click on the References folder and select "Add Reference".&lt;br /&gt;Click on the Browse button and select the AMS.Profile.dll file.&lt;br /&gt;Click OK. You may now use the AMS.Profile namespace inside your project.&lt;br /&gt;Which class should I use?&lt;br /&gt;OK, so how do you actually use these classes inside the code? That's the easy part, actually. The hard part may be deciding which one of the four to use. Whereas before you may have based your decision on the amount and complexity of the code involved, now that's no longer an issue. Now you just worry about which storage medium is best for the job. And that part is basically up to your program's requirements and/or personal preferences.&lt;br /&gt;Here are some of my observations to help you decide:&lt;br /&gt;When you bring up the Demo program, you'll see a Test button. It's used to test most of the functionality of the selected Profile to verify it's working as expected. Well, I added some simple timing code to the method to measure how long the test takes for the selected profile. The end result: the Registry profile is by far the quickest of the four (especially after the first time). The INI profile came in at a distant second, followed by XML, and then Config. (When you activate buffering on the Xml or the Config classes, their performance improves dramatically and approximates that of the Registry. However, buffering requires extra code to actually update the file.)&lt;br /&gt;According to many people, config files are not meant to be written at run-time. The lack of .NET methods for doing so proves that. A better alternative is the Xml class which is meant to work with a separate file.&lt;br /&gt;INI files may be old and gray, but for storage of small data, they're still hard to beat, as far as their format goes.&lt;br /&gt;Still trying to decide? Here's the bottom line.&lt;br /&gt;Use the Config class only if you absolutely need to write to the app.config file, or for your own file.&lt;br /&gt;Use the Ini class if your program works with legacy data stored in INI files.&lt;br /&gt;Use the Registry class if you don't want to deal with extra files, or if you require top performance.&lt;br /&gt;Use the Xml class if you need to make it easy to transfer the whole app to another location, or to add an extra element of coolness to your app. ;-)&lt;br /&gt;Even if you don't pick the proper class from the start, it's easy enough to switch to another one later. OOP rocks!&lt;br /&gt;How do I use the class?&lt;br /&gt;Now that you have selected the profile class for the job, how do you use them inside your code? Well, most of the time, you'll just declare the class as a field of another class and then call the GetValue and SetValue methods. Here's an example with the Xml class:Xml profile = new Xml();&lt;br /&gt;...&lt;br /&gt;int width = profile.GetValue("Main Window", "Width", 800);&lt;br /&gt;int height = profile.GetValue("Main Window", "Height", 600);&lt;br /&gt;...&lt;br /&gt;profile.SetValue("Main Window", "Width", this.Size.Width);&lt;br /&gt;profile.SetValue("Main Window", "Height", this.Size.Height);&lt;br /&gt;Keep in mind that the Xml and Config classes allow you to use buffering to improve the performance of reads and writes to their respective files. If you use C#, you can take advantage of the using statement to easily create the buffer, write to it, and then automatically flush it (when it's disposed). Here's an example:Xml profile = new Xml();&lt;br /&gt;...&lt;br /&gt;using (profile.Buffer())&lt;br /&gt;{&lt;br /&gt;profile.SetValue("Main Window", "Width", this.Size.Width);&lt;br /&gt;profile.SetValue("Main Window", "Height", this.Size.Height);&lt;br /&gt;}&lt;br /&gt;As you saw from the IProfile interface above, there are several other methods, properties, and events available. Those you'll find fully documented inside the code, as well as in the downloadable documentation (AMS.Profile.chm zipped). I recommend you view the help file to get the details on everything that's available from the DLL. Of course, if you have questions or concerns, you may address them to me personally or by posting a message below.&lt;a name="demo"&gt;&lt;br /&gt;Demo&lt;/a&gt;&lt;br /&gt;I wrote the demo program to illustrate the functionality of the four Profile classes, and at the same time, to test the classes. I added a Test button that calls a method of the Profile base class to verify that the most important methods and properties work correctly and consistently across all profiles. You may want to check out that code for examples of how to use these classes.&lt;br /&gt;Keep in mind that this is just a demo program, not a utility. Each Profile object works with their default names. For example, for the Xml object, the name of the file will be Demo.exe.xml and will be located in the same folder as Demo.exe. There's no provision for changing these names, since, again, it's just a demo.&lt;br /&gt;To use the demo, select a Profile from the top combo box. This will cause the sections in the profile to be placed into the Section combo. Choose a section from there and you'll see all of its entries get added to the Entry combo box. Choose an entry from there and you'll see its value placed into the Value textbox. If you want to add a new Section or Entry, simply type it into the proper combo box. Press the Save button to write the value to the profile via SetValue. This should all be pretty straightforward, I hope. If not, please let me know.&lt;br /&gt;History&lt;br /&gt;Version 1.0 - Oct 23, 2003&lt;br /&gt;Initial release.&lt;br /&gt;Version 1.1 - Mar 15, 2004&lt;br /&gt;Fixed a small bug in the Config class that was causing multiple identical entries. Thanks to Russkie for reporting it and giving me the fix.&lt;br /&gt;Added ProgramExe property to the Profile class to prevent the DefaultName from raising an exception when Assembly.GetEntryAssembly() is null.&lt;br /&gt;Added Encoding property to the Config and Xml properties to allow changing of the default encoding (UTF8) for new files.&lt;br /&gt;Corrected some minor documentation typos.&lt;br /&gt;Version 2.0 - Feb 17, 2005&lt;br /&gt;Added XmlBased class to give the Xml and Config classes a common base class for the new Buffering code.&lt;br /&gt;Added Buffering related methods to the XmlBased classes (Config and Xml) to dramatically improve the performance of reads and writes to the underlying XML files. Thanks to all those who requested it and to brabchev for showing me his implementation.&lt;br /&gt;Moved the Encoding property and GetXmlDocument method from the Xml and Config to their new XmlBased class.&lt;br /&gt;Added XmlBuffer class to encapsulate the new Buffering feature added to the XmlBased classes (Xml and Config).&lt;br /&gt;Went through every method and verified that all exceptions that may be raised are documented. Thanks to Matt Gerrans for explaining the importance of this. (BTW, I decided not to create custom exception classes, to keep the code simple and compatible for those who are currently using it.)&lt;br /&gt;Changed the way exceptions are documented, to be consistent with everything else.&lt;br /&gt;Added checks to where I call WritePrivateProfileString in the Ini class to raise a Win32Exception in case of failure.&lt;br /&gt;Removed the ProgramExe (protected) property from the Profile class and replaced it with DefaultNameWithoutExtension to retrieve the value to be used by DefaultName without the profile-specific extension.&lt;br /&gt;Changed DefaultName of the file-based classes to use the new DefaultNameWithoutExtension property and return the name based on the type of the application running (e.g., web.config for web apps). Thanks to Marcel Kunz for suggesting it.&lt;br /&gt;Changed GetSubKey in the Registry class to open the keys more discriminately. Thanks to Kim Hellan for pointing this out (and for being patient).&lt;br /&gt;Changed SetValue of Xml to allow writing of empty strings. Thanks to Gary Montante for pointing this out.&lt;br /&gt;Fixed small bug in the demo project where the Save button was causing the Entry and Name boxes to be cleared.&lt;br /&gt;Fixed another small bug in the demo project where the Test button was not accurately calculating the time taken by the test.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-3914923970740807243?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/3914923970740807243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=3914923970740807243' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/3914923970740807243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/3914923970740807243'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2007/09/readwrite-xml-files-config-files-ini.html' title='Read/Write XML files, Config files, INI files, or the Registry'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-2047877626305160159</id><published>2007-08-26T21:05:00.001-07:00</published><updated>2007-08-26T21:05:35.474-07:00</updated><title type='text'>some usefull FAQ</title><content type='html'>1. What is an ABAP data dictionary?- ABAP 4 data dictionary describes the logical structures of the objects used in application development and shows how they are mapped to the underlying relational database in tables/views.2. What are domains and data element?- Domains:Domain is the central object for describing the technical characteristics of an attribute of an business objects. It describes the value range of the field. Data Element: It is used to describe the semantic definition of the table fields like description the field. Data element describes how a field can be displayed to end-user.3. What is foreign key relationship?- A relationship which can be defined between tables and must be explicitly defined at field level. Foreign keys are used to ensure the consistency of data. Data entered should be checked against existing data to ensure that there are now contradiction. While defining foreign key relationship cardinality has to be specified. Cardinality mentions how many dependent records or how referenced records are possible.4. Describe data classes.- Master data: It is the data which is seldomly changed. Transaction data: It is the data which is often changed. Organization data: It is a customizing data which is entered in the system when the system is configured and is then rarely changed. System data:It is the data which R/3 system needs for itself.5. What are indexes?- Indexes are described as a copy of a database table reduced to specific fields. This data exists in sorted form. This sorting form ease fast access to the field of the tables. In order that other fields are also read, a pointer to the associated record of the actual table are included in the index. Yhe indexes are activated along with the table and are created automatically with it in the database.6. Difference between transparent tables and pooled tables.- Transparent tables: Transparent tables in the dictionary has a one-to-one relation with the table in database. Its structure corresponds to single database field. Table in the database has the same name as in the dictionary. Transparent table holds application data. Pooled tables. Pooled tables in the dictionary has a many-to-one relation with the table in database. Table in the database has the different name as in the dictionary. Pooled table are stored in table pool at the database level.7. What is an ABAP/4 Query?- ABAP/4 Query is a powerful tool to generate simple reports without any coding. ABAP/4 Query can generate the following 3 simple reports: Basic List: It is the simple reports. Statistics: Reports with statistical functions like Average, Percentages. Ranked Lists: For analytical reports. - For creating a ABAP/4 Query, programmer has to create user group and a functional group. Functional group can be created using with or without logical database table. Finally, assign user group to functional group. Finally, create a query on the functional group generated.8. What is BDC programming?- Transferring of large/external/legacy data into SAP system using Batch Input programming. Batch input is a automatic procedure referred to as BDC(Batch Data Communications).The central component of the transfer is a queue file which receives the data vie a batch input programs and groups associated data into “sessions”.9. What are the functional modules used in sequence in BDC?- These are the 3 functional modules which are used in a sequence to perform a data transfer successfully using BDC programming: BDC_OPEN_GROUP - Parameters like Name of the client, sessions and user name are specified in this functional modules. BDC_INSERT - It is used to insert the data for one transaction into a session. BDC_CLOSE_GROUP - This is used to close the batch input session.10. What are internal tables?- Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.11. What is ITS? What are the merits of ITS?- ITS is a Internet Transaction Server. ITS forms an interface between HTTP server and R/3 system, which converts screen provided data by the R/3 system into HTML documents and vice-versa. Merits of ITS: A complete web transaction can be developed and tested in R/3 system. All transaction components, including those used by the ITS outside the R/3 system at runtime, can be stored in the R/3 system. The advantage of automatic language processing in the R/3 system can be utilized to language-dependent HTML documents at runtime.12. What is DynPro?- DynPro is a Dynamic Programming which is a combination of screen and the associated flow logic Screen is also called as DynPro.13. What are screen painter and menu painter?- Screen painter: Screen painter is a tool to design and maintain screen and its elements. It allows user to create GUI screens for the transactions. Attributes, layout, filed attributes and flow logic are the elements of Screen painter. Menu painter: Menu painter is a tool to design the interface components. Status, menu bars, menu lists, F-key settings, functions and titles are the components of Menu painters. Screen painter and menu painter both are the graphical interface of an ABAP/4 applications.14. What are the components of SAP scripts?- SAP scripts is a word processing tool of SAP which has the following components: Standard text. It is like a standard normal documents. Layout sets. - Layout set consists of the following components: Windows and pages, Paragraph formats, Character formats. Creating forms in the R/3 system. Every layout set consists of Header, paragraph, and character string. ABAP/4 program.15. What is ALV programming in ABAP? When is this grid used in ABAP?- ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain up to 90 columns in the display with the wide array of display options.16. What are the events in ABAP/4 language?- Initialization, At selection-screen, Start-of-selection, end-of-selection, top-of-page, end-of-page, At line-selection, At user-command, At PF, Get, At New, At LAST, AT END, AT FIRST.17. What is CTS and what do you know about it?- The Change and Transport System (CTS) is a tool that helps you to organize development projects in the ABAP Workbench and in Customizing, and then transport the changes between the SAP Systems and clients in your system landscape. This documentation provides you with an overview of how to manage changes with the CTS and essential information on setting up your system and client landscape and deciding on a transport strategy. Read and follow this documentation when planning your development project.18. What are logical databases? What are the advantages/ dis-advantages of logical databases?- To read data from a database tables we use logical database. A logical database provides read-only access to a group of related tables to an ABAP/4 program. Advantages: i)check functions which check that user input is complete, correct,and plausible. ii)Meaningful data selection. iii)central authorization checks for database accesses. iv)good read access performance while retaining the hierarchical data view determined by the application logic. dis advantages: i)If you donot specify a logical database in the program attributes,the GET events never occur. ii)There is no ENDGET command,so the code block associated with an event ends with the next event statement (such as another GET or an END-OF-SELECTION).19. What is a batch input session?- BATCH INPUT SESSION is an intermediate step between internal table and database table. Data along with the action is stored in session ie data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed.20. How to upload data using CATT ?- These are the steps to be followed to Upload data through CATT: Creation of the CATT test case &amp; recording the sample data input. Download of the source file template. Modification of the source file. Upload of the data from the source file.21. What is Smart Forms?- Smart Forms allows you to create forms using a graphical design tool with robust functionality, color, and more. Additionally, all new forms developed at SAP will be created with the new Smart Form solution.22. How can I make a differentiation between dependent and independent data?- Client dependent or independent transfer requirements include client specific or cross client objects in the change requests. Workbench objects like SAPscripts are client specific, some entries in customizing are client independent. If you display the object list for one change request, and then for each object the object attributes, you will find the flag client specific. If one object in the task list has this flag on, then that transport will be client dependent.23. What is the difference between macro and subroutine?- Macros can only be used in the program the are defined in and only after the definition are expanded at compilation / generation. Subroutines (FORM) can be called from both the program the are defined in and other programs . A MACRO is more or less an abbreviation for some lines of code that are used more than once or twice. A FORM is a local subroutine (which can be called external). A FUNCTION is (more or less) a subroutine that is called external. Since debugging a MACRO is not really possible, prevent the use of them (I’ve never used them, but seen them in action). If the subroutine is used only local (called internal) use a FORM. If the subroutine is called external (used by more than one program) use a FUNCTION.24. What is ERP? - ERP is a package with the techniques and concepts for the integrated management of business as a whole, for effective use of management resources, to improve the efficiency of an enterprise. Initially, ERP was targeted for manufacturing industry mainly for planning and managing core business like production and financial market. As the growth and merits of ERP package ERP software is designed for basic process of a company from manufacturing to small shops with a target of integrating information across the company.25. Different types of ERP? - SAP, BAAN, JD Edwards, Oracle Financials, Siebel, PeopleSoft. Among all the ERP’s most of the companies implemented or trying to implement SAP because of number of advantages aver other ERP packages.26. What is SAP? - SAP is the name of the company founded in 1972 under the German name (Systems, Applications, and Products in Data Processing) is the leading ERP (Enterprise Resource Planning) software package.27. Explain the concept of “Business Content” in SAP Business Information Warehouse? - Business Content is a pre-configured set of role and task-relevant information models based on consistent Metadata in the SAP Business Information Warehouse. Business Content provides selected roles within a company with the information they need to carry out their tasks. These information models essentially contain roles, workbooks, queries, InfoSources, InfoCubes, key figures, characteristics, update rules and extractors for SAP R/3, mySAP.com Business Applications and other selected applications.28. Why do you usually choose to implement SAP? - There are number of technical reasons numbers of companies are planning to implement SAP. It’s highly configurable, highly secure data handling, min data redundancy, max data consistency, you can capitalize on economics of sales like purchasing, tight integration-cross function.29. Can BW run without a SAP R/3 implementation? - Certainly. You can run BW without R/3 implementation. You can use pre-defined business content in BW using your non-SAP data. Here you simply need to map the transfer structures associated with BW data sources (InfoCubes, ODS tables) to the inbound data files or use 3rd part tool to connect your flat files and other data sources and load data in BW. Several third party ETL products such as Acta, Infomatica, DataStage and others will have been certified to load data in BW.30. What is IDES? - International Demonstration and Education System. A sample application provided for faster learning and implementation.31. What is WF and its importance? - Business Work Flow: Tool for automatic control and execution of cross-application processes. This involves coordinating the persons involved, the work steps required, the data, which needs to be processed (business objects). The main advantage is reduction in throughput times and the costs involved in managing business processes. Transparency and quality are enhanced by its use.32. What is SAP R/3? - A third generation set of highly integrated software modules that performs common business function based on multinational leading practice. Takes care of any enterprise however diverse in operation, spread over the world. In R/3 system all the three servers like presentation, application server and database server are located at different system.33. What are presentation, application and database servers in SAP R/3? - The application layer of an R/3 System is made up of the application servers and the message server. Application programs in an R/3 System are run on application servers. The application servers communicate with the presentation components, the database, and also with each other, using the message server. All the data are stored in a centralized server. This server is called database server.34. What should be the approach for writing a BDC program? - Convert the legacy system data to a flat file and convert flat file into internal table. Transfer the flat file into sap system called “sap data transfer”. Call transaction(Write the program explicitly) or create sessions (sessions are created and processed ,if success data will transfer).35. Explain open SQL vs native SQL? - ABAP Native SQL allows you to include database-specific SQL statements in an ABAP program. Most ABAP programs containing database-specific SQL statements do not run with different databases. If different databases are involved, use Open SQL. To execute ABAP Native SQL in an ABAP program, use the statement EXEC. Open SQL (Subset of standard SQL statements), allows you to access all database tables available in the R/3 System, regardless of the manufacturer. To avoid conflicts between database tables and to keep ABAP programs independent from the database system used, SAP has generated its own set of SQL statements known as Open SQL.36. What are datasets? - The sequential files (processed on application server) are called datasets. They are used for file handling in SAP.37. What are internal tables check table, value table, and transparent table? - Internal table: It is a standard data type object, which exists only during the runtime of the program. Check table: Check table will be at field level checking. Value table: Value table will be at domain level checking ex: scarr table is check table for carrid. Transparent table: - Exists with the same structure both in dictionary as well as in database exactly with the same data and fields.38. What are the major benefits of reporting with BW over R/3? Would it be sufficient just to Web-enable R/3 Reports? - Performance — Heavy reporting along with regular OLTP transactions can produce a lot of load both on the R/3 and the database (cpu, memory, disks, etc). Just take a look at the load put on your system during a month end, quarter end, or year-end — now imagine that occurring even more frequently. Data analysis — BW uses a Data Warehouse and OLAP concepts for storing and analyzing data, where R/3 was designed for transaction processing. With a lot of work you can get the same analysis out of R/3 but most likely would be easier from a BW.39. How can an ERP such as SAP help a business owner learn more about how business operates? - In order to use an ERP system, abusiness person must understand the business processes and how they work together from one functional area to the other. This knowledge gives the student a much deeper understanding of how a business operates. Using SAP as a tool to learn about ERP systems will require that thepeople understand the business processes and how they integrate.40. What is the difference between OLAP and Data Mining? - OLAP - On line Analytical processing is a reporting tool configured to understand your database schema ,composition facts and dimensions . By simple point-n-clicking, a user can run any number of canned or user-designed reports without having to know anything of SQL or the schema. Because of that prior configuration, the OLAP engine “builds” and executes the appropriate SQL. Mining is to build the application to specifically look at detailed analyses, often algorithmic; even more often misappropriate called “reporting.41. What is “Extended Star Schema” and how did it emerge? - The Star Schema consists of the Dimension Tables and the Fact Table. The Master Data related tables are kept in separate tables, which has reference to the characteristics in the dimension table(s). These separate tables for master data is termed as the Extended Star Schema.42. Define Meta data, Master data and Transaction data - Meta Data: Data that describes the structure of data or MetaObjects is called Metadata. In other words data about data is known as Meta Data. Master Data: Master data is data that remains unchanged over a long period of time. It contains information that is always needed in the same way. Characteristics can bear master data in BW. With master data you are dealing with attributes, texts or hierarchies. Transaction data: Data relating to the day-to-day transactions is the Transaction data.43. Name some drawbacks of SAP - Interfaces are huge problem, Determine where master data resides, Expensive, very complex, demands highly trained staff, lengthy implementation time.44. What is Bex? - Bex stands for Business Explorer. Bex enables end user to locate reports, view reports, analyze information and can execute queries. The queries in workbook can be saved to there respective roles in the Bex browser. Bex has the following components: Bex Browser, Bex analyzer, Bex Map, Bex Web.45. What are variables? - Variables are parameters of a query that are set in the parameter query definition and are not filled with values until the queries are inserted into workbooks. There are different types of variables which are used in different application: Characteristics variables, Hierarchies and hierarchy node, Texts, Formulas, Processing types, User entry/Default type, Replacment Path.46. What is AWB?. What is its purpose? - AWB stands for Administrator WorkBench. AWB is a tool for controlling, monitoring and maintaining all the processes connected with data staging and processing in the business information whearhousing.47. What is the significance of ODS in BIW? - An ODS Object serves to store consolidated and debugged transaction data on a document level (atomic level). It describes a consolidated dataset from one or more InfoSources. This dataset can be analyzed with a BEx Query or InfoSet Query. The data of an ODS Object can be updated with a delta update into InfoCubes and/or other ODS Objects in the same system or across systems. In contrast to multi-dimensional data storage with InfoCubes, the data in ODS Objects is stored in transparent, flat database tables.48. What are the different types of source system? - SAP R/3 Source Systems, SAP BW, Flat Files and External Systems.49. What is Extractor? - Extractors is a data retrieval mechanisms in the SAP source system. Which can fill the extract structure of a data source with the data from the SAP source system datasets. The extractor may be able to supply data to more fields than exist in the extract structure.ABAP Interview Questions1. How data is stored in cluster table? Each field of cluster table behaves as tables which contains the no. of entries. 2. What are client dependant objects in abap/sap? SAP Script layout, text element, and some DDIC objects. 3. On which even we can validate the input fields in module progams? In PAI (Write field statement on field you want to validate, if you want to validate group of fields put in chain and End chain statement.) 4. In selection screen I have three fields, plant mat no and material group. If I input plant how do I get the mat no and material group based on plant dynamically? AT SELECTION-SCREEN ON VALUE-REQUEST FOR MATERIAL. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' to get material and material group for the plant. 5. How do you get output from IDOC? Data in IDOc is stored in segments, the output from Idoc is obtained by reading the data stored in its respective segments. 6. When top of the page event is triggered? After excuteing first write statement in start-of-selection event. 7. Can we create field without data element and how? In SE11 one option is available above the fields strip. Data element/ direct type. 8. How do we debug sapscript? Go to SE71 give lay set name , go to utilities select debugger mode on.9. Which transaction code can I used to analyze the performance of ABAP program. TCode AL21.10. How can I copy a standard table to make my own z_table.Go to transaction SE11. Then there is one option to copy table. Press that button. Enter the name of the standard table and in the Target table enter Z table name and press enter.Following are some of the answers which I gave upto my knowledge.1. What is the use of 'outerjoin' Ans. With the use of outer join you can join the tables even there is no entry in all the tables used in the view.In case of inner join there should be an entry in al the tables use in the view.2. When to use logical database?Ans. Advantage of Logical databases:less coding s required to retrieve data compared to normal internel tables.Tables used LDB are in hierarchial structure.3. What is the use of 'table index'?Ans .Index is used for faster access of data base tables.4. What is the use of 'FOR ALL ENTRIES'?Ans. To avoid nested select statements we use SELECT FOR ALL ENTRIES statement.If there r more than 10000 records SELECT FOR ALL ENTRIES is used.Performance wise SELECT FOR ALL ENTRIES is better to use.5. Can you set up background processing using CALL TRANSACTION?Yes,Using No Screen Mode.6. What are table buffers?Table buffers reside locally on each application server in the system. The data of buffered tables can thus be accessed directly from the buffer of the application server. This avoids the time-consuming process of accessing the database.Buffering is useful if table needs to be accessed more no. of times in a program.With Compliments from: Pavan1. How do I set a flag for a field in any table?Create a char field of length 1. for example field STAS-LKENZ is Deletion Indicator. It means that if the value in the field is 'X' then that record has been deleted.2. Can I execute user exits? If yes, how?Yes you can. after finding the user exit, you need to use, goto CMOD add ur user-exit to your project. Then activate the FM which you require. Now go into that function module there will be a Include program wit name ZX* . Double click on it, it will ask to create an object, answer it Yes and then write your code in it. 3. How do I find the output type of a table or a program?Table TNAPR / NAST *-- RajABAP Technical Interview Questions:1. What is the typical structure of an ABAP program?2. What are field symbols and field groups.? Have you used "component idx of structure" clause with field groups?3. What should be the approach for writing a BDC program?4. What is a batch input session?5. What is the alternative to batch input session?6. A situation: An ABAP program creates a batch input session. We need to submit the program and the batch session in background. How to do it?7. What is the difference between a pool table and a transparent table and how they are stored at the database level?8. What are the problems in processing batch input sessions? How is batch input process different from processing on line?9. What do you define in the domain and data element?10. What are the different types of data dictionary objects?11. How many types of tables exist and what are they in data dictionary?12. What is the step-by-step process to create a table in data dictionary?13. Can a transparent table exist in data dictionary but not in the database physically?14. What are the domains and data elements?15. Can you create a table with fields not referring to data elements?16. What is the advantage of structures? How do you use them in the ABAP programs?17. What does an extract statement do in the ABAP program?18. What is a collect statement? How is it different from append?19. What is open sql vs native sql?20. What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?21. What is the meaning of ABAP editor integrated with ABAP data dictionary?22. What are the events in ABAP language?23. What is an interactive report? What is the obvious diff of such report compared with classical type reports?24. What is a drill down report?25. How do you write a function module in SAP? Describe.26. What are the exceptions in function module?27. What is a function group?28. How are the date abd time field values stored in SAP?29. What are the fields in a BDC_Tab Table?30. Name a few data dictionary objects?31. What happens when a table is activated in DD?32. What is a check table and what is a value table?33. What are match codes? Describe?34. What transactions do you use for data analysis?35. What is table maintenance generator?36. What are ranges? What are number ranges?37. What are select options and what is the diff from parameters?38. How do you validate the selection criteria of a report? And how do you display initial values in a selection screen?39. What are selection texts?40. What is CTS and what do you know about it?41. When a program is created and need to be transported to prodn does selection texts always go with it? if not how do you make sure? Can you change the CTS entries? How do you do it?42. What is the client concept in SAP? What is the meaning of client independent?43. Are programs client dependent?44. Name a few system global variables you can use in ABAP programs?45. What are internal tables? How do you get the number of lines in an internal table? How to use a specific number occurs statement?46. How do you take care of performance issues in your ABAP programs?47. What are datasets?48. How to find the return code of a stmt in ABAP programs?49. What are interface/conversion programs in SAP?50. Have you used SAP supplied programs to load master data?2. Adapted from response by Maram Roja on Tuesday, June 15, 20041. What are the techniques involved in using SAP supplied programs? Do you prefer to write your own programs to load master data? Why?2. What are logical databases? What are the advantages/disadvantages of logical databases?3. What specific statements do you using when writing a drill down report?4. What are different tools to report data in SAP? What all have you used?5. What are the advantages and disadvantages of ABAP query tool?6. What are the functional areas? User groups? How does ABAP query work in relation to these?7. Is a logical database a requirement/must to write an ABAP query?8. What is the structure of a BDC sessions.9. What are Change header/detail tables? Have you used them?10. What do you do when the system crashes in the middle of a BDC batch session?11. What do you do with errors in BDC batch sessions?12. How do you set up background jobs in SAP? What are the steps? What are the event driven batch jobs?13. Is it possible to run host command from SAP environment? How do you run?14. What kind of financial periods exist in SAP? What is the relevant table for that?15. Does SAP handle multiple currencies? Multiple languages?16. What is a currency factoring technique?17. How do you document ABAP programs? Do you use program documentation menu option?18. What is SAPscript and layout set?19. What are the ABAP commands that link to a layout set?20. What is output determinationABAP Questions:1.Elementary search helps, Collective search help.2.Difference between Search Helps and Match Codes3.Have you created database tables?4.Difference between client dependent and client independent tables?5.How to create client independent tables6.Have you created Maintenance dialog or Table Maintenance?7.On ABAP: Did you set up a workflow? Are you familiar with all steps for setting up a workflow?8.Have you used performance tuning? What major steps will you use for these?9.In the ‘select’ statement what is “group by”?10.Have you worked with field groups? Have you used Import/Export statements?ABAP Editor:1.Fixed point arithmetic – what is the use? How to set this?2.Have you used client dependent ABAP programs?Database Commands:1.Select statement to read data into internal tables. Types of Select statements2.What happens “Update” command is used without where clause ?3.Difference between “Insert”, “Update” and “Modify”4.Explain “Commit” and “Roll back”5.“Catch” Command6.What is “Group by” in Select statement?More then 200 questions on Logical databases, Buffering, Basis, Reports, BDC, Transactions, SAP Script,User–Exits, SD module, MM module, FI module, Performance tuning,SAP Memory, Others, WorkFlow, General questions are availabe in our EFS Repository.ABAP / 4 INTERVIEW QUESTIONS WITH ANSWERS1) What is SAP R/3?Ans SAP R/3 refers to Systems Application and Product for data processing Real-time having a 3 tier architecture i.e. Presentation layer, Application layer and Database layer.2) What are the programming standards followed?3) What are the contents in technical specifications?Ans There are five contents in Technical Settings: Data Class, Size Category, Buffering Permission, Buffering Type and Logging.4) What is an instance?Ans When you call a function module, an instance of its function group plus its data, is loaded into the memory area of the internal session. An ABAP program can load several instances by calling function modules from different function groups.5) How to take care of performance in ABAP Development?6) What is Function group? Difference between function group and function module?Ans Function Groups act as containers for Function Modules that logically belong together.Function Groups 1) These cannot be defined in a Function Module.2) It cannot be called.3) They are containers for Function Module.Function Modules1) These must be defined in a Function Group.2) It can be called from any program.3) They are not containers for Function Group. 7) What is the difference between 'Select single * ' and 'Select upto 1 rows'?Ans ‘Select single *’ – The result of the selection should be a single entry. If it is not possible to identify a unique entry, the system uses the first line of the selection. For e.g. DATA : ITAB TYPE ZREKHA_EMP.SELECT SINGLE * FROM ZREKHA_EMP INTO ITABWHERE EMPNO = ‘00101’ AND DEPTNO = ‘0010’.WRITE : / ITAB-EMPNO, ITAB-EMPNAME,ITAB-DEPTNO.Select upto 1 rows -8) What Function does data dictionary perform?Ans Central information repository for application and system data. The ABAP Dictionary contains data definitions (metadata) that allow you to describe all of the data structures in the system (like tables, views, and data types) in one place. This eliminates redundancy.9) Difference between domain and data element? What are aggregate object?Ans Domain - Specifies the technical attributes of a data element - its data type, length, possible values, and appearance on the screen. Each data element has an underlying domain. A single domain can be the basis for several data elements. Domains are objects in the ABAP Dictionary.Data Element - Describes the business function of a table field. Its technical attributes are based on a domain, and its business function is described by its field labels and documentation.Aggregate Object – Views, Match Code and Lock objects are called aggregate objects because they are formed from several related table.10) What is view? Different types of view. Explain?Ans View - A view is a virtual table containing fields from one or more tables. A virtual table that does not contain any data, but instead provides an application-oriented view of one or more ABAP Dictionary tables.Different Types of View:1) Maintenance2) Database – It is on more than two tables.3) Projection – It is only on one table.4) Help11) Can u print decimals in type N? What is difference between float and packed data type?Ans No, we cannot print decimals in type N because decimal places are not permitted with Ndata type.Float Data Type: It cannot be declared in Parameters.Packed Number: It can be declared in Parameters. For e.g.PARAMETERS : A(4) TYPE P DECIMALS 2,B(4) TYPE P DECIMALS 2.DATA : C(4) TYPE P DECIMALS 2.C = A + B.WRITE : / ‘THE SUM IS’ , C.12) What is step-loop? Explain all the steps?Ans A step loop is a repeated series of field-blocks in a screen. Each block can contain one or more fields, and can extend over more than one line on the screen.Step loops as structures in a screen do not have individual names. The screen can contain more than one step-loop, but if so, you must program the LOOP...ENDLOOPs in the flow logic accordingly. The ordering of the LOOP...ENDLOOPs must exactly parallel the order of the step loops in the screen. The ordering tells the system which loop processing to apply to which loop. Step loops in a screen are ordered primarily by screen row, and secondarily by screen column.Transaction TZ61 (development class SDWA) implements a step loop version of the table you saw in transaction TZ60.Static and Dynamic Step LoopsStep loops fall into two classes: static and dynamic. Static step loops have a fixed size that cannot be changed at runtime. Dynamic step loops are variable in size. If the user re-sizes the window, the system automatically increases or decreases the number of step loop blocks displayed. In any given screen, you can define any number of static step loops, but only a single dynamic one.You specify the class for a step loop in the Screen Painter. Each loop in a screen has the attributes Looptype (fixed=static, variable=dynamic) and Loopcount. If a loop is fixed, the Loopcount tells the number of loop-blocks displayed for the loop. This number can never change.Programming with static and dynamic step loops is essentially the same. You can use both the LOOP and LOOP AT statements for both types.Looping in a Step LoopWhen you use LOOP AT with a step loop, the system automatically displays the step loop with vertical scroll bars. The scroll bars, and the updated (scrolled) table display, are managed by the system.Use the following additional parameters if desired:· FROM and TO · CURSOR 13) What is the initial value and maximum length of all data type?Ans Data Type Initial field length Valid field length Initial value Meaning Numeric types I 4 4 0 Integer (whole number) F 8 8 0 Floating point number P 8 1 – 16 0 Packed number Character types C 1 1 – 65535 ' … ' Text field (alphanumeric characters) D 8 8 '00000000' Date field (Format: YYYYMMDD) N 1 1 – 65535 '0 … 0' Numeric text field (numeric characters) T 6 6 '000000' Time field (format: HHMMSS) Hexadecimal type X 1 1 – 65535 X'0 … 0' Hexadecimal field 14) What are the ways to find out the tables used in the program?Ans 15) Can you have two detail lists from the basic list at the same time?If yes how and if no why?Ans 16) What are the different functions used in sap script? What are the parameters used in each Function?Ans There are three different functions used in SAP Script:1) OPEN_FORM2) WRITE_FORM3) CLOSE_FORMParameters in Each Function:1) OPEN_FORM –ExportingFormLanguage2) WRITE_FORM –ExportingElementWindow3) CLOSE_FORM17) What is sequence of event triggered in report?Ans There are 6 events in report:1) Initialization2) At Selection-Screen3) Start-of-Selection4) Get5) Get Late6) End-of-Selection7) Top-of-Page8) End-of-Page9) At Line Selection10) At User Command11) At PF (nn)18) What are standard layouts sets in the SAP Script?Ans There are four standard layouts in the SAP Script:1) Header2) Logo 3) Main Window4) Footer19) What function module upload data from application server?Ans 20) What are the various types of selection screen event?Ans SELECTION-SCREEN BEGIN OF BLOCK ABC WITH FRAME TITLE T01.SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.CALL SELECTION-SCREEN 500 STARTING AT 10 10.21) What do you know about a client?Ans 22) What are the system fields? Explain?Ans The ABAP system fields are active in all ABAP programs. They are filled by the runtime environment, and you can query their values in a program to find out particular states of the system. Although they are variables, you should not assign your own values to them, since this may overwrite information that is important for the normal running of the program. However, there are some isolated cases in which you may need to overwrite a system variable. For example, by assigning a new value to the field SY-LSIND, you can control navigation within details lists.23) What is SAP Script? What is the purpose of SAP Script? Difference betweenSAP Script and Report?Ans SAP Script – It is the integrated text management system of the SAP R/3 System. Two types – PC Editor &amp; Line Editor.Reports - It is the way to display data fetched from database table onto screen or directly output it to a printer. Two types – Classical and Interactive.24) What is the use of occurs in internal table? Can u change occurs value in program?Ans Use of Occurs - If you use the OCCURS parameter, the value of the INITIAL SIZE of the table is returned to the variable Data : Begin of ITAB occurs 0,End of ITAB.Occurs or Initial Size – to specify the initial amount of memory that should be assigned to the table.Yes, we can change the occurs value in program but output remains the same.25) Difference between SY-TABIX and SY-INDEX? Where it is used?Can u check SY-SUBRC after perform?Ans SY-TABIX - Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.· APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.· COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.· LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.· READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.· SEARCH FOR sets SY-TABIX to the index of the table line in which the search string is found.SY_INDEX - In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.26) Difference between UPLOAD and WS_UPLOAD?Ans UPLOAD - File transfer with dialog from presentation server file to internal table. Data which is available in a file on the presentation server is transferred in an internal table. ASCII &amp;amp; Binary files can be transferred.WS_UPLOAD - To read data from the presentation server into an internal table without a user dialog, use the function module WS_UPLOAD. The most important parameters are listed below.Parameters Function CODEPAGE Only for upload under DOS: Value IBM FILENAME Filename FILETYPE File type 27) Why did u switch to SAP?Ans 28) What is a Logical Database?Ans Logical Databases are special ABAP programs that retrieve data and make it available to application programs.Use of LDB – is used to read data from database tables by linking them to executable ABAP programs.29) What are the events used for Logical Database?Ans Two Events –1) GET - This is the most important event for executable programs that use a logical database. It occurs when the logical database has read a line from the node and made it available to the program in the work area declared using the statement NODES . The depth to which the logical database is read is determined by the GET statements2) PUT - The PUT statement directs the program flow according to the structure of the logical database.30) What is the difference between Get and Get Late?Ans GET - After the logical database has read an entry from the node .GET LATE - After all of the nodes of the logical database have been processed that are below in the database hierarchy.31) What are the data types of Internal Tables?Ans There are three types:1) Line2) Key3) Table32) What are the events used in ABAP in the order of execution?Ans Events are:1. INITIALIZATION2. AT SELECTION-SCREEN3. AT SELECTION-SCREEN ON 4. START-OF-SELECTION5. TOP-OF-PAGE6. TOP-OF-PAGE DURING LINE SELECTION7. END-OF-PAGE8. END-OF-SELECTION9. AT USER-COMMAND10. AT LINE-SELECTION11. AT PF12. GET13. GET LATE.14. AT User Command33) What are Interactive Reports?Ans An output list which displays just the basic details &amp; allow user to interact, so that a new list is populated based on user-selection. With interactive list, the user can actively control data retrieval and display during the session.34) What are the commands used for interactive reports?Ans Top-of-Page during line-selection35) What are the system fields u have worked with? Explain?Ans I had worked with the following (30) system fields:1) SY-DBSYS - Central Database2) SY-HOST - Server3) SY-OPSYS - Operating System4) SY-SAPRL - SAP Release5) SY-SYSID - System Name6) SY-LANGU - User Logon Language7) SY-MANDT - Client8) SY-UNAME - Logon User Name9) SY-DATLO - Local Date10) SY-DATUM - Server Date11) SY-TIMLO - Local Time12) SY-UZEIT - Server Time13) SY-DYNNR - Screen Number14) SY-REPID - Current ABAP program15) SY-TCODE - Transaction Code16) SY-ULINE - Horizontal Line17) SY-VLINE - Vertical Line18) SY-INDEX - Number of current loop Pass19) SY-TABIX - Current line of internal table20) SY-DBCNT - Number of table entries processed21) SY-SUBRC - Return Code22) SY-UCOMM - Function Code23) SY-LINCT - Page Length of list24) SY-LINNO - Current Line25) SY-PAGNO - Current Page Number26) SY-LSIND - Index of List27) SY-MSGID - Message Class28) SY-MSGNO - Message Number29) SY-MSGTY - Message Type30) SY-SPONO - Spool number during printing36) What is the difference between Primary key and Unique Key?Ans Primary Key – It can accepts 0 value and cannot be NULL.Unique Key – It can be NULL. 37) What is the transaction code for Table maintenance?Ans SM3038) If u are using Logical Databases how will u modify the selection-screen elements?Ans Select-options : dname for deptt-dname.39) What is an RFC?Ans Remote Function Call40) If u are using RFC and passing values to a remote system how does it work?Ans41) What are the events in Screen Programming?Ans There are two events in Screen Programming:1. PBO (Process Before Output) – Before the screen is displayed, the PBO event is processed.2. PAI (Process After Input) – When the user interacts with the screen, the PAI event is processed.3. POH (Process On Help) - are triggered when the user requests field help (F1). You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.4. POV (Process On Value) - are triggered when the user requests possible values help (F4). You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.42) What is the significance of HIDE?Ans Its stores the click value and display the related record in the secondary list.43) Where do u code the HIDE statement?Ans In a LOOP statement44) Types of BDC's?Ans There are two types of BDC’s:1) Transaction Method2) Session Method45) Advantages &amp;amp; Disadvantages of different types of BDC's?Ans Transaction Method:1) It is faster than session method.2) While executing, it starts from starting.Session Method:1) It is slower than transaction method.2) While executing, it does not start from starting.46) What are the events used in Interactive Reports.Ans There are three events of Interactive Reports:I. At PF(nn)II. At line-selectionIII. At user-command47) What is an RDBMS?Ans RDBMS – Relational Database Management System. It helps to create relationship between two or more table.48) What standards u use to follow while coding ABAP programs?Ans 49) What will you code in START-OF-SELECTION &amp; END-OF-SELECTON &amp;amp; why?Ans START-OF-SELECTIONSELECT * FROM DEPTT INTO CORRESPONDING FIELDS OF ITABWHERE DEPTNO IN DEPTNO.APPEND ITAB.ENDSELECT.LOOP AT ITAB.WRITE : / 10 ITAB-DEPTNO.HIDE : ITAB-DEPTNO.ENDLOOP.END-OF-SELECTION50) What are joins and different types joins?Ans There are four types of Joins:1) Self Join2) Inner Join3) Outer Join4) Equi Join51) Which is the default join?Ans52) How do u display a data in a Detail List?Ans By using two statements:1) Top-of-page during line-selection2) At line-selection53) What are the types of windows in SAP Script?Ans There are five Standard Layouts in SAP Script:1) Page2) Window3) Page Window4) Paragraph Format5) Character Format54) What are the function modules used in a SAP Script driver program?Ans There are three functions used in SAP Script:1) OPEN_FORM2) WRITE_FORM3) CLOSE_FORM55) What are Extracts?Ans Extracts are dynamic sequential datasets in which different lines can have different structures. We can access the individual records in an extract dataset using a LOOP.56) How would u go about improving the performance of a Program, which selects data from MSEG &amp; MKPF?Ans57) How does System work in case of an Interactive Report?Ans58) What is LUW?Ans Logical Unit of Work59) Different types of LUWs. What r they?Ans Two types of LUW are:1) DB LUW - A database LUW is the mechanism used by the database to ensure that its data is always consistent. A database LUW is an inseparable sequence of database operations that ends with a database commit. The database LUW is either fully executed by the database system or not at all. Once a database LUW has been successfully executed, the database will be in a consistent state. If an error occurs within a database LUW, all of the database changes since the beginning of the database LUW are reversed. This leaves the database in the state it had before the transaction started.2) SAP LUW - A logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW is called an SAP LUW. Unlike a database LUW, an SAP LUW can span several dialog steps, and be executed using a series of different work processes.60) What is First event triggered in program?Ans61) What are various Joins? What is right outer join?Ans62) How do u find out whether a file exits on the presentation server?Ans eps_get_directory_listing for directory63) Systems fields used for Interactive Lists AND ListsAns Interactive System Fields: SY-LSIND, SY-CPAGE, SY-LILLI, SY-LISEL, SY-LISTI,SY-LSTAT, SY-STACO, SY-STAROLists: SY-COLNO, SY-LINCT, SY-LINNO, SY-LINSZ, SY-PAGNO,SY-TVAR0…..SY-TVAR9, SY-WTITL64) Logo in SAP Script?Ans RSTXLDMC ORSteps for making and inserting Logo in SAP Script:First Procedure:1) Draw the picture2) Save it3) /nSE784) Write name &amp;amp; Choose Color5) Click on Import6) Browse picture7) EnterSecond Procedure1) /nSE712) Insert3) Graphics4) Click on stored on document server5) Execute6) Choose name of BMAP65) What are the difference between call screen and leave screen? Ans Call Screen: Calling a single screen is a special case of embedding a screen sequence. If you want to prevent the called screen from covering the current screen completely, you can use the CALL SCREEN statement with the STARTING AT and ENDING ATCALL SCREEN 1000.CALL SCREEN 1000 STARTING AT 10 10 ENDING AT 20 20.LEAVE SCREEN statement ends the current screen and calls the subsequent screen.LEAVE SCREEN.LEAVE TO SCREEN 2000.66) If internal table used in for all entries in empty then what happensAns No, records will be displayed.67) If I forgot some command in SAP Script e.g.: suppress zero display - How to do find it?Ans Suppressing of entire screens is possible with this command. This command allows us to perform screen processing “in the background”. Suppressing screens is useful when we are branching to list-mode from a transaction dialog step.68) How to write a BDC - how do u go about it?Ans Steps for writing BDC1) /nSE382) Declare Tables, Data (for ITAB) and Data (for BDCITAB)3) Call function ‘Upload’.4) Write code for the First Screen, Radio Button, Filename, Change Button, Second Screen, Utilities (Create Entries), Third Screen and Save.5) Call transaction ‘SE11’ using BDCITAB mode ‘A’.6) Save, Check Errors, Activate and Execute.69) What is Performance tuning?Ans70) Define Documentation.Ans71) Brief about Testing of programs.Ans72) How do u move on to the next screen in interactive reporting?Ans Write code of the following:1) Top-of-Page during line-selection2) At line-selection73) Create any functions? How to go about it?Ans Steps for creating the Functions:First Procedure:1) /nSE372) Goto3) Function Group (FG)4) Create Group5) Name of FG (ZREKHA_FG)6) Short Text7) Save8) Local ObjectSecond Procedure1) Environment2) Inactive Object3) Function Group (ZREKHA_FG)4) Activate5) BackThird Procedure1) Name of Function Module (ZREKHA_FM)2) Create3) Write FG Name (ZREKHA_FG)4) Short Text5) SaveFourth Step:Call function ‘ZREKHA_FM’.74) Advanced topics?Ans75) Function modules used in F4 help.Ans There are two types of function modules used in F4 help:1) F4IF_FIELD_VALUE_REQUEST2) F4IF_INT_TABLE_VALUE_REQUEST76) Work most on which module: Name a few tables.Ans Sales &amp; Distribution Module1) Sales Document: Item Data – VBAP2) Sales Document: Partner – VBPA3) Sales Document: Header Data – VBAK4) Sales Document Flow – VBFA5) Sales Document: Delivery Item Data - LIPS6) Customer Master – KNA17) Material Data – MARA8) Conditions (Transaction Data) - KONV77) System Table usedAns 1) Sales Document: Item Data – VBAP2) Sales Document: Partner – VBPA3) Sales Document: Header Data – VBAK4) Sales Document Flow – VBFA5) Sales Document: Delivery Item Data - LIPS6) Customer Master – KNA17) Material Data – MARA8) Conditions (Transaction Data) - KONV78) From a table how do u find whether a material is used in another material BOM?Ans79) What is read line?Ans READ LINE and READ CURRENT LINE – These statements are used to read data from the lines of existing list levels. These statements are closely connected to the HIDE technique.80) How u used logical database? How is data transferred to program? Corresponding statement in LDB.Ans 81) How do u suppress fields on selection screen generated by LDB?Ans82) Can there be more than 1 main window in SAP Script?Ans No, there cannot be more than 1 main window in SAP Script because in WRITE_FORM, it asks for the parameter Window that will create the problem. WRITE_FORM –ExportingElementWindow83) Global and local data in function modules.Ans84) What are the differences between SAP memory and ABAP memory?Ans ABAP Memory is a memory area in the internal session (roll area) of an ABAP program. Data within this area is retained within a sequence of program calls, allowing you to pass data between programs that call one another. It is also possible to pass data between sessions using SAP Memory.SAP Memory is a memory area to which all sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session (as with ABAP memory) or to pass data from one session to another.85) What are differences between At selection-screen and At selection-screen output?Ans AT SELECTION-SCREEN event is triggered in the PAI of the selection screen once the ABAP runtime environment has passed all of the input data from the selection screen to the ABAP program.AT SELECTION-SCREEN OUTPUT - This event block allows you to modify the selection screen directly before it is displayed.86) What are the events?Ans 87) What is get cursor field? Ans GET CURSOR statement transfers the name of the screen element on which the cursor is positioned during a user action into the variable .GET CURSOR FIELD [OFFSET ] [LINE ] [VALUE ] LENGTH ].88) What is the inside concept in select-options? Ans Select-options specify are displayed on the selection screen for the user to enter values.Different Properties of Select-options:1) Visible Length2) Matchcode Object3) Memory ID4) Lowercase5) Obligatory6) No Display7) Modify ID89) What is the difference between occurs 1 and occurs 2?Ans 90) What is the difference between Free and Refresh?Ans Free - You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.Refresh - This always applies to the body of the table. As with the CLEAR statement, the memory used by the table before you initialized it remains allocated. To release the memory space, use the statement91) What are elements?Ans92) Can we have more than one selection-screen and how?Ans Yes, we can have more than one selection screen.Selection-screen begin of block honey with frame title text-101.Select-options : deptno for zrekha_deptt-deptno.Selection-screen end of block honey.Selection-screen begin of block honey1 with frame title text-102.Select-options : dname for zrekha_deptt-dname.Selection-screen end of block honey1.93) How to declare select-option as a parameter?Ans SELECT-OPTIONS: specify are displayed on the selection screen for the user to enter values.Parameters: dname like dept-dname.Select-options: dname for dept-dname.94) How can u write programmatically value help to a field without using search help andmatch codes?Ans By using two types of function modules to be called in SAP Script:1) HELP_OBJECT_SHOW_FOR_FIELD2) HELP_OBJECT_SHOW95) What are the differences between SE01, SE09 and SE10?Ans SE01 - Correction &amp;amp; Transport OrganizerSE09 - Workbench OrganizerSE10 - Customizing Organizer96) How to set destination?Ans97) What are the function module types?Ans98) What are tables?Ans Tables : ZREKHA_EMP.It creates a structure – the table work area in a program for the database tables, views or structure ZREKHA_EMP. The table work area has the same name as the object for which we created it. ZREKHA_EMP must be declared in the ABAP dictionary. The name and sequence of fields in the table work area ZREKHA_EMP corresponds exactly to the sequence of fields in the database table, view definition in the ABAP dictionary.99) What are client-dependant tables and independent tables?Ans100) How to distinguish client-dependant tables from independent tables?Ans101) What is the use of Table maintenance allowed?Ans Mark the Table maintenance allowed flag if users with the corresponding authorization may change the data in the table using the Data Browser (Transaction SE16). If the data in the table should only be maintained with programs or with the table view maintenance transaction (Transaction SM30), you should not set the flag.102) How to define Selection Screen?Ans Parameters, Select-options &amp; Selection-Screen103) What are the check tables and value tables?Ans Check Table: The ABAP Dictionary allows you to define relationships between tables using foreign keys . A dependent table is called a foreign key table, and the referenced table is called the check table. Each key field of the check table corresponds to a field in the foreign key table. These fields are called foreign key fields. One of the foreign key fields is designated as the check field for checking the validity of values. The key fields of the check table can serve as input help for the check field.Value Table: Prior to Release 4.0, it was possible to use the value table of a domain to provide input help. This is no longer possible, primarily because unexpected results could occur if the value table had more than one key field. It was not possible to restrict the other key fields, which meant that the environment of the field was not considered, as is normal with check tables.In cases where this kind of value help was appropriate, you can reconstruct it by creating a search help for the data elements that use the domain in question, and using the value table as the selection method.Check table will be at field level checking.Value table will be at domain level checking ex: scarr table is check table for carrid.104) What is the difference between tables and structures?Ans Tables:1) Data is permanently stored in tables in the database.2) Database tables are generated from them.Structure:1) It contains data temporarily during program run-time.2) No Database tables are generated from it. 105) How to declare one internal table without header line without using structures?Ans No, we cannot declare internal table without header line and without structure because it gives error “ITAB cannot be a table, a reference, a string or contain any of these object”.Code with Header without StructureTABLES : ZREKHA_EMP.DATA : ITAB LIKE ZREKHA_EMP OCCURS 0 WITH HEADER LINE.SELECT * FROM ZREKHA_EMP INTO CORRESPONDING FIELDS OF ITAB.APPEND ITAB.ENDSELECT.LOOP AT ITAB.WRITE : / ITAB-EMPNO, ITAB-EMPNAME,ITAB-DEPTNO.ENDLOOP.Code without Header with StructureTABLES : ZREKHA_EMP.DATA : BEGIN OF ITAB OCCURS 0,EMPNO LIKE XREKHA_EMP-EMPNO,EMPNAME LIKE XREKHA_EMP-EMPNAME,DEPTNO LIKE XREKHA_EMP-DEPTNO,END OF ITAB.SELECT * FROM ZREKHA_EMP INTO CORRESPONDING FIELDS OF ITAB.APPEND ITAB.ENDSELECT.LOOP AT ITAB.WRITE : / ITAB-EMPNO, ITAB-EMPNAME,ITAB-DEPTNO.ENDLOOP.106) What are lock objects?Ans Reason for Setting Lock: Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules (see Function Modules for Lock Requests). These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.Two types of Lock: Shared and Exclusive107) What are datasets? What are the different syntaxes?Ans The sequential files (ON APPLICATION SERVER) are called datasets. They are used for file handling in SAP.OPEN DATASET [DATASET NAME] FOR [OUTPUT / INPUT / APPENDING]IN [BINARY / TEXT] MODEAT POSITION [POSITION]MESSAGE [FIELD]READ DATASET [DATASET NAME] INTO [FIELD]DELETE DATASET [DATASET NAME]CLOSE DATASET [DATASET NAME]TRANSFER [FIELD] TO [DATASET NAME]108) What are the events we use in dialog programming and explain them?Ans There are two events in Dialog Programming i.e. screen:1. PBO (Process Before Output) – Before the screen is displayed, the PBO event is processed.2. PAI (Process After Input) – When the user interacts with the screen, the PAI event is processed.3. POH (Process On Help) - are triggered when the user requests field help (F1). You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.4. POV (Process On Value) - are triggered when the user requests possible values help (F4). You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.109) What is the difference between OPEN_FORM and CLOSE_FORM?Ans OPEN_FORM – This module opens layout set printing. This function must be called up before we can work with other layout set function like WRITE_FORM.WRITE_FORM – Output text element in form window. The specified element of the layout set window entered is output. The element must be defined in the layout set.CLOSE_FORM – End layout set printing. Form printing started with OPEN_FORM is completed. Possible closing operations on the form last opened are carried out. Form printing must be completed by this function module. If this is not carried out, nothing is printed or displayed on the screen.110) What are the page windows? How many main windows will be there in a page window?Ans Page Window: In this window, we define the margins for left, width, upper and height for the layout of Header, Logo, Main, &amp;amp; Footer.111) What are control events in a loop?Ans Control level processing is allowed within a LOOP over an internal table. This means that we can divide sequences of entries into groups based on the contents of certain fields.AT .ENDAT.You can react to the following control level changes:Meaning FIRST First line of the internal table LAST Last line of the internal table NEW Beginning of a group of lines with the same contents in the field and in the fields left of END Of End of a group of lines with the same contents in the field and in the fields left of 112) How to debugg a script?Ans Go to SE71, give layout set name, go to utilities select debugger mode on.113) How many maximum sessions can be open in SAPgui?Ans There are maximum 6 sessions open in SAPgui.114) SAP Scripts and ABAP programs are client dependent or not? Why?Ans115) What are System Variable?Ans System variables have been predefined by SAP. We can use these variables in formulas or, for example, to pass on certain pieces of information to a function module. How the function called by the function module behaves depends on the type of information passed on.At present, we can use the following system variables:System Variable Use Meaning SY_MODE In function modules Current mode of the PI sheet SY_TEST In function modules Status of the PI sheet (test or active) SY_ROW In function modules Current table line SY_VALUE or X Generally Refers to the immediately preceding input value 116) Is it compulsory to use all the events in Reports?Ans 117) What is the difference between sum and collect? Ans Sum: You can only use this statement within a LOOP. If you use SUM in an AT - ENDAT block, the system calculates totals for the numeric fields of all lines in the current line group and writes them to the corresponding fields in the work area. If you use the SUM statement outside an AT - ENDAT block (single entry processing), the system calculates totals for the numeric fields of all lines of the internal table in each loop pass and writes them to the corresponding fields of the work area. It therefore only makes sense to use the SUM statement in AT...ENDAT blocks.If the table contains a nested table, you cannot use the SUM statement. Neither can you use it if you are using a field symbol instead of a work area in the LOOP statement.Collect:118) What are session method and call transaction method and explain about them?Ans Session method – Use the BDC_OPEN_GROUP to create a session. Once we have created a session, then we can insert the batch input data into it with BDC_INSERT. Use the BDC_INSERT to add a transaction to a batch input session. We specify the transaction that is to be started in the call to BDC_INSERT. We must provide a BDCDATA structure that contains all the data required to process the transaction completely. Use the BDC_CLOSE_GROUP to close a session after we have inserted all of our batch input data into it. Once a session is closed, it can be processed.Call Transaction -In this method, we use CALL TRANSACTION USING to run an SAP transaction. External data does not have to be deposited in a session for later processing. Instead, the entire batch input process takes place inline in our program.119) If you have 10000 records in your file, which method you use in BDC?Ans Call transaction is faster then session method. But usually we use session method in real time...because we can transfer large amount of data from internal table to database and if any errors in a session, then process will not complete until session get correct.120) What are different modes of Call Transaction method and explain them?Ans There are three modes of Call Transaction method:1) A – Display All Screens 2) E – Display Errors3) N – Background Processing--------------------------------------------------------------------------------------------------------------------121) What is the typical structure of an ABAP program?Ans HEADER, BODY, FOOTER.122) What are field symbols and field groups? Have you used "component idx of structure" clause with field groups?Ans Field Symbols – They are placeholder or symbolic names for the other fields. They do not physically reserve space for a field, but point to its contents. It can point to any data objects.Field-symbols Field Groups – Field groups does not reserve storage space but contains pointers to existing fields.An extract dataset consists of a sequence of records. These records may have different structures. All records with the same structure form a record type. You must define each record type of an extract dataset as a field group, using the FIELD-GROUPS statement.Field-groups 123) What should be the approach for writing a BDC program?Ans STEP 1: CONVERTING THE LEGACY SYSTEM DATA TO A FLAT FILEto internal table CALLED "CONVERSION".STEP 2: TRANSFERING THE FLAT FILE INTO SAP SYSTEM CALLED"SAP DATA TRANSFER".STEP 3: DEPENDING UPON THE BDC TYPEi) Call transaction (Write the program explicitly)ii) Create sessions (sessions are created and processed. If success, data will transfer).124) What is a batch input session?Ans BATCH INPUT SESSION is an intermediate step between internal table and database table. Data along with the action is stored in session i.e. data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed.Create session – BDC_OPEN_GROUPInsert batch input – BDC_INSERTClose session – BDC_CLOSE_GROUP125) What is the alternative to batch input session?Ans Call Transaction Method &amp; Call Dialog126) A situation: An ABAP program creates a batch input session. We need to submit theprogram and the batch session in background. How to do it?Ans Go to SM36 and create background job by giving job name, job class and job steps(JOB SCHEDULING)127) What is the difference between a pool table and a transparent table and how they arestored at the database level?Ans Pool Table -1) Many to One Relationship.2) Table in the Dictionary has the different name, different number of fields, and the fields have the different name as in the R3 Table definition.3) It can hold only pooled tables.Transparent Table –1) One to One relationship.2) Table in the Dictionary has the same name, same number of fields, and the fields have the same name as in the R3 Table definition.3) It can hold Application data.128) What are the problems in processing batch input sessions? How is batch input processdifferent from processing on line?Ans Two Problems: -1) If the user forgets to opt for keep session then the session will be automatically removed from the session queue (log remains). However, if session is processed we may delete it manually.2) If session processing fails, data will not be transferred to SAP database table.129) Is Session Method, Asynchronous or Synchronous?Ans Synchronous130) What are the different types of data dictionary objects?Ans Different types of data dictionary objects:1) Tables2) Views3) Data elements4) Structure5) Domains6) Search Helps7) Local Objects8) Matchcode131) How many types of tables exist and what are they in data dictionary?Ans 4 Types of Tables:1. Transparent tables - Exists with the same structure both in dictionary as well as in database exactly with the same data and fields. Both Open SQL and Native SQL can be used.2. Pool tables3. Cluster tables - These are logical tables that are arranged as records of transparent tables. One cannot use Native SQL on these tables (only Open SQL). They are not manageable directly using database system tools.4. Internal tables132) What is the step-by-step process to create a table in data dictionary?Ans Steps to create a table:Step 1: creating domains (data type, field length, Range).Step 2: creating data elements (properties and type for a table field).Step 3: creating tables (SE11).133) Can a transparent table exist in data dictionary but not in the database physically?Ans No, Transparent table do exist with the same structure both in the dictionary as well as in the database, exactly with the same data and fields.134) In SAP Scripts, how will u link FORM with the Event Driven? Ans In PAI, define function code and write code for the same.135) Can you create a table with fields not referring to data elements?Ans YES. e.g.:- ITAB LIKE SPFLI.Here we are refering to a data object (SPFLI) not data element.136) What is the advantage of structures? How do you use them in the ABAP programs?Ans GLOBAL EXISTANCE (these could be used by any other program without creating it again).137) What does an extract statement do in the ABAP program?Ans Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements: EXTRACT .When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the datasetEXTRACT HEADER.When you extract the data, the record is filled with the current values of the corresponding fields.As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.138) What is a collect statement? How is it different from append?Ans Collect : If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.Append – Duplicate entries occurs.139) What is OPEN SQL vs NATIVE SQL?Ans Open SQL – These statements are a subset of standard SQL. It consists of DML command (Select, Insert, Update, Delete). It can simplify and speed up database access. Buffering is partly stored in the working memory and shared memory. Data in buffer is not always up-to-date.Native SQL – They are loosely integrated into ABAP. It allows access to all functions containing programming interface. They are not checked and converted. They are sent directly to the database system. Programs that use Native SQL are specific to the database system for which they were written. For e.g. to create or change table definition in the ABAP.140) What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?Ans To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:EXEC SQL [PERFORMING ].ENDEXEC.There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.141) What is the meaning of ABAP editor integrated with ABAP data dictionary?Ans ABAP Editor: Tool in the ABAP Workbench in which you enter the source code of ABAP programs and check their syntax. You can also navigate from the ABAP Editor to the other tools in the ABAP Workbench.142) What are the events in ABAP language?Ans The events are as follows:1. Initialization2. At selection-screen3. Start-of-selection4. End-of-selection5. Top-of-page6. End-of-page7. At line-selection8. At user-command9. At PF10. Get11. At New12. At LAST13. AT END14. AT FIRST143) What is an interactive report? What is the obvious difference of such report comparedwith classical type reports?Ans An Interactive report is a dynamic drill down report that produces the list on users choice.Difference: -a) The list produced by classical report doesn't allow user to interact with the system where as the list produced by interactive report allows the user to interact with the system.B) Once a classical report, executed user looses control where as Interactive, user has control.C) In classical report, drilling is not possible where as in interactive, drilling is possible.144) What is a drill down report?Ans Its an Interactive report where in the user can get more relevant data by selecting explicitly.145) How do you write a function module in SAP? Describe.Ans 1. Called program - SE37 - Creating function group, function module by assigning attributes, importing, exporting, tables, and exceptions.2. Calling program - SE38 - In program, click pattern and write function name- provide export, import, tables, exception values.146) What are the exceptions in function module?Ans Exceptions: Our function module needs an exception that it can trigger if there are no entries in table SPFLI that meet the selection criterion. The exception NOT_FOUND serves this function.COMMUNICATION_FAILURE &amp;amp; SYSTEM_FAILURE 147) Ans148) How are the date and time field values stored in SAP?Ans DD.MM.YYYY. HH:MM:SS149) What are the fields in a BDC_Tab and BDCDATA Table?Ans Fields of BDC_Tab &amp;amp; BDCDATA Table:Sr.No Fields - Description1) Program - BDC Module pool2) Dynpro - BDC Screen Number3) Dynbegin - BDC Screen Start4) Fname - Field Name5) Fval - BDC field value150) Name a few data dictionary objects?Ans Different types of data dictionary objects:1) Tables2) Views3) Data elements4) Structure5) Matchcode6) Domains7) Search Helps8) Local Objects151) What happens when a table is activated in DD?Ans When the table is activated, a physical table definition is created in the database for the table definition stored in the ABAP dictionary. The table definition is translated from the ABAP dictionary of the particular database. It is available for any insertion, modification and updation of records by any user.152) Ans153) What are matchcodes? Describe?Ans It is similar to table index that gives list of possible values for either primary keys or non-primary keys.154) What transactions do you use for data analysis?Ans155) What are the elements of selection screen?Ans There are 5 elements of selection screen:Selection-screen include blocks Selection-screen include parameters&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-2047877626305160159?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/2047877626305160159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=2047877626305160159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/2047877626305160159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/2047877626305160159'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2007/08/some-usefull-faq.html' title='some usefull FAQ'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-2944727675839729046</id><published>2007-08-25T20:03:00.000-07:00</published><updated>2007-08-25T20:04:11.005-07:00</updated><title type='text'>Notes on Window services</title><content type='html'>Everyone wants to know at what time they are starting and shutdown their system daily. How much time, system is running daily. It would be better to show startup, shutdown and time spent timings in a DataGrid.                      Here, I am providing a solution to do this using Windows Service in C#.NET. Everyone knows about Windows Service. But for introduction sake, I will explain little bit about Windows Service. Then, we can see how to design the application.&lt;br /&gt;What is a Windows Service?&lt;br /&gt;Windows Service is nothing but process running in background without our knowledge. It mostly won't require User interaction. If we type "services.msc" in Run of Start Menu, we can see what are the services running in our system. Some will start automatically, when system starts. But some services has to be started by us manually.&lt;br /&gt;Advantages of Windows Service:&lt;br /&gt;1.   It can be run automatically.&lt;br /&gt;2.   It wont require User-Interaction&lt;br /&gt;3.   It runs in background&lt;br /&gt;Normally, Windows Service is used to run time-consuming processes, like taking backup of a database.&lt;br /&gt;Now, we are going to design a windows service to record startup and shutdown timings of your system. I had designed this application using Visual Studio 2003.&lt;br /&gt;Step 1:&lt;br /&gt;First open Visual Studio and select Visual C# Projects. Select Template as Windows Service. Give name as Monitoring as shown in figure below:&lt;br /&gt;Step 2:&lt;br /&gt;Open Code Window by pressing F7. Next include using System.IO namespace for writing system timings into a file. Next find Service1 word and replace all occurrences with Monitoring word. It will change namespace, classname, constructor name... to Monitoring. After that go to design mode(by pressing shift+F7). Select Solution Explorer(by pressing Ctrl+Alt+L). Click on Service1.cs and rename it to Monitoring.cs.&lt;br /&gt;After that go to code window. And write this code in OnStart event.&lt;br /&gt;As shown in figure:&lt;br /&gt;I will explain what I am doing in OnStart event:&lt;br /&gt;First create a xml file in c drive with file1 as name.And write this code in that file:&lt;br /&gt;&lt;?xml version="1.0" encoding="utf-8" standalone="no"?&gt;&lt;times&gt;&lt;br /&gt;And close it.&lt;br /&gt;I am creating a service, which will start automatically start and record startup time. It will shutdown, when system shutdowns. And it will record shutdown time and time spent on system.&lt;br /&gt;First, I am creating StreamWriter to write startup time of system into file1.xml.&lt;br /&gt;After copying the code to your OnStart event. Create a public variable temp, just above Monitoring Constructor as shown below:&lt;br /&gt;After that, copy this code into your code window:&lt;br /&gt;Copy this code to OnStart event as shown in figure:&lt;br /&gt;StreamWriter writer=File.AppendText("d:\\file1.xml");   writer.Write("&lt;time&gt;");   writer.WriteLine("&lt;date&gt; "+ (DateTime.Now.ToString("dd-MM-yy"))+"&lt;/date&gt;");   writer.WriteLine("&lt;started&gt; "+ (DateTime.Now.ToString("t"))+"&lt;/started&gt;");   temp=DateTime.Now;    writer.Close();&lt;br /&gt;I will explain what I am doing in OnShutdown event:&lt;br /&gt;I again opened file1.xml using a StreamWriter, when system is going to shutdown. It will write shutdown time. It will also write timespan between system startup and shutdown timings. I used a temp variable in OnStart and OnShutdown event. It is used in OnStart to store Startup time. It is used again OnShutdown event, to know time interval between start and shutdown timings.&lt;br /&gt;Next, we have to configure our Windows Service for installation and running.&lt;br /&gt;So, first go to design view and select properties(by pressing F4) window.&lt;br /&gt;Set CanStop and CanShutdown to true. Next to install, we have to add a Installer.&lt;br /&gt;So, right-click on design view window. Select Add Installer. Then, it will show ProjectInstaller.cs. In that, serviceInstaller1 and serviceProcessInstaller1 are present. Go to serviceProcessInstaller1 properties:&lt;br /&gt;·         Set Account to LocalSystem.&lt;br /&gt;·         Next goto serviceInstaller1 properties:&lt;br /&gt;·         Set DisplayName and ServiceName to Monitoring.&lt;br /&gt;·         Set StartType:automatic.&lt;br /&gt;See below figure for reference:&lt;br /&gt;&lt;br /&gt;Next go to Command Prompt of VS.NET.&lt;br /&gt;Go to Debug folder path of Service in console:&lt;br /&gt;Type InstallUtil Monitoring.exe&lt;br /&gt;If it shows Commit Phase Completed Successfully. Then, service is installed without errors.&lt;br /&gt;Then, restart the system to start service. After restarting, open file1.xml. It has recorded start time of system. If shutdown system, it will record system shutdown time and time spent on system. By this part, we completed recording of timings of system. Next, we will create a web application to display the xml data in a Grid properly.&lt;br /&gt;In next part, I will explain how to extract that xml file data and show it in a DataGrid as shown below:&lt;br /&gt;Part-II:&lt;br /&gt;Create a web application in C#. Name it as SystemMonitor.&lt;br /&gt;Next include following namespaces:&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Xml;&lt;br /&gt;using System.Text;&lt;br /&gt;After that drag DataGrid and Label control onto the page as shown below:&lt;br /&gt;Next copy following code into Page_Load event:&lt;br /&gt;File.Copy("c:\\file1.xml","c:\\temp1.xml",true);&lt;br /&gt;StreamWriter     writer1=File.AppendText("c:\\temp1.xml");&lt;br /&gt;writer1.Write("&lt;shutdown&gt;undefined&lt;/shutdown&gt;");&lt;br /&gt;writer1.Write("&lt;timespent&gt;undefined&lt;/timespent&gt;");&lt;br /&gt;writer1.Write("&lt;/time&gt;");&lt;br /&gt;writer1.WriteLine("&lt;/times&gt;");&lt;br /&gt;writer1.Close();&lt;br /&gt;DataSet ds=new DataSet();&lt;br /&gt;ds.ReadXml("c:\\temp1.xml");&lt;br /&gt;TimeSpan t=new TimeSpan();&lt;br /&gt;DataGrid1.DataSource=ds;&lt;br /&gt;DataGrid1.DataBind();&lt;br /&gt;XmlTextReader reader=new XmlTextReader("c:\\temp1.xml");&lt;br /&gt;while(reader.Read())&lt;br /&gt;{&lt;br /&gt;          if(reader.NodeType==XmlNodeType.Element)&lt;br /&gt;          {&lt;br /&gt;                   if(reader.Name=="timespent")&lt;br /&gt;                   {&lt;br /&gt;                             string temp11=reader.ReadInnerXml().ToString();&lt;br /&gt;                             if(temp11!="undefined")&lt;br /&gt;                             {&lt;br /&gt;                                      temp11=temp11.Replace(":",".");&lt;br /&gt;                                      temp11=temp11.Replace(" ","");&lt;br /&gt;                                      duration +=Convert.ToDouble(temp11);&lt;br /&gt;                             }&lt;br /&gt;                   }&lt;br /&gt;          }&lt;br /&gt;}&lt;br /&gt;Response.Write("Total Duration is :  ");&lt;br /&gt;double temp122=Convert.ToDouble(duration);&lt;br /&gt;string hr=temp122.ToString();&lt;br /&gt;string hrstr=hr.Substring(0,hr.IndexOf("."));&lt;br /&gt;Response.Write(hrstr.ToString()+" Hours");&lt;br /&gt;string mins=hr.Substring(hr.IndexOf(".")+1,(hr.Length -hr.IndexOf(".")-1));&lt;br /&gt;Response.Write("   "+mins.ToString()+" Minutes");&lt;br /&gt;reader.Close();&lt;br /&gt;File.Delete("c:\\temp1.xml");&lt;br /&gt;Next, paste this declaration above Page_Load  event:&lt;br /&gt;private double duration;&lt;br /&gt;I will explain what I have done in Page_Load event:&lt;br /&gt;First, I copied contents of file1.xml(which contains timings of system) to temporary file. Then, I am appending some tag to that temp file. Afterwards, I am reading contents of temp into a dataset and finally binding it to a DataGrid. Afterwards, I written logic to find total time spent. I hope, everyone can understand  that code.&lt;br /&gt;Finally, the page output will be like this:&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-2944727675839729046?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/2944727675839729046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=2944727675839729046' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/2944727675839729046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/2944727675839729046'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2007/08/notes-on-window-services.html' title='Notes on Window services'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-7049472504510742780</id><published>2007-08-25T20:00:00.000-07:00</published><updated>2007-08-25T20:02:37.787-07:00</updated><title type='text'>Window Service</title><content type='html'>its time for one more tutorial. This times pick is Windows Services. Creating Windows Services is not a big deal using C# and Visual Studio. Just follow few simple steps and you are all set to run and test your first Windows Service.&lt;br /&gt;Windows Services is new name for NT Services you used to develop in previous versions of Visual Studio. This tutorial walks you through how to create and use your Windows Services. This Service writes some text to a text file when stop and start the service. The base idea is taken from MSDN but its more elaborated. You can modify it according to your needs.&lt;br /&gt;Step 1. Create Skeleton of the Service&lt;br /&gt;To create a new Window Service, pick Windows Service option from your Visual C# Projects, give your service a name, and click OK.&lt;br /&gt;The result look like this. The Wizard adds WebService1.cs class to your project.&lt;br /&gt;Set your ServiceName to your own name so it would be easier to recognize your service during testing OR you can set this property programmatically using this line this.ServiceName = "mcWinService";&lt;br /&gt;This is the name you will be looking for later :).&lt;br /&gt;The default code of WebService1.cs added by the Wizard looks like here&lt;br /&gt;namespace mcWinService { using System; using System.Collections; using System.Core; using System.ComponentModel; using System.Configuration; using System.Data; using System.Web.Services; using System.Diagnostics; using System.ServiceProcess; public class WinService1 : System.ServiceProcess.ServiceBase { /// &lt;summary&gt; /// Required designer variable. /// &lt;/summary&gt; private System.ComponentModel.Container components; public WinService1() { // This call is required by the WinForms Component Designer. InitializeComponent(); // TODO: Add any initialization after the InitComponent call } // The main entry point for the process static void Main() { System.ServiceProcess.ServiceBase[] ServicesToRun; // More than one user Service may run within the same process. To add // another service to this process, change the following line to / create a second service object. For example, // // ServicesToRun = New System.ServiceProcess.ServiceBase[] {new WinService1(), new ySecondUserService()}; // ServicesToRun = new System.ServiceProcess.ServiceBase[] { new WinService1() }; System.ServiceProcess.ServiceBase.Run(ServicesToRun); } /// &lt;summary&gt; /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// &lt;/summary&gt; private void InitializeComponent() { components = new System.ComponentModel.Container(); this.ServiceName = "WinService1"; } /// &lt;summary&gt; /// Set things in motion so your service can do its work. /// &lt;/summary&gt; protected override void OnStart(string[] args) { // TODO: Add code here to start your service. } /// &lt;summary&gt; /// Stop this service. /// &lt;/summary&gt; protected override void OnStop() { // TODO: Add code here to perform any tear-down necessary to stop your service. } } } Step 2. Add functionality to your service&lt;br /&gt;As you saw WebService1.cs, there are two overridden functions OnStart and OnStop. The OnStart function executes when you start your service and the OnStop function gets execute when you stop a service. I write some text to a text file when you start and stop the service.&lt;br /&gt;protected override void OnStart(string[] args) { FileStream fs = new FileStream(@"c:\temp\mcWindowsService.txt" , FileMode.OpenOrCreate, FileAccess.Write); StreamWriter m_streamWriter = new StreamWriter(fs); m_streamWriter.BaseStream.Seek(0, SeekOrigin.End); m_streamWriter.WriteLine(" mcWindowsService: Service Started \n"); m_streamWriter.Flush();m_streamWriter.Close(); } /// &lt;summary&gt; /// Stop this service. /// &lt;/summary&gt; protected override void OnStop() { FileStream fs = new FileStream(@"c:\temp\mcWindowsService.txt" , FileMode.OpenOrCreate, FileAccess.Write); StreamWriter m_streamWriter = new StreamWriter(fs); m_streamWriter.BaseStream.Seek(0, SeekOrigin.End); m_streamWriter.WriteLine(" mcWindowsService: Service Stopped \n"); m_streamWriter.Flush();m_streamWriter.Close(); }  Step 3: Install and Run the ServiceBuild of this application makes one exe, mcWinService.exe. You need to call installutil to egister this service from command line. installutil C:\mcWinService\bin\Debug\mcWinService.exeYou use /u option to uninstall the service. installutil /u C:\mcWinService\bin\Debug\mcWinService.exeRun the application&lt;br /&gt;Step 4: Start and Stop the Service&lt;br /&gt;You need to go to the Computer Management to Start to start and stop the service. You can use Manage menu item by right clicking on My Computer. &lt;br /&gt;Under Services and Applications, you will see the service mcWinService. Start and Stop menu item starts and stops the service.&lt;br /&gt;Step 5: Test the Service&lt;br /&gt;Go to your temp directory and see if text file is there with contents or not.&lt;br /&gt;That's it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-7049472504510742780?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/7049472504510742780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=7049472504510742780' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/7049472504510742780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/7049472504510742780'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2007/08/window-service.html' title='Window Service'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-7922906984017471168</id><published>2007-08-25T19:51:00.000-07:00</published><updated>2007-08-25T19:59:18.252-07:00</updated><title type='text'>Easy steps to make SQL Server Reporting Services</title><content type='html'>This article features the following:&lt;br /&gt;Building of Business Intelligence Report.&lt;br /&gt;Deploying the Reports on the Report Server&lt;br /&gt;Reporting in ASP.NET.&lt;br /&gt;1) Business Intelligence Report:&lt;br /&gt;New project form Visual Studio 2005 go for Business Intelligence and Select Report Server Project Wizard consists of two separate folders Share Data Sources and Reports.&lt;br /&gt;Shared data source is the data source, which consists of the connection string of the database. We can use the same data source for different reports, which are used to retrieve the data from the same database. We have to use different data sources for the different databases.&lt;br /&gt;First we have to create the Data Source and make it as shared one.&lt;br /&gt;dsReports  is the Share Data Source. Once the shared data source has been created this can be used for all the reports, which are pointing to the same database.&lt;br /&gt;Next step is of creating the reports. Select the report folder add new item select the report immediately the following screen is displayed with the shared data source (dsReports) selected. Here we can create the new data source as well.&lt;br /&gt;Go with next, which will ask about the query or the stored procedure we have to use. The following screen is displayed where we have to provide the either query or stored procedure "depinfo".&lt;br /&gt;Next step is the selecting the report type either Tabular or Matrix&lt;br /&gt;Next step is about displaying the report with fields in our required format.&lt;br /&gt;After this Report Wizard screen came into the picture, where we have to provide the proper name for the report and check the check box for previewing the report.&lt;br /&gt;Click finish then, since we have used stored procedure for retrieving data form the database and that store procedure having the parameter it will ask the value for displaying the report.&lt;br /&gt;After providing the parameter then click the View Report button then Report is generated as shown.&lt;br /&gt;This report contains three tab's called Data, Layout and Preview. Some modification should be done before deploying the report on the report server.&lt;br /&gt;Select the DATA tab and do the following changes, actually it will displays&lt;br /&gt;Now it has to be changed like this and in the command type we have to select the stored procedure and the stored procedure has to be changed and just  stored procedure name has to be specified.&lt;br /&gt;Select the properties of the stored procedure where we have to provide the parameter.&lt;br /&gt;Under Fields Tab you are able to see the fields that are to be displayed by the Stored Procedure.&lt;br /&gt;Under the Parameters tab you have to provide the parameters.&lt;br /&gt;Now comes to the Layout Tab where actual design of the report will be present. Change the report as per the requirements.&lt;br /&gt;All the properties for the report can be set in the Layout tab.&lt;br /&gt;Next Preview tab is mainly used for previewing the data after providing the parameters.&lt;br /&gt;After the completion next step is the deployment of the report on the report server.&lt;br /&gt;2) Deployment of the Report on the Report Server.&lt;br /&gt;To deploy the report on the report server select the properties of the Project and in the properties specify the report server in the Target Server URL field&lt;br /&gt;Then select the report and select the properties "Deploy" then the report is deployed. &lt;br /&gt;If you have face any problem you can deploy the report in another way, but you need the rights for deploying the reports on the reports server.&lt;br /&gt;To deploy the report and to use those reports on the report server you have to create the data source on the report server for maintain the connection string, this data source is also of type shared data source.&lt;br /&gt;After creating the shared data source on the report server the next step is to upload the report and for the report, this data source is assigned and set the properties.&lt;br /&gt;To upload the report go with "Upload File" select the report "DepartmentReprt.rdl".&lt;br /&gt;Next step, select the report assign the data source and set the parameters on the report server&lt;br /&gt;Select the data source and assign the data source, which created on the report server.&lt;br /&gt;After assigning the data source for the report, view the report, which in turn requires the parameter should be passed, the report can be displayed as follows&lt;br /&gt;These are the steps to be followed when the report is deployed on the report server.&lt;br /&gt;3) Reporting in ASP.NET:&lt;br /&gt;To make a call for the report which is deployed on the Report Server following steps to be followed      1. To access the report from the Report Server we have to pass the Network credentials.     2. We have to add the reference for accessing the reporting services the dll is "MicroSoft.ReportViewer.Webforms"&lt;br /&gt;In the application the following code is to be written to call the report from the report server&lt;br /&gt;protected void btnReport_Click(object sender, EventArgs e)&lt;br /&gt;{       &lt;br /&gt;    ReportParameter[] parm = new ReportParameter[1];&lt;br /&gt;    parm[0] =new ReportParameter("deptno",txtDeptno.Text);&lt;br /&gt;    ReportViewer1.ShowCredentialPrompts = false;&lt;br /&gt;    ReportViewer1.ServerReport.ReportServerCredentials = new ReportCredentials("Reportfolder Name", "Password of the folder", "");&lt;br /&gt;    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;&lt;br /&gt;    ReportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://ReportServer/ReportServer");&lt;br /&gt;    ReportViewer1.ServerReport.ReportPath = "/ReportFolder/ReportName";&lt;br /&gt;    ReportViewer1.ServerReport.SetParameters(parm);&lt;br /&gt;    ReportViewer1.ServerReport.Refresh();}&lt;br /&gt;In the above code ReportParameter are the report parameters used to display the report.&lt;br /&gt;ReportFolderName is the folder where we have deployed the report on the Report server.&lt;br /&gt;Password of the Folder this is the password for that folder on the report server.&lt;br /&gt;Next step is about the class, which implements the Microsoft.Reporting.WebForms.IReportServerCredentials interface for accessing the reports.&lt;br /&gt;public class ReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials&lt;br /&gt;{&lt;br /&gt;    string _userName, _password, _domain;&lt;br /&gt;    public ReportCredentials(string userName, string password, string domain)&lt;br /&gt;    {&lt;br /&gt;        _userName = userName;&lt;br /&gt;        _password = password;&lt;br /&gt;        _domain = domain;&lt;br /&gt;    }&lt;br /&gt;    public System.Security.Principal.WindowsIdentity ImpersonationUser&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            return null;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public System.Net.ICredentials NetworkCredentials&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            return new System.Net.NetworkCredential(_userName, _password, _domain);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public bool GetFormsCredentials(out System.Net.Cookie authCoki, out string userName, out string password, out string authority)&lt;br /&gt;    {&lt;br /&gt;        userName = _userName;&lt;br /&gt;        password = _password;&lt;br /&gt;        authority = _domain;&lt;br /&gt;        authCoki = new System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH", "/", "Domain");&lt;br /&gt;        return true;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;This class is mainly used for passing the report credentials to access the report.&lt;br /&gt;Next step is to click the button and the report is displayed.&lt;br /&gt;This is the process to access the SQL Server Reporting Services in the ASP.NET&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-7922906984017471168?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/7922906984017471168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=7922906984017471168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/7922906984017471168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/7922906984017471168'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2007/08/easy-steps-to-make-sql-server-reporting.html' title='Easy steps to make SQL Server Reporting Services'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-536753434200159121.post-8894285615732063445</id><published>2007-08-25T19:35:00.000-07:00</published><updated>2007-08-25T19:38:15.020-07:00</updated><title type='text'>Intention</title><content type='html'>This site is made only for developer who are doing work on MS Technologies.Please try to share your thoughts &amp;amp; share the topics that you think helpfull to others.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/536753434200159121-8894285615732063445?l=msofttech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://msofttech.blogspot.com/feeds/8894285615732063445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=536753434200159121&amp;postID=8894285615732063445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/8894285615732063445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/536753434200159121/posts/default/8894285615732063445'/><link rel='alternate' type='text/html' href='http://msofttech.blogspot.com/2007/08/intention.html' title='Intention'/><author><name>Manab Ranjan Basu</name><email>manab.it@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='04142071894820288618'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>