xsl-list
[Top] [All Lists]

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

2007-08-21 02:58:50
<xsl:template name="GetData">
  <xsl:param name="counter"/>
  <xsl:variable name="path"
select="/Template/Field/Listing/Group[(_at_)number=$counter]/pt"/>
  <xsl:key name="myKey"
match="/Template/Field/Listing/Group[(_at_)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.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Re: "xstlApplyOneTemplate:key was not compiled" when attempting Muenchian, John Escott  <=