RE: [xsl] Advice/feedback on stylesheet?

Subject: RE: [xsl] Advice/feedback on stylesheet?
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sat, 27 Mar 2004 15:49:30 +0100
> -----Original Message-----
> From: Andreas L. Delmelle [mailto:a_l.delmelle@xxxxxxxxxx]
> > -----Original Message-----
> > From: Jim Stoll [mailto:jestoll@xxxxxxxxxx]
> >
> > Anyway, I'd like to know if/how I can do this in a smarter
> > manner, if I've made any serious mis-steps or such, if this
> > approach is likely to bring the machine to its knees for large
> > datasets, etc. (this will be occurring on the database server).
> >
> >  - the prevailing philosophy as regards whether to have an empty
> > CHILDREN element (see below) if there are no children or not
> Well, I personally prefer to have an empty element indicating the
> absence of
> it, as opposed to not having a CHILDREN element at all...


Re-reading this, it just seemed a little too concise, so to make it a solid

What I'm really referring to is a possible XSL Transform of the resulting
XML, and the difference between:

<xsl:apply-templates select="NODE[not(CHILDREN)]" />
<xsl:apply-templates select="NODE[not(CHILDREN/*)]" />

The suggestion to use the relative positions of the nodes will only work if
these positions are predictable in some way. Leaving the CHILDREN node out
in case it has no children, would greatly complicate the use of the position
values IMHO, whereas adding an empty CHILDREN node will not need a great
deal of extra effort, but leaves the position values of other nodes on the
same level intact.

Just to make this a bit clearer...

BTW: the stated restriction for template match patterns also goes for
xsl:key. i.e. you can't write
<xsl:key name="key-name" match="*[name()=$param1]"
         use="*[name()=$param2]" />

What you *can* do is, for example

<xsl:key name="key-name" match="/*/*[*[1] != '1']"
         use="*[3]" />

So match all nodes on the second level whose first child doesn't equal '1',
and select them using the value of their third child node, whatever their
respective names.

Hope this helps!



Current Thread