0
votes

file test.xqy:

let $last :="Proj"
return
<html>
<head><title>Example</title></head>
<body>
<table frame="box">
<tr>
<td>Name</td>
<td>Last</td>
<td>MRN</td>
</tr>
{
for $person in ( doc("test.xsd")/data/person[last=$last] )
return
<tr>
<td>{$person/name/string()}</td>
<td>{$person/last/string()}</td>
<td>{$person/mrn/string()}</td>
</tr>
}
</table>
</body>
</html>

file test.xsd:

<?xml version = "1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name = "people">
        <xs:complexType>

            <xs:sequence>


                <xs:element name = "person">
                    <xs:complexType>
                        <xs:sequence>

                            <xs:element name = "firstname" type = "xs:string" />
                            <xs:element name = "lastname" type = "xs:string" />
                            <xs:element name="test1">
                                <xs:simpleType>
                                   <xs:restriction base="xs:string">
                                    <xs:enumeration value="small" />
                                    <xs:enumeration value="medium" />
                                    <xs:enumeration value="large" />
                                </xs:restriction>
                            </xs:simpleType>
                        </xs:element>



                    </xs:sequence>
                </xs:complexType>
            </xs:element>

        </xs:sequence>
    </xs:complexType>

</xs:element>

<xs:complexType name="A">
  <xs:attribute name="x" type="xs:NCName"/>
  <xs:attribute name="y" type="xs:QName"/>
 </xs:complexType>

 <xs:element name="SpecialOption">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="Option" type="xs:string" use="required"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>

</xs:schema>

I don't think the error is about the content of the 2 files above.

$ basex REPO LIST test.xqy
Stopped at /Users/jack/Workspace/xqy, 1/5:
[XPDY0002] REPO: no context value bound.
$ basex REPO LIST
Stopped at /Users/jack/Workspace/xqy, 1/5:
[XPDY0002] REPO: no context value bound.

By the way, I have the same error when I try to install new package from command line, really confused me... I think I followed exactly this

$ basex REPO INSTALL http://files.basex.org/modules/expath/functx-1.0.xar
Stopped at /Users/jack/Workspace/xqy, 1/5:
[XPDY0002] REPO: no context value bound.
1

1 Answers

0
votes

Your input REPO INSTALL [...] is a command, but the BaseX command-line interface expects XQuery if you do not specify any additional flags. REPO is therefore interpreted as the XPath expression ./child::REPO, which needs the context item . to be bound.

Try this instead:

basex -c"REPO INSTALL http://files.basex.org/modules/expath/functx-1.0.xar"