

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in net.sourceforge.lists.saxon-helpRE: [saxon] Bug in 8.1? Cannot select...| From | Sent On | Attachments |
|---|---|---|
| Sal Mangano | Nov 13, 2004 10:24 pm | |
| Michael Kay | Nov 14, 2004 5:55 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | RE: [saxon] Bug in 8.1? Cannot select a node here: the context item is an atomic value. | Actions |
|---|---|---|
| From: | Michael Kay (mh...@mhk.me.uk) | |
| Date: | Nov 14, 2004 5:55:40 am | |
| List: | net.sourceforge.lists.saxon-help | |
The line number is a known problem which I haven't got round to solving yet. If you need to know, the real line number is in the low-order 16 bits.
The rest of the error message is correct. The key() function searches for nodes in the current document, i.e. the document containing the context node, and if there isn't a context node, then it doesn't know which document you want to search.
Michael Kay http://www.saxonica.com/
-----Original Message----- From: saxo...@lists.sourceforge.net [mailto:saxo...@lists.sourceforge.net] On Behalf Of Sal Mangano Sent: 13 November 2004 21:07 To: saxo...@lists.sourceforge.net Subject: [saxon] Bug in 8.1? Cannot select a node here: the context item is an atomic value.
Here is a fragment of an XSLT transform I am writing to parse some unstructured text:
<xsl:when test="string-length($input) < 50 and matches($input,'^By [\w\s.,]+ and [\w\s.]+$')"> <xsl:variable name="author" select="tokenize($input,'(and|,)','i')" as="xs:string*"/> <art:ByLine> <xsl:for-each select="$author"> <xsl:variable name="name" select="if (position() = 1) then substring(.,3) else ." as="xs:string"/>
<!--THIS LINE CAUSES THE ERROR MESSAGE --> <xsl:variable name="email" select="if (key('AuthorKey',$name)) then key('AuthorKey',$name)/email else 'webm...@somewhere.com'" as="xs:string"/>
<art:Author> <art:name><xsl:value-of select="$name"/></art:name> <art:email><xsl:value-of select="$email"/></art:email> </art:Author> </xsl:for-each> </art:ByLine> </xsl:when>
The line indicated causes the following error:
Error on line 1048575 Cannot select a node here: the context item is an atomic value.
Now, at the very least, the line number is bogus because this XSLT file only has 202 lines. Second, I am not sure why I can't set a variable using key() just because the Context node is atomic. The problem seems related to the use of key() because if I remove key() and replace with some dummy expression the error goes away.
--------------------------------------------------------- Sal Mangano Into Technology Inc. www.into-technology.com
Use XSLT? Try the XSLT Cookbook http://www.oreilly.com/catalog/xsltckbk/
------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________ saxon-help mailing list saxo...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help







