Re: [xsl] Q: to Jeni Tennison regarding your APress titles...

Subject: Re: [xsl] Q: to Jeni Tennison regarding your APress titles...
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 25 Nov 2004 21:11:52 +0000
Hi David,

> Something else I learned was a fantastic little trick that I had
> never seen used before: using the number function to dynamically
> determine what element to use based on document position (e.g.
> foo(number(@bar)) would allow you to select the element in the
> position that was contained in foo/@bar. These are the types of
> little details that I am hoping to possibly re-discover during this
> process.

You mean "foo[number(@bar)]" (which selects the <foo> element children
of the current node whose bar attributes match their position amongst
other <foo> elements within the current node) or, more feasibly,
"foo[number(current()/@bar)]" (which selects the nth <foo> element
child of the current node where n is the value of the bar attribute of
the current node).

> Yeah, even as much as I use them I still find myself having to
> methodically step through my code everytime to make sure that I
> using proper context and such. This is definitely an error that can
> easily trip up even the best of developers... definitely something
> that you can never spend enough time practicing :)

Right -- that's part of why I tend to advise people to use matching
templates with modes rather than named templates: with a matching
template, you have some hope of knowing what the context node is by
looking at the pattern, with a named template you can't tell without
finding the call to that template, which makes debugging that much
harder.

> In fact (I'm going to advertise this in a seperate email that is
> short and to the point so that more people become aware of it) I am
> going to document this process using a blog format at the domain
> "UnderstandingXSLT.com" and encourage people to go out and buy a
> copy of your book and follow along with me, discussing through
> comments the experience each person may be having, details they have
> discovered that may interest others, and questions they might have
> that anybody reading might be able to answer. It would be great if
> you stopped by to chime in on things now and again as I am sure
> there are many people out there, myself included, who would love to
> hear what you have to say about certain areas contained withing your
> book.

I'll certainly try to pop in.

> BTW... is there a preferred vendor or URL that you would like me to
> list for people to visit to buy a copy of this title?

No; a link to Amazon is fine.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Current Thread