[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: "xstlApplyOneTemplate:key was not compiled" when

Subject: RE: "xstlApplyOneTemplate:key was not compiled" when attempting Muenchian Method
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Tue, 21 Aug 2007 09:11:15 +0100
RE:  "xstlApplyOneTemplate:key was not compiled" when
Melissa

xsl:key needs to be a top level element, a child of the xsl:stylesheet element, not declared within an xsl:template.

Joe

http://joe.fawcett.name/

From: Melissa Butler <melbutler@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: "xstlApplyOneTemplate:key was not compiled" when attempting Muenchian Method
Date: Mon, 20 Aug 2007 16:58:05 -0600



Hey All,


First let me say that I am using XSLT 1.0 with xsltproc in the Solaris OS.

Using libxml 20610, libxslt 10107 and libexslt 805
xsltproc was compiled against libxml 20610, libxslt
libxslt 10107 was compiled against libxml 20610
libexslt 805 was compiled against libxml 20610

This is the gist of what I'm trying to do.

Source.xml
<Template>
   <Field>
      <Listing>
         <Group number="1">
            <Point time="10" data="ES">...</Point>
            <Point time="10" data="RF">...</Point>
            <Point time="11" data="GG">...</Point>
            <Point time="12" data="WE">...</Point>
            <Point time="13" data="VR">...</Point>
        </Group>
        <Group number="2">...</Group>
        <Group number="1">...</Group>
        <Group number="1">...</Group>
      <Listing>
   </Field>
</Template>

Solution.xsl
<?xml version="1.0" ?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform "
    version="1.0">

<!--Pre: Someone calls GetData passing in a counter value that is equal to
a Group number-->
<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:for-each
select="$path[generate-id(.)=generate-id(key('myKey',@time)[1])]">
       <xsl:sort select="@time"/>
      <!-- Just to see if it works -->
       <xsl:value-of select="time"/><xsl:text>
</xsl:text>
   </xsl:for-each>
</xsl:template>

So running this code produces a xsltApplyOneTemplate:key was not compiled
error. I ran xsltproc with the verbose flag and saw that before returning
that I had a "Nodeset is null." I thought that would clarify my problem,
but from what I understand about XPath, I shouldn't have any null nodesets.

I also commented out the xsl:for-each and simplified the key to something
like <xsl:key name="myKey" match="/Template/Field/Listing" use="Group"/>
and recieved the same errors.

At this point I'm pretty stuck. I typed all this from memory, so hopefully
if you see an elementary mistake, it's just in this document. Feel free to
point it out though.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.