|
Article Excerpt XSLT is generally used to parse and translate XML files, but with some more advanced techniques, it's possible to search for specific attributes (or elements) of any XML document or list of documents.
While developing a search tool, I learned how to replace strings and translate characters (uppercase to lowercase) in XSL. After a little research, it took only a few hours to put together what I needed. The examples in this article show how to implement a simple search mechanism to search a DocBook file and display the search results in HTML format.
When XML first appeared, much of the hype was about how well suited it is for searching documents (and it is--but I haven't seen many implementations). I'd been working on a Web site and wanted to add a search box. Using XML, searching the site should be easy enough. The site itself is in one DocBook XML document. Articles (posts) can be posted to the Web site as well. These are each stored in a separate DocBook Article XML file. Yet another XML file on the server contains a list of these article files, which more or less functions as an index for the directory.
More specifically, the requirements I came up with were:
1. Allow the user to enter a keyword into a text box.
2. Choose to search for any keyword, just author names, or just titles.
3. Scan the Web site content or scan the articles.
4. Display the results, showing text around the found keyword and...
|
|

More articles from XML Journal
Switching document views: applying XSLT stylesheets dynamically with D..., July 01, 2002 What is XQuery: when you need a powerful and convenient tool for analy..., July 01, 2002 Selecting a VoiceXML gateway: here are the criteria to help you. (Voic..., July 01, 2002 Omniopera.(from Kamiak Corp.)(Evaluation), July 01, 2002 The importance of integration standards: recent developments in XML-ba..., July 01, 2002
Looking for additional articles?
Search our database of over 3 million articles.
Looking for more in-depth information on this industry?
Search our complete database of Industry & Market reports by text, subject, publication
name or publication date.
About Goliath
Whether you're looking for sales prospects, competitive information, company
analysis or best practices in managing your organization,
Goliath can help you meet your business needs.
Our extensive business information databases empower business
professionals with both the breadth and depth of credible,
authoritative information they need to support their business
goals. Whether it be strategic planning, sales prospecting,
company research or defining management best practices -
Goliath is your leading source for accurate information.
|
|