xsl-list
[Top] [All Lists]

Re: Specify/determine element's "logical" parent

2004-09-23 15:55:01
On Thu, 23 Sep 2004 23:08:55 +0100, David Carlisle wrote

Excellent post, thanks.

perhaps you're more of a city dweller and more comfortable 
following the crowds?

Actually I really like working with current tools but because of my
unfamiliarity it is easy to just blame the technology instead of myself.

          <xsl:value-of select="key( 'ids', (@parentid|../@id)[last()
])/@id" />


I think this says to look up the element pointed to by the key @parentid if it
is defined, ../@id otherwise, but I am not sure I understand the [last()] -
does that mean that if both parentid and ../@id are defined, ../@id will be
used (in which case I want the reverse, first()?  or is this just defensive
programming, habit or something else?

actually it's an error to have two templates of the same priority

I had expected the system (IE) to throw an error in this undefined case, but
it recovers (somewhat randomly) I guess.

Thanks again,

   -John