Re: [xsl] Apply-templates - how to omit top level element tags?

Subject: Re: [xsl] Apply-templates - how to omit top level element tags?
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Thu, 8 Sep 2005 15:50:07 -0500
On 9/8/05, Mike Schinkel <mikes@xxxxxxxxx> wrote:
> >> Are the examples in the spec not to your liking?
> It isn't whether I like them or not, it's whether I can understand them
> easily.  The problem is they explain in words but not in examples.
> So, for example:
>         "* selects all element children of the context node"
>         ". selects the context node"
>         "{no explicit definition of node()}"

node() is a node test, the most general form.  It's true for any node,
and since pretty much everything is a node, it'll always be true.  In
most situations it's kinda like "while (0==0) {}".  One other issue I
found confusing was the split between reading XSLT and the Xpath
specs.    Figure out the general layout of XPath first.

> But no:
>         Given
> <Make><Name>Honda</Name><Model><Name>Civic</Name></Model><Model><Name>Ac
> cord</Name></Model></Make>
>         then
>                 "*" refers to....
>                 "." refers to....
>                 "node() refers to...
> And so on.
Ahh, I see.  When I first started using XSLT I used the book
"Mastering XSLT".  To tell the truth, I don't know if what I picked up
with it.  It was only when I let it sit for a while and went back did
I really start getting the hang of it.  And that was more through
reading the specs and playing with different xml inputs and sources.
I don't know of any good sources of examples like that, but I'm sure
there's quite a few people out there that can suggest some.

> To understand requires you to understand the
> terms in the way they are used, which for a newbie, requires
> chicken-or-egg logic.  Examples help the newbie learn the context in
> which the terms are applies so that they can they learn the subject
> which the terms are used to describe.

True, but this is pretty much the same for nearly anything to do with
computers.  I learned  any programming language.  To really understand
and manipulate SQL requires understanding of set theory and logic.

You might want to start with section 5 and then use the previous
sections to define things.

> For example, my editorial team for is
> pushing me to drop the use of XML publishing and move to publishing in
> Word.  Doing that will kill my ability to use the content in numerous
> contexts, but because XML/XSLT is so difficult for the laymen, I may be
> forced to.

It's one of those problems I'm rather puzzled about too.  XML is very
flexible but I have yet to find many tools that I could be pretty sure
that most people would be comfy with using.  I  somewhat
optimistically believe better tools are arriving.

Jon Gorman

Current Thread