.NET
  Home arrow .NET arrow Page 2 - Building an AjaxPro.NET Based Search Engin...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Building an AjaxPro.NET Based Search Engine into Your Website
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2007-10-22

    Table of Contents:
  • Building an AjaxPro.NET Based Search Engine into Your Website
  • Introduction to XML/XSLT Techniques
  • Introduction to Google AJAXSLT
  • Database Design

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building an AjaxPro.NET Based Search Engine into Your Website - Introduction to XML/XSLT Techniques


    (Page 2 of 4 )

    As is now well known, XML has become one of the standard formats for transforming, storing, and rendering data. Thus, we will not dwell on it here; instead, we'll discuss XSLT.

    In fact, XSLT is a kind of language expressed as a well-formed XML document. However, the XSLT-defined elements are distinguished by belonging to a specific XML namespace (i.e. XSLT namespace).

    In practical use, XSLT is responsible for transforming various kinds of popular data. Thus, an ".xslt" file defines a series of rules for transforming a source data tree into a result data tree. The transformation is achieved by associating patterns with templates. A pattern is matched against elements in the source data tree. A template is instantiated to create part of the result data tree.

    The result data tree is separate from the source data tree. The structure of the result data tree can be completely different from the structure of the source data tree. In constructing the result data tree, elements from the source data tree can be filtered and re-ordered, and arbitrary structure can be added.

    A transformation expressed in XSLT is called a stylesheet, and contains a set of template rules. A template rule has two parts: a pattern which is matched against nodes in the source data tree and a template which can be instantiated to form part of the result data tree. This allows a stylesheet to be applicable to a wide class of documents that have similar source data tree structures.

    XSLT makes use of the expression language defined by XPath for selecting elements for processing, for conditional processing and for generating text.

    XPath is the result of an effort to provide a common syntax and semantics for functionality shared between XSL Transformations and XPointer. The primary purpose of XPath is to address parts of an XML document. To support this purpose, it also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax to facilitate use of XPath within URIs and XML attribute values.

    The primary syntactic construct in XPath is the expression. An expression matches the production Expr. An expression is evaluated to yield an object, which has one of the following four basic types:

    • node set (an unordered collection of nodes without duplicates).
    • boolean (true or false).
    • number (a floating-point number).
    • string (a sequence of UCS characters).

    Putting aside the theories now, let’s consider a short example. The following illustrates a part of an ".xml" file which contains a reference to /category/items/category:


    <category>

      <items>

    <category name="popular">

    <!-- The XPath expression matches this category node -->

    ...

    </category>

    <category name="extras">

    <!-- The XPath expression matches this category node -->

    ...

    </category>

      </items>

    </category>

    As you can see from the above snippet, a stylesheet is composed of rules. Each rule has a pattern which defines when it applies, and a template which defines what to output. Continuing with the example, here's a full rule defined in an ".xslt" file:


    <xsl:template match="/category/items/category">

    <div class="category"

      onclick="retrieveCategory('{@name}')">

    <xsl:value-of select="@name"/>

    </div>

    </xsl:template>


    When each node is reached, the template body is outputted. @name refers to the name attribute on the category tag. So when the related processing engine reaches the following XML segment:


    <category name="extras">

      the following HTML will be output:

    <div class="category"

      onclick="retrieveCategory('{extras}')">

       extras

    </div>


    The following HTML will be output:


    <div class="category"

      onclick="retrieveCategory('{extras}')">

       extras

    </div>


    This wraps up the XML/XSLT discussion. Next, let’s continue with another interesting framework.

    More .NET Articles
    More By Xianzhong Zhu


     

    .NET ARTICLES

    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT