xsl-list
[Top] [All Lists]

RE: Cannot select a node here: the context item is undefined

2005-04-05 15:24:00
The key() function has an implicit dependency on the context node - unless
you supply the new third argument, it searches the current document, defined
as the document containing the context node. But inside an xsl:function,
there is no context node unless you create one. Functions have no implicit
parameters.

If the call on key() is always searching the principal source document of
the transformation, you can set up the usual global variable

<xsl:variable name="root" select="/"/>

and use $root as the third argument of key().

If it's searching different documents on different occasions, then you need
to add another parameter to the function.

Michael Kay
http://www.saxonica.com/  

-----Original Message-----
From: Jim_Albright(_at_)wycliffe(_dot_)org 
[mailto:Jim_Albright(_at_)wycliffe(_dot_)org] 
Sent: 05 April 2005 22:36
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Cannot select a node here: the context item is 
undefined

Again thank you all for your great responses. I just about have this 
project completed.

I am using Saxon 8.3

the piece of the stylesheet giving the error message is >>>marked<<<<<
        <xsl:key name="word-group-by-word" match="word-group" 
use="word"/>
        <xsl:function name="str:find_root_word" as="xs:string">
                <xsl:param name="word" as="xs:string"/>
                <xsl:variable name="length-of-word" select="
string-length($word)"  />
                <xsl:choose>
                        <!-- this should remove the 'ed' -->
  <xsl:when test="key('word-group-by-word',substring($word,1, 
$length-of-word - 2))"> <<<<<<<<<<<<<<<<<<
                                <xsl:sequence 
select="substring($word,1, 
$length-of-word - 2)"/>
                        </xsl:when>

So what is the error? Cannot select a node here: the context item is 
undefined
 
What I am trying to do.
I have words in word-group that I am trying to analyze. If the 
master-count is non-zero then I am happy that we have the 
word found in a 
Bible and in the master list e.g., falter.

If the master-count is null then it should be flagged as a 
possible error. 
But since  the last three words are only variations of the first word 
listed below I would like to exclude them as problems. 
        <word>falter</word>
        <word>faltered</word>
        <word>faltering</word>
        <word>falters</word>


piece of xml file:
<word-group>
        <word>falter</word>
        <master-count>1</master-count>
        <master-number>9.4.3.1.5; </master-number>
        <master-name>Uncertain; </master-name>
        <niv-count>2</niv-count>
        <nasb-count>1</nasb-count>
        <nlt-count>1</nlt-count>
        <tev-count/>
        <niv-references>PRO 24:10 ISA 42:4</niv-references>
        <nasb-references>LEV 25:35</nasb-references>
        <nlt-references>MAT 21:26</nlt-references>
        <tev-references/>
</word-group>
<word-group>
        <word>faltered</word>
        <master-count/>
        <master-number/>
        <master-name/>
        <niv-count>1</niv-count>
        <nasb-count/>
        <nlt-count/>
        <tev-count/>
        <niv-references>PSA 105:37</niv-references>
        <nasb-references/>
        <nlt-references/>
        <tev-references/>
</word-group>
<word-group>
        <word>faltering</word>
        <master-count/>
        <master-number/>
        <master-name/>
        <niv-count>3</niv-count>
        <nasb-count/>
        <nlt-count/>
        <tev-count/>
        <niv-references>EXO 6:12,30 JOB 4:4</niv-references>
        <nasb-references/>
        <nlt-references/>
        <tev-references/>
</word-group>
<word-group>
        <word>falters</word>
        <master-count/>
        <master-number/>
        <master-name/>
        <niv-count>1</niv-count>
        <nasb-count/>
        <nlt-count/>
        <tev-count/>
        <niv-references>ISA 21:4</niv-references>
        <nasb-references/>
        <nlt-references/>
        <tev-references/>
</word-group>


Jim Albright
704 843-0582
Wycliffe Bible Translators



--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>