xsl-list
[Top] [All Lists]

RE: Advice/feedback on stylesheet?

2004-03-27 07:49:30
-----Original Message-----
From: Andreas L. Delmelle [mailto:a_l(_dot_)delmelle(_at_)pandora(_dot_)be]
-----Original Message-----
From: Jim Stoll [mailto:jestoll(_at_)crtinc(_dot_)com]

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).

<snip/>

 - 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...


Hi,

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

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)]" />
and
<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!


Cheers,

Andreas



<Prev in Thread] Current Thread [Next in Thread>