xsl-list
[Top] [All Lists]

Re: Re: [xslt transform & grouping] Using the Muenchian Method?

2004-10-05 07:42:57
Hi Michael,

I think I see the problem.
When you use:
<xsl:param name="filter" select="food"></xsl:param> no elements are mached (you have no food elements at top level).
This means that in this expression:
<xsl:for-each select="Document[(_at_)filter=$filter]/Article[count(.|key('by-info',@info)[1])=1]"> you predicate (filter) evaluates to false, that is [(_at_)filter=$filter] is false. I think therefore that your processor stops there and does not evaluate the second predicate
[count(.|key('by-info',@info)[1])=1].
Net result of this is that no elements are chosen in your for-each and therefore there is no output between <document> and </document>

When you did, as David Carlisle suggested, change your top-level param to:
<xsl:param name="filter" select="'food'"></xsl:param> the first predicate returns true (at least for some of the elements). Then the second predicate _will_ be evaluated (in those case where the first is true). As you have not defined the key (by-info), the processor chokes on this [count(.|key('by-info',@info)[1])=1].

Therefore you need to both change your top-level param to <xsl:param name="filter" select="'food'"></xsl:param> and add a definition of your key at your top-level (see earlier post from DC).

I hope that this helps.

Regards,
Ragulf Pickaxe :-)

Listen,

I think that we're going back and forth here.


when this line is used:

<xsl:param name="filter" select="'food'"></xsl:param>

this error is generated:

"Exception Details: System.NullReferenceException: Object reference not set to an instance of an object."

but when i use

<xsl:param name="filter" select="food"></xsl:param>

there is no error.

OK ?

Now,

When everything works without errors, generated XML output is:

<Documents></Documents>

instead of the required elements.

THat is, some expression must be wrong.

[snip]

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



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