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. Article... (more)
I'll admit I did quite a bit of XML work before starting to use DTDs. Talking
with other developers, many say they still don't validate their XML documents
(using a DTD or XML Schema). However, for the past six months or more, I've
incorporated a DTD file with every XML document produced and can't imagine
how I ever got by without DTDs.
Since XML has no concrete set of tags, any tag you want to use can be
incorporated into an XML document. Writing a DTD expresses your document's
tags and defines your DOM (Document Object Model) in a very concise manner.
DTDs also validate your d... (more)
The element extension mechanism allows namespaces to be designated as
extension namespaces. When a namespace is thus designated and an element with
a name from that namespace occurs in a template, the element is treated as an
instruction rather than as a literal result element. The namespace determines
the semantics of the instruction.
Most people understand that XML is extensible using the extensible Document
Object Model. However, eXtensible Stylesheet Language Transformations are
also extensible using namespaces. Most functions in XSLT use the XSL
namespace that's built in wi... (more)
In my free time, I've been working on a CMS/Portal application using Java and
XML. I was glad to discover some XML database tools that are now available -
as more and more data is being stored and transmitted in XML format, XML
databases are worth considering. Moving an XML application to Xindice
(pronounced zin-dee-chay) is an interesting experience.
Xindice is a "new" open-source database engine, so a lot of issues must be
resolved by brute force. However, getting started using the Java API was
fairly easy, and getting a test class put together only takes an hour or two.
Xindi... (more)
The beginning of every XSLT book or tutorial introduces "template matching"
and how to use Apply-Templates. This article explains the benefits of using
XSLT templates as well as some examples that show how a "real-world"
application can use Apply-Templates along with other XSLT techniques.
Previously I've skirted around using Apply-Templates, opting instead for XSLT
programming logic. The result was always a lot of XSLT code with ,
, and statements. Most of the "if" and "choose"
statements checked the values or existence of nodes and elements in an X... (more)