[xsl] Re: "xstlApplyOneTemplate:key was not compiled" when attempting Muenchian

Subject: [xsl] Re: "xstlApplyOneTemplate:key was not compiled" when attempting Muenchian
From: "John Escott "<jre@xxxxxxxxxxxx>
Date: Tue, 21 Aug 2007 10:57:42 +0100
> <xsl:template name="GetData">
>   <xsl:param name="counter"/>
>   <xsl:variable name="path"
> select="/Template/Field/Listing/Group[@number=$counter]/pt"/>
>   <xsl:key name="myKey"
> match="/Template/Field/Listing/Group[@number=$counter]/pt" use="@time"/>

xsl:key is a top-level element so you can't put it inside a template.
You can move it outside, remove the @number predicate from the match and 
then combine @number and @time in some way in the use attribute. For 
example

  <xsl:key name="myKey" match="/Template/Field/Listing/Group"
   use="concat(@number,'-',@time)"/>

(BTW, you could use match="Group", unless you're expecting the source 
document to contain other Group elements that you don't want matched)

Then, of course, you also have to modify your use of the key to combine 
$counter in the same way, eg

  ...generate-id(key('myKey',concat($counter,'-',@time))...

best regards, John.

Current Thread