xsl-list
[Top] [All Lists]

Re: template matching everywhere

2004-03-05 09:36:31
At 04:02 AM 3/5/2004, you wrote:
Thank you for your help,
As you've understand I'm a beginner. Sorry for this stupid question but I know I misunderstood something but I didn't know what it was. I think my understanding of <xsl:apply-templates/> was a little wrong (I still have something to clarify). Now it's better.

It's a common place to get stuck, and it's good you got stuck there when you're just starting, since it's also a really important concept and your XSLT will never be very good until you've gotten your head around it.

The key thing to understand is that classically, XSLT stylesheets do not control the flow of operations in the transformation. (I say classically since there are ways of forcing things, but generally this shouldn't be done unless you need to.) Instead, xsl:apply-templates passes control back to the source document, by saying "okay now process the next elements [which are generally the child elements of the node you're on] with whatever templates are defined for them". This is really powerful, because it means that documents can have structures of arbitrary complexity, and yet a simple stylesheet can handle them properly without accounting for that structure directly. Processing many kinds of XML, such as documentary data marked up with Docbook or TEI or the NCBI Journal DTD, is next to impossible without this kind of feature, since many documents will share the same tags (same element types) without resembling each other structurally at all.

I'm gonna dip again in a book looking at the right place !!

Cool.

Enjoy,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



<Prev in Thread] Current Thread [Next in Thread>