Subject: [xsl] "xstlApplyOneTemplate:key was not compiled" when attempting Muenchian Method From: Melissa Butler <melbutler@xxxxxxxxxxxx> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Flat XML to hierarchical , christoph . naber | Thread | RE: [xsl] "xstlApplyOneTemplate:key, Joe Fawcett |
[xsl] Preceding Axis and Aggregatio, Simon Shutter | Date | Re: [xsl] Evaluate string as XPATH , Matt Poff |
Month |