Exemple #1
0
 public static Object getValue(
     Class<?> type, Item colItem, Configuration config, CommandContext context)
     throws XPathException, ValidationException, TransformationException {
   Object value = colItem;
   if (value instanceof AtomicValue) {
     value = getValue((AtomicValue) colItem, context);
   } else if (value instanceof Item) {
     Item i = (Item) value;
     if (XMLSystemFunctions.isNull(i)) {
       return null;
     }
     BuiltInAtomicType bat = typeMapping.get(type);
     if (bat != null) {
       AtomicValue av = new StringValue(i.getStringValueCS());
       ConversionResult cr = Converter.convert(av, bat, config.getConversionRules());
       value = cr.asAtomic();
       value = getValue((AtomicValue) value, context);
       if (value instanceof Item) {
         value = ((Item) value).getStringValue();
       }
     } else {
       value = i.getStringValue();
     }
   }
   return FunctionDescriptor.importValue(value, type);
 }
Exemple #2
0
  public void validate(Declaration decl) throws XPathException {

    // 2.0 spec has reverted to the 1.0 rule that xsl:text may not have child elements
    AxisIterator kids = iterateAxis(Axis.CHILD);
    value = StringValue.EMPTY_STRING;
    while (true) {
      Item child = kids.next();
      if (child == null) {
        break;
      } else if (child instanceof StyleElement) {
        ((StyleElement) child).compileError("xsl:text must not contain child elements", "XTSE0010");
        return;
      } else {
        value = StringValue.makeStringValue(child.getStringValueCS());
        // continue;
      }
    }
    super.validate(decl);
  }
Exemple #3
0
  public void validate() throws TransformerConfigurationException {
    checkWithinTemplate();

    // 2.0 spec has reverted to the 1.0 rule that xsl:text may not have child elements
    AxisIterator kids = iterateAxis(Axis.CHILD);
    while (true) {
      Item child = kids.next();
      if (child == null) {
        value = StringValue.EMPTY_STRING;
        break;
      } else if (child instanceof StyleElement) {
        compileError("xsl:text must not contain child elements", "XT0010");
        return;
      } else {
        value = new StringValue(child.getStringValueCS());
        break;
      }
    }
    super.validate();
  }