.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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    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

    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries
    - Introducing LINQ to SQL Designer using Visua...
    - Beginning LINQ to SQL Using Visual Studio 20...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway