Project

Profile

Help

Revision e5c54e9b

Added by Michael Kay about 12 years ago

Fix bug 2859123 xsl:copy when context item is undefined

View differences:

latest9.1/bj/net/sf/saxon/instruct/Copy.java
64 64

  
65 65

  
66 66
    public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
67
        if (contextItemType == null) {
68
            // See spec bug 7624, test case copy903err
69
            XPathException err = new XPathException("Context item for xsl:copy is undefined", "XTTE0945");
70
            err.setLocator(this);
71
            throw err;
72
        }
67 73
        if (contextItemType instanceof NodeTest) {
68 74
            switch (contextItemType.getPrimitiveType()) {
69 75
                // For elements and attributes, assume the type annotation will change
......
189 195
//        c2.setOrigin(this);
190 196
        SequenceReceiver out = c2.getReceiver();
191 197
        Item item = context.getContextItem();
198
        if (item == null) {
199
            // See spec bug 7624, test case copy903err
200
            XPathException err = new XPathException("Context item for xsl:copy is undefined", "XTTE0945");
201
            err.setLocator(this);
202
            throw err;
203
        }
192 204
        if (!(item instanceof NodeInfo)) {
193 205
            out.append(item, locationId, NodeInfo.ALL_NAMESPACES);
194 206
            return null;

Also available in: Unified diff