xsl-list
[Top] [All Lists]

RE: i dont understand this zvon tutorial (NEWBIE)

2002-09-09 09:29:14
Hi Thomas,

http://www.zvon.org/xxl/XSLTutorial/Output/example72_ch2.html

why is the output
BBB id=b1
BBB id=b2
BBB id=b3
BBB id=b4 
DDD id=d1
BBB id=b5

the first template is transforming all BBB and then, the next 
template is doing the DDDs.

No, the first template is not transforming all the BBBs. The first template
(and the order of templates in a stylesheet does not actually matter) is a
rule for what to do *when* a BBB is encountered in the input. An XSLT
stylesheet is *not* a ordered series of instructions ("Take all the BBBs and
do X with them, then take all the DDDs and do Y with them"), it is a set of
event-based rules ("When you find a BBB do X with it, when you find a DDD do
Y with it"). If you bear in mind that there is a default rule for elements
which says "If there is no matching rule for this, process any element
and/or text children in document order", and that the processor starts with
the document element, you should be able to work out why the Zvon example
outputs as it does.

See http://www.dpawson.co.uk/xsl/sect2/nono.html#d80e1070.

Cheers,

Stuart


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



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