This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: hard core xlt ;-)


Here are some comments what I consider to be two of the harder/hardest
things to do in XSLT:

1. "Generic" XSLT. Usually you write a stylesheet with assumptions about
the structure of the input XML. Generic XSLT makes no such assumptions.
It processes the source in terms of node types. An element contains
other elements, attributes, text, comments, etc. Start at the root node
and drill down, using recursion (e.g. element template calls
apply-templates on its subelements).
A few months after starting to learn XSLT, I created two stylesheets
using this approach. One of them takes any XML and creates a
colour-coded and indented HTML "pretty print" of the XML. You could use
it to present itself. The other stylesheet took created a specimen of
XML and generated a first-cut DTD. 
I had to ask a lot of questions on this list, but I learned an enormous
amount about XSLT.

2. XSLT that generates XSLT. The issue here is that you have two
namespaces for the XSLT, one for the actual instructions in the
stylesheet, and one for the XSLT you will be generating. It is not
always difficult, depending on how much variation there is in the output
stylesheet. The tricky thing is that you are effectively writing two
transformations at the same time, each applying to different source XML,
and you have to think about e.g. which transformation should make a
given decision.

Both of these are great lessons in XSLT. There are others
- simulating "looping" using recursion  
- the misc. sorting issues and the Muenchian method (will be obsolete in
XSLT 2.0?)

and I'm sure people can add to that list. Possibly the final step would
be to implement XSLT yourself, but you don't have to build cars to be a
good driver.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]