Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: doesn't make sense #2..could you? [Thread Next] Re: doesn't make sense #2..could you?To: NULL Date: 10/14/2007 3:36:00 PM
TJ wrote:
> Peter, I have one more question in A case...
>
> Just want to make sure whehter my understanding is correct.
>
> So..basically, in A case, root element(/hello-world) wasn't found in the
> template...
Right.
> so default rule kicks in and traverse the all child nodes..which are
> (greeting and greeter)...
Correct. The direction of traversal is depth-before-width, so if you
consider the document as a tree (silly name, because it's upside-down!)
[Use fixed-width font for this, eg Courier]
document root
|
root element (hello-world)
|
+-------------+------------+
| |
greeting greeter
| |
character data character data
So the sequence is:
document root
root element
greeting
character data [no more depth, go back up]
greeter
character data [end]
> By match="/hello-world/greeting" statement in A.xsl, it does match greeting
> child element of hello-world, which is root...
Only because it matches the greeting in the case where greeting is a
child of hello-world. The presence of the "/hello-world/" does NOT force
this template to use that element in a particular sequence. Consider the
"/hello-world/" as more like a condition "greeting provided that the
parent is hello-world". It simply stops it being matched if a different
greeting element exists somewhere else in the document with a different
parent element type. It does NOT mean that hello-world will get
processed on the way to greeting.
(Actually this is only partially true, but you don't need to worry about
the rest yet :-)
> so it prints by xsl:value-of
> select..like <div>..</div>....Then greeter is printed by default template
> rule....
>
> Is my understanding correct?
Yes. But I think you might want to look at books on XML hierarchical
document structure and XSLT processing at this stage.
///Peter
--
XML FAQ: http://xml.silmaril.ie/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
