[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Fw: Is there a way to define groups of templates ?


Subject: Re: Fw: Is there a way to define groups of templates ?
From: Paul Prescod <papresco@xxxxxxxxxxxxxxxx>
Date: Thu, 24 Sep 1998 10:17:55 -0500

Oren Ben-Kiki wrote:
> 
> > What if I have a
> ><TOC/> empty element that indicates where the TOC is to go.
> 
> I assume you refer to the XML document tree. Well, as I understand the
> purpose of XML/XSL, you shouldn't. The TOC element you describe is used just
> for controlling formatting, and XML should be used just to specify content.
> XSL should be used to specify formatting.

As you spend time with XML/XSL you will find that rules that seem so
simple and black and white in theory are very fuzzy and hard to apply in
practice. Suffice to say that the case I mention is quite common, and I am
currently implementing it for one of the largest publishers in North
America. Regardless, it doesn't matter about that particular case. I'm
pointing out that the context of the invocation and the mode you want to
invoke are TWO SEPARATE THINGS. Sometimes you care only about the mode.
Sometimes you care only about the context. Luckily, you can always invent
new modes that capture both things.

> You could. But in this approach, you force whoever writes the XML document
> to provide the contexts required by the particular XSL used. For example, if
> I had one XSL which specified an index, and another which specified a table
> of content, the XML writer would have to include a TOC tag and an INDEX tag
> in advance. Then someone would come with an XSL containing a glossary, or a
> per-chapter table of content, and so on... We want to avoid all that. That's
> the whole point of using XSL.

No it isn't. The whole point of XSL is to allow authors to *decide* what
is formatting and what is content. XSL should not force any particular
choice on the author. You say that the position of a glossary in a book is
just formatting. I say, that in the things I publish, it can be a vital
part of the content. XSL is supposed to allow us both to make the choice
for ourselves. (in fact, allowing this choice is what SGML was designed
for, long before XSL was a gleam in anyone's eyes).
 
> This rule is impossible to express using Eran's notation. Note that there is
> a workaround. You can define two contexts, 'general-toc' and 'section-toc'.
> The figure rule will only be triggered by the latter. If you do that,
> however, you'd have to specify the chapter rule twice, once per context.

Not at all. You put the chapter rule in a third context that can be
invoked from either of the first two. Contexts can nest.

've done this sort of processing with DSSSL for a year and a half now and
have never wanted to do what you are describing. I think of a context as
just a way of qualifying a template rule. The rule does not need, and
probably should not have access to information about the context which
gave rise to its calling. It's like a function in a program asking "who
called me...and who called them...and who called them?" It strikes me as
bad design.

Rather, it should be driven from the top-down. Does this function/template
rule do what I need? If so, I will call it, and it should just do its
thing without caring about the context of the call.

Plus, you haven't at all assuaged my fears that you understand that the
context of a call to a rule is often *unrelated* to the context that the
node exists in within the tree. Consider a cross-reference. In my DSSSL
specifications, I often make a mode for cross-references. I may even make
a special mode for cross references that originate in the back matter
(let's say). So the context of the call does matter, but is completely
unrelated to the tree context!

 Paul Prescod  - http://itrc.uwaterloo.ca/~papresco

How many of the Congresspeople who voted for the CDA do you suppose
also voted to release the report that reads like a borderline por-
nographic dime-store romance written by a Texas preacher's son?
	- Keith Dawson, TBTF 
		http://www.tbtf.com/archive/09-14-98.html
		http://www.tbtf.com/resource/hypocrites.html


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



Current Thread
Keywords