code: static Object coerceToJava(XObject xo) throws TransformerException {
          if (xo instanceof XBoolean) {
              return xo.bool();
          } else if (xo instanceof XNumber) {
              return xo.num();
          } else if (xo instanceof XString) {
              return xo.str();
          } else if (xo instanceof XNodeSet) {
              NodeList nodes = xo.nodelist();
              // if there is only one node in the nodeset return it rather than the list
              if (nodes.getLength() == 1) {
                  return nodes.item(0);
              } else {
                  return nodes;
              }
          } else {
              // unexpected result type
              throw new AssertionError();
          }
      }
docs: Return the Java value corresponding to an XPath result.
  
  @param xo the XPath type
  @return the corresponding Java value per the JSTL mapping rules
  @throws TransformerException if there was a problem converting the type