public Expression compile(Executable exec) throws XPathException { Copy inst = new Copy(copyNamespaces, inheritNamespaces, schemaType, validationAction); Expression content = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true); if (attributeSets != null) { UseAttributeSets use = new UseAttributeSets(attributeSets); // The use-attribute-sets is ignored unless the context item is an element node. So we // wrap the UseAttributeSets instruction in a conditional to perform a run-time test Expression condition = new InstanceOfExpression( new ContextItemExpression(), SequenceType.makeSequenceType(NodeKindTest.ELEMENT, StaticProperty.EXACTLY_ONE)); Expression choice = Choose.makeConditional(condition, use); if (content == null) { content = choice; } else { content = Block.makeBlock(choice, content); content.setLocationId( allocateLocationId(getSystemId(), getLineNumber())); } } if (content == null) { content = Literal.makeEmptySequence(); } inst.setContentExpression(content); return inst; }
public Expression compile(Executable exec) throws XPathException { Copy inst = new Copy(copyNamespaces, inheritNamespaces, schemaType, validationAction); Expression content = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true); if (attributeSets != null) { UseAttributeSets use = new UseAttributeSets(attributeSets); // The use-attribute-sets is ignored unless the context item is an element node. So we // wrap the UseAttributeSets instruction in a conditional to perform a run-time test Expression condition = new InstanceOfExpression( new ContextItemExpression(), SequenceType.makeSequenceType(NodeKindTest.ELEMENT, StaticProperty.EXACTLY_ONE)); Expression choice = Choose.makeConditional(condition, use); if (content == null) { content = choice; } else { content = Block.makeBlock(choice, content); content.setLocationId( allocateLocationId(getSystemId(), getLineNumber())); } } if (content == null) { content = Literal.makeEmptySequence(); } inst.setContentExpression(content); return inst; }
public Expression compile(Executable exec) throws XPathException { Copy inst = new Copy(copyNamespaces, inheritNamespaces, schemaType, validationAction); Expression content = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true); if (attributeSets != null) { UseAttributeSets use = new UseAttributeSets(attributeSets); // The use-attribute-sets is ignored unless the context item is an element node. So we // wrap the UseAttributeSets instruction in a conditional to perform a run-time test Expression condition = new InstanceOfExpression( new ContextItemExpression(), SequenceType.makeSequenceType(NodeKindTest.ELEMENT, StaticProperty.EXACTLY_ONE)); Expression choice = Choose.makeConditional(condition, use); if (content == null) { content = choice; } else { content = Block.makeBlock(choice, content); content.setLocationId( allocateLocationId(getSystemId(), getLineNumber())); } } if (content == null) { content = Literal.makeEmptySequence(); } inst.setContentExpression(content); return inst; }