Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: doesn't make sense #2..could you?

From: Peter Flynn <peter.nosp@-.--------.-->
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent