c# print barcode Creating a Table of Contents in Font

Draw Data Matrix 2d barcode in Font Creating a Table of Contents

Creating a Table of Contents
Creating Data Matrix In None
Using Barcode printer for Font Control to generate, create Data Matrix 2d barcode image in Font applications.
www.OnBarcode.com
Print EAN-13 In None
Using Barcode generation for Font Control to generate, create EAN-13 Supplement 5 image in Font applications.
www.OnBarcode.com
This example creates a table of contents showing the nearest planets to us in the solar system. It shows how to generate new content automatically from existing content. Without this approach, you would have to generate the list with server-side logic or by using JavaScript to manipulate the Document Object Model (DOM) and write out the contents.
Code39 Maker In None
Using Barcode creation for Font Control to generate, create USS Code 39 image in Font applications.
www.OnBarcode.com
Code-128 Printer In None
Using Barcode drawer for Font Control to generate, create Code 128 Code Set C image in Font applications.
www.OnBarcode.com
CHAPTER 6 INTRODUCTION TO XSLT
UCC-128 Creation In None
Using Barcode generator for Font Control to generate, create EAN / UCC - 13 image in Font applications.
www.OnBarcode.com
Draw PDF 417 In None
Using Barcode drawer for Font Control to generate, create PDF-417 2d barcode image in Font applications.
www.OnBarcode.com
Using XSLT to generate the table of contents is useful because You can generate the table of contents from existing XHTML, and you don t need to use server-side logic to extract the information from a database or other data source. The table of contents always reflects the current page contents, and it updates when the current page changes; you ll see an example a little later in this section. You reduce server load because no server-side processing is required to generate the table of contents. You can see this example in the file planets2.xml. If you open the file, you ll notice that the first line refers to a stylesheet called planets2.xsl: < xml-stylesheet type="text/xsl" href="planets2.xsl" > The planets2.xsl stylesheet follows: < xml version="1.0" encoding="UTF-8" > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" indent="yes"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match=" body"> <body> <p> <a href="http://www.nasa.gov/">Visit NASA!</a> | <a href="http://www.nineplanets.org/">Tour the solar system</a> </p> <h2>Quick reference</h2> <ul> <xsl:for-each select=" h2"> <li> <a> <xsl:attribute name="href"> #<xsl:value-of select="text()"/></xsl:attribute> <xsl:value-of select="text()"/> </a> </li> </xsl:for-each> </ul> <xsl:apply-templates/> <hr/> Copyright Planetary Fun 2006. </body> </xsl:template> <xsl:template match="h2">
Generate Quick Response Code In None
Using Barcode encoder for Font Control to generate, create Denso QR Bar Code image in Font applications.
www.OnBarcode.com
Create ISBN - 10 In None
Using Barcode printer for Font Control to generate, create ISBN - 10 image in Font applications.
www.OnBarcode.com
CHAPTER 6 INTRODUCTION TO XSLT
Recognizing Data Matrix ECC200 In Visual C#
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Data Matrix 2d Barcode Recognizer In VB.NET
Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
<a> <xsl:attribute name="name"><xsl:value-of select="text()"/></xsl:attribute> <h2> <xsl:apply-templates/> </h2> </a> </xsl:template> </xsl:stylesheet> Figure 6-3 shows how planets2.xml appears in IE.
Reading Data Matrix ECC200 In VB.NET
Using Barcode reader for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Data Matrix Drawer In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create Data Matrix ECC200 image in ASP.NET applications.
www.OnBarcode.com
Figure 6-3. The page planets2.xml showing a simple table of contents You can see a Quick reference section at the top of the page with links to each of the sections below.
Code-128 Decoder In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Generating Barcode In None
Using Barcode creation for Office Excel Control to generate, create Barcode image in Microsoft Excel applications.
www.OnBarcode.com
CHAPTER 6 INTRODUCTION TO XSLT
Painting Barcode In Visual Basic .NET
Using Barcode generator for VS .NET Control to generate, create Barcode image in Visual Studio .NET applications.
www.OnBarcode.com
GTIN - 13 Creator In Objective-C
Using Barcode printer for iPhone Control to generate, create UPC - 13 image in iPhone applications.
www.OnBarcode.com
Selecting Each Planet with <xsl:for-each>
Encoding Code-128 In C#.NET
Using Barcode printer for VS .NET Control to generate, create Code-128 image in Visual Studio .NET applications.
www.OnBarcode.com
Making UPC - 13 In VS .NET
Using Barcode generator for Reporting Service Control to generate, create EAN / UCC - 13 image in Reporting Service applications.
www.OnBarcode.com
The beginning lines of planets2.xsl are the same as in the previous example. The first change to the stylesheet is in the header template. The new lines appear in bold: <xsl:template match="body"> <body> <p> <a href="http://www.nasa.gov/">Visit NASA!</a> | <a href="http://www.nineplanets.org/">Tour the solar system</a> </p> <h2>Quick reference</h2> <ul> <xsl:for-each select="html:h2"> <li> <a> <xsl:attribute name="href"> #<xsl:value-of select="text()"/></xsl:attribute> <xsl:value-of select="text()"/> </a> </li> </xsl:for-each> </ul> The added lines create a heading for the table of contents and start an unordered list. The stylesheet loops through each of the <h2> elements in the <body> element. The content from each <h2> element the name of the planet provides the name for the anchor. It also supplies the text for each list item: <xsl:for-each select="h2"> <li> <a> <xsl:attribute name="href"> #<xsl:value-of select="text()"/></xsl:attribute> <xsl:value-of select="text()"/> </a> </li> </xsl:for-each> To explain it in a bit more detail, each time the template finds an <h2> element in the body of the page, it outputs an <li> tag. After that, it creates an <a> tag. Then the template uses xsl:attribute to add an attribute to the <a> tag called href, and it sets the value of the attribute to be a hash symbol (#) followed by whatever content is in the <h2> tag (text()). Finally, the template closes the href attribute. So, if the <h2> tag contains the text Venus, the template outputs the following <a> tag: <a href="Venus">
EAN / UCC - 13 Maker In Objective-C
Using Barcode drawer for iPhone Control to generate, create EAN / UCC - 14 image in iPhone applications.
www.OnBarcode.com
UPC-A Supplement 2 Generation In None
Using Barcode generator for Microsoft Word Control to generate, create GS1 - 12 image in Word applications.
www.OnBarcode.com
CHAPTER 6 INTRODUCTION TO XSLT
The text content of the <h2> tag also provides the text between the <a> and </a> tags, and the template finishes with a closing </a> tag. Finally, it closes the <li> element and ends the loop with </xsl:for-each>. Again, looking at the Venus heading, the template creates the following transformed XHTML: <a href="Venus">Venus</a> When the template finishes the loop, it adds a closing </ul> tag. The complete block of links generated by the XSLT stylesheet follows: <h2>Quick reference</h2> <ul> <li><a href="#Venus">Venus</a></li> <li><a href="#Mars">Mars</a></li> </ul>
Copyright © OnBarcode.com . All rights reserved.