/** * Get the name of the nodes matched by this nodetest, if it matches a specific name. * Return null if the node test matches nodes of more than one name */ @Override public StructuredQName getMatchingNodeName() { return StandardNames.getStructuredQName(StandardNames.XS_ERROR); }
/** * Get the name of the nodes matched by this nodetest, if it matches a specific name. * Return null if the node test matches nodes of more than one name */ @Override public StructuredQName getMatchingNodeName() { return StandardNames.getStructuredQName(StandardNames.XS_ERROR); }
@Override public StructuredQName getObjectName() { return StandardNames.getStructuredQName(StandardNames.XSL_TEMPLATE); }
/** * Get a QName for a given namecode. * * @param nameCode a code identifying an expanded QName, e.g. of an element or attribute * @return a qName containing the URI and local name corresponding to the supplied name code. * The prefix will be set to an empty string. */ public StructuredQName getUnprefixedQName(int nameCode) { int fp = nameCode & FP_MASK; if ((fp & USER_DEFINED_MASK) == 0) { return StandardNames.getStructuredQName(fp); } return integerToQName.get(fp); }
/** * Get a QName for a given namecode. * * @param nameCode a code identifying an expanded QName, e.g. of an element or attribute * @return a qName containing the URI and local name corresponding to the supplied name code. * The prefix will be set to an empty string. */ public StructuredQName getUnprefixedQName(int nameCode) { int fp = nameCode & FP_MASK; if ((fp & USER_DEFINED_MASK) == 0) { return StandardNames.getStructuredQName(fp); } return integerToQName.get(fp); }
/** * Diagnostic output explaining the keys * * @param out the expression presenter that will display the information */ public void exportKeys(ExpressionPresenter out, Map<Component, Integer> componentIdMap) throws XPathException { for (Map.Entry<StructuredQName, KeyDefinitionSet> e : keyDefinitions.entrySet()) { boolean reusable = e.getValue().isReusable(); List<KeyDefinition> list = e.getValue().getKeyDefinitions(); for (KeyDefinition kd : list) { if (!kd.getObjectName().equals(StandardNames.getStructuredQName(StandardNames.XS_IDREFS))) { kd.export(out, reusable, componentIdMap); } } } } }
/** * Diagnostic output explaining the keys * * @param out the expression presenter that will display the information */ public void exportKeys(ExpressionPresenter out, Map<Component, Integer> componentIdMap) throws XPathException { for (Map.Entry<StructuredQName, KeyDefinitionSet> e : keyDefinitions.entrySet()) { boolean reusable = e.getValue().isReusable(); List<KeyDefinition> list = e.getValue().getKeyDefinitions(); for (KeyDefinition kd : list) { if (!kd.getObjectName().equals(StandardNames.getStructuredQName(StandardNames.XS_IDREFS))) { kd.export(out, reusable, componentIdMap); } } } } }
/** * Type-check the expression. This also calls preEvaluate() to evaluate the function * if all the arguments are constant; functions that do not require this behavior * can override the preEvaluate method. */ public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { Expression e = super.typeCheck(visitor, contextItemType); idRefKey = visitor.getExecutable().getKeyManager().getKeyDefinitionSet( StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); return e; }
/** * Type-check the expression. This also calls preEvaluate() to evaluate the function * if all the arguments are constant; functions that do not require this behavior * can override the preEvaluate method. */ public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { Expression e = super.typeCheck(visitor, contextItemType); idRefKey = visitor.getExecutable().getKeyManager().getKeyDefinitionSet( StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); return e; }
/** * Type-check the expression. This also calls preEvaluate() to evaluate the function * if all the arguments are constant; functions that do not require this behavior * can override the preEvaluate method. */ public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { Expression e = super.typeCheck(visitor, contextItemType); idRefKey = visitor.getExecutable().getKeyManager().getKeyDefinitionSet( StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); return e; }
/** * An internal key definition is used to support the idref() function. The key definition * is equivalent to xsl:key match="element(*, xs:IDREF) | element(*, IDREFS) | * attribute(*, xs:IDREF) | attribute(*, IDREFS)" use=".". This method creates this * key definition. * @param config The configuration. This is needed because the patterns that are * generated need access to schema information. */ private void registerIdrefKey(Configuration config) { PatternFinder idref = IdrefTest.getInstance(); //Expression eval = new Atomizer(new ContextItemExpression(), config); StringFn sf = (StringFn)SystemFunction.makeSystemFunction( "string", new Expression[]{new ContextItemExpression()}); StringLiteral regex = new StringLiteral("\\s+"); Tokenize use = (Tokenize)SystemFunction.makeSystemFunction("tokenize", new Expression[]{sf, regex}); KeyDefinition key = new KeyDefinition(idref, use, null, null); key.setIndexedItemType(BuiltInAtomicType.STRING); try { addKeyDefinition(StandardNames.getStructuredQName(StandardNames.XS_IDREFS), key, config); } catch (XPathException err) { throw new AssertionError(err); // shouldn't happen } }
/** * Get the result when multiple idref values are supplied. Note this is also called from * compiled XQuery code. * @param doc the document to be searched * @param keys the idref values supplied * @param context the dynamic execution context * @return iterator over the result of the function * @throws XPathException */ public static SequenceIterator getIdrefMultiple(DocumentInfo doc, SequenceIterator keys, XPathContext context) throws XPathException { IdrefMappingFunction map = new IdrefMappingFunction(); map.document = doc; map.keyContext = context; map.keyManager = context.getController().getKeyManager(); map.keySet = map.keyManager.getKeyDefinitionSet(StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); SequenceIterator allValues = new MappingIterator(keys, map); return new DocumentOrderIterator(allValues, LocalOrderComparer.getInstance()); }
/** * An internal key definition is used to support the idref() function. The key definition * is equivalent to xsl:key match="element(*, xs:IDREF) | element(*, IDREFS) | * attribute(*, xs:IDREF) | attribute(*, IDREFS)" use=".". This method creates this * key definition. * @param config The configuration. This is needed because the patterns that are * generated need access to schema information. */ private void registerIdrefKey(Configuration config) { PatternFinder idref = IdrefTest.getInstance(); Expression eval = new Atomizer(new ContextItemExpression(), config); StringLiteral regex = new StringLiteral("\\s"); Tokenize use = (Tokenize)SystemFunction.makeSystemFunction("tokenize", new Expression[]{eval, regex}); KeyDefinition key = new KeyDefinition(idref, use, null, null); key.setIndexedItemType(BuiltInAtomicType.STRING); try { addKeyDefinition(StandardNames.getStructuredQName(StandardNames.XS_IDREFS), key, config); } catch (XPathException err) { throw new AssertionError(err); // shouldn't happen } }
/** * An internal key definition is used to support the idref() function. The key definition * is equivalent to xsl:key match="element(*, xs:IDREF) | element(*, IDREFS) | * attribute(*, xs:IDREF) | attribute(*, IDREFS)" use=".". This method creates this * key definition. * @param config The configuration. This is needed because the patterns that are * generated need access to schema information. */ private void registerIdrefKey(Configuration config) { PatternFinder idref = IdrefTest.getInstance(); Expression eval = new Atomizer(new ContextItemExpression(), config); StringLiteral regex = new StringLiteral("\\s"); Tokenize use = (Tokenize)SystemFunction.makeSystemFunction("tokenize", new Expression[]{eval, regex}); KeyDefinition key = new KeyDefinition(idref, use, null, null); key.setIndexedItemType(BuiltInAtomicType.STRING); try { addKeyDefinition(StandardNames.getStructuredQName(StandardNames.XS_IDREFS), key, config); } catch (XPathException err) { throw new AssertionError(err); // shouldn't happen } }
/** * Get the result when multiple idref values are supplied. Note this is also called from * compiled XQuery code. * * @param doc the document to be searched * @param keys the idref values supplied * @param context the dynamic execution context * @return iterator over the result of the function * @throws XPathException if a dynamic error occurs */ public static SequenceIterator<NodeInfo> getIdrefMultiple(TreeInfo doc, SequenceIterator<StringValue> keys, XPathContext context) throws XPathException { IdrefMappingFunction map = new IdrefMappingFunction(); map.document = doc; map.keyContext = context; map.keyManager = context.getController().getKeyManager(); map.keySet = map.keyManager.getKeyDefinitionSet(StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); SequenceIterator<? extends NodeInfo> allValues = new MappingIterator<>(keys, map); return new DocumentOrderIterator(allValues, LocalOrderComparer.getInstance()); }
/** * Get the result when multiple idref values are supplied. Note this is also called from * compiled XQuery code. * @param doc the document to be searched * @param keys the idref values supplied * @param context the dynamic execution context * @return iterator over the result of the function * @throws XPathException */ public static SequenceIterator getIdrefMultiple(DocumentInfo doc, SequenceIterator keys, XPathContext context) throws XPathException { IdrefMappingFunction map = new IdrefMappingFunction(); map.document = doc; map.keyContext = context; map.keyManager = context.getController().getKeyManager(); map.keySet = map.keyManager.getKeyDefinitionSet(StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); SequenceIterator allValues = new MappingIterator(keys, map); return new DocumentOrderIterator(allValues, LocalOrderComparer.getInstance()); }
/** * Get the result when multiple idref values are supplied. Note this is also called from * compiled XQuery code. * * @param doc the document to be searched * @param keys the idref values supplied * @param context the dynamic execution context * @return iterator over the result of the function * @throws XPathException if a dynamic error occurs */ public static SequenceIterator<NodeInfo> getIdrefMultiple(TreeInfo doc, SequenceIterator<StringValue> keys, XPathContext context) throws XPathException { IdrefMappingFunction map = new IdrefMappingFunction(); map.document = doc; map.keyContext = context; map.keyManager = context.getController().getKeyManager(); map.keySet = map.keyManager.getKeyDefinitionSet(StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); SequenceIterator<? extends NodeInfo> allValues = new MappingIterator<>(keys, map); return new DocumentOrderIterator(allValues, LocalOrderComparer.getInstance()); }
/** * Get the result when multiple idref values are supplied. Note this is also called from * compiled XQuery code. * @param doc the document to be searched * @param keys the idref values supplied * @param context the dynamic execution context * @return iterator over the result of the function * @throws XPathException */ public static SequenceIterator getIdrefMultiple(DocumentInfo doc, SequenceIterator keys, XPathContext context) throws XPathException { IdrefMappingFunction map = new IdrefMappingFunction(); map.document = doc; map.keyContext = context; map.keyManager = context.getController().getKeyManager(); map.keySet = map.keyManager.getKeyDefinitionSet(StandardNames.getStructuredQName(StandardNames.XS_IDREFS)); SequenceIterator allValues = new MappingIterator(keys, map); return new DocumentOrderIterator(allValues, LocalOrderComparer.getInstance()); }
Expression sf = SystemFunction.makeCall("string", rsc, new ContextItemExpression()); Expression use = SystemFunction.makeCall("tokenize", rsc, sf); // Use the new tokenize#1 final StructuredQName qName = StandardNames.getStructuredQName(StandardNames.XS_IDREFS); SymbolicName symbolicName = new SymbolicName(StandardNames.XSL_KEY, qName); KeyDefinition key = new KeyDefinition(symbolicName, pp, use, null, null);
Expression sf = SystemFunction.makeCall("string", rsc, new ContextItemExpression()); Expression use = SystemFunction.makeCall("tokenize", rsc, sf); // Use the new tokenize#1 final StructuredQName qName = StandardNames.getStructuredQName(StandardNames.XS_IDREFS); SymbolicName symbolicName = new SymbolicName(StandardNames.XSL_KEY, qName); KeyDefinition key = new KeyDefinition(symbolicName, pp, use, null, null);