RE: [xsl] XSLT newbie looking for an easy to use processor (java)

Subject: RE: [xsl] XSLT newbie looking for an easy to use processor (java)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 22 Dec 2005 13:54:58 -0000
> As the topic already states I'm looking for an easy to use 
> XSLT processor (in Java), 

The two Java processors that are most widely used nowadays are Xalan and
Saxon. At your current level of knowledge either will do the job. Both are
open source. Xalan is bundled into the Sun JDK. Saxon is usually faster and
supports the more recent version of the language, XSLT 2.0.

> I want to pass an XML string and a corresponding XSLT 
> description to it, which is used to sort of parse the XML 
> string. 

Yes, that's what XSLT processors do.

> The XML string will contain a number of 
> items/elements (like name, phone and so on) and there are a 
> number of XSLT descriptions, one for each parameter, to sort 
> of crop the string so it will only contain the needed 
> parameter. So all I need is a XSLT processor which is easy to 
> use, accepts an XML string for input and returns another 
> string as a result.

Actually, XSLT processing consists of three stages:

(1) parse the XML string into a tree representation
(2) transform this source tree into a result tree
(3) serialize this result tree back into XML (or HTML, or plain text)

The core of XSLT processing is step (2).

> (Additionally :
> In case the result of an XSL transformation should contain 
> more than just one item it should be possible to define a 
> delimiter for the result string so I can distinguish the 
> items (I can't think of an appropriate example ... let's say 
> there are two items called "Name" in the XML string ;P)

The result of the transformation will normally be XML, so the "delimiters"
will usually be represented by XML markup. But you can generate different
delimiters it that's what the receiving application requires.

Michael Kay
http://www.saxonica.com/

Current Thread