code: public int executeToDestination(final String pointerStr, final Source source, final Destination destination)
              throws XPointerException
      {
          final Pointer pointer = getPointer(pointerStr);
          final XdmNode node = processor.newDocumentBuilder().wrap(source);
          if (pointer != null)
          {
              if (pointer.isShortHandPresent())
              {
                  return executeShorthandPointer(pointer.getShortHand(), node, destination);
              }
              else if (pointer.isSchemeBased())
              {
                  return executeSchemaPointer(pointer, node, destination);
              }
              else
              {
                  throw new XPointerResourceException("Unknown pointer expression");
              }
          }
          else
          {
              throw new XPointerResourceException("Unknown pointer expression");
          }
      }
docs: Execute a xpointer expression on a xml source.
  The result is send to a Saxon {@link net.sf.saxon.s9api.Destination}
  
  @param pointerStr xpointer expression
  @param source xml source
  @param destination Saxon destination of result stream
  @return number of elements in result infoset excluding comments et processing instructions
  @throws XPointerException the x pointer exception