Hi,
 
It is interpreting "false" and "true" as element names (and hence looking for a context for them).  To do what you want, try:
 
<xsl:sequence select="xs:boolean(false())" />
 
or just
 
<xsl:sequence select="false()" />
 
Hope that helps,
Priscilla


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of alan.painter@hsbc.fr
Sent: Tuesday, June 24, 2008 11:13 AM
To: saxon-help@lists.sourceforge.net
Subject: [saxon] the dreaded XPDY0002: "context item is undefined"


Dear fellow saxon enthusiasts,

I'm running into a silly error and I'm wondering if this isn't a saxon-specific problem.

Trying to convert some specific XMLSS content into other XML content and I'm getting an error message from within a function:

Under saxonb9-0-0-4j

Error on line 23 of file:/w:/DSI/Developpement/HorizonPhase1/Saxonica/HorizonConfig/GenerateHorizonConfig-SAVE.xsl:
  XPDY0002: Axis step child::element(false, xs:anyType) cannot be used here: the context item is undefined
Failed to compile stylesheet. 1 error detected.

Yet line 23 is simply:

                <xsl:sequence select="xs:boolean(false)" />

The whole stylesheet is:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:f="http://localstuff"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
 
  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 
  version="2.0" exclude-result-prefixes="xs f xsl ss">

<xsl:output indent="yes" encoding="UTF-8" />  

<xsl:variable name="f:IMS_START" as="xs:string" select="'IMS-'" />

<!-- Check that we have the right number of Worksheets that start with a given Prefix -->
<xsl:function name="f:checkForWorksheet" as="xs:boolean">
    <xsl:param name="f:workbook" as="element(ss:Workbook)" />
    <xsl:param name="f:sheetStartsWith" as="xs:string" />
       
        <xsl:variable name="f:sheets"     as="element()"  select="$f:workbook[starts-with(@ss:Name, $f:sheetStartsWith)]" />
        <xsl:variable name="f:sheetCount" as="xs:integer" select="count($f:sheets)" />
        <xsl:choose>
        <xsl:when test="$f:sheetCount lt 1" >
                <xsl:sequence select="xs:boolean(false)" />
        </xsl:when>
        <xsl:otherwise >
                <xsl:sequence select="xs:boolean(true)" />
        </xsl:otherwise>
        </xsl:choose>

</xsl:function>

<xsl:template match="/" >
        <xs:variable name="f:testme" select="$f:checkForWorksheet(ss:Workbook, $f:IMS_START)" />
</xsl:template>

</xsl:stylesheet>

Thanks for any pointers on this.

cheers

-alan

Ensemble adoptons des gestes responsables : N'imprimez ce mail que si necessaire.

 

Les informations contenues dans ce message et les pieces jointes (ci-apres denomme le message) sont confidentielles et peuvent etre couvertes par le secret professionnel. Si vous n'etes pas le destinataire de ce message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez recu ce message par erreur, nous vous remercions de le supprimer de votre systeme, ainsi que toutes ses copies, et d'en avertir immediatement HSBC France et ses filiales par message de retour. Il est impossible de garantir que les communications par messagerie electronique arrivent en temps utile, sont securisees ou denuees de toute erreur, alteration, falsification ou virus. En consequence, HSBC France et ses filiales declinent toute responsabilite du fait des erreurs, alterations, falsifications ou omissions qui pourraient en resulter.

 

Consider the environment before printing this mail.

 

The information contained in this e-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message by error, please delete it and all copies from your system and notify the sender immediately by return e-mail. E-mail communications cannot be guaranteed to be timely secure, error or virus-free. The sender does not accept liability for any errors or omissions which arise as a result.