Skip to content

fn:current() not interpreted correctly #20

@JDziurlaj

Description

@JDziurlaj

Per XForms 1.1 fn:current should be interpreted as the context node where the XPath appears. Consider the following form:

<xf:xform xmlns:rest="http://exquery.org/ns/restxq" xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms"
    xmlns:demo="urn:saxon-xforms:demo">
    <xf:model id="m-recipes">
        <xf:instance xmlns="" id="i1">
            <months>
                <mon>01</mon>
                <mon>02</mon>
                <mon>03</mon>
            </months>
        </xf:instance>
        <xf:instance xmlns="" id="i2">
            <months>
                <month code="01">Jan</month>
                <month code="02">Feb</month>
                <month code="03">Mar</month>
            </months>
        </xf:instance>
    </xf:model>
    <div id="content">
        <xf:repeat nodeset="mon">
            <xf:output value="instance('i2')/month[@code = current()]"/>
        </xf:repeat>
    </div>
</xf:xform>

Per the spec should return Jan Feb Mar. However, instead, it throws an exception:

Uncaught 
code: "XPST0081"
​message: "No namespace binding for prefix 'xforms'"
​name: "XError"
​xsltLineNr: "2162"
​xsltModule: "file:/C:/Users/John/Documents/GitHub/Saxon-Forms/src/saxon-xforms.xsl"
​```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions