public void run() throws SaxonApiException { super.run(); RuntimeValue attrNameValue = getOption(_attribute); String attrNameStr = attrNameValue.getString(); String apfx = getOption(_attribute_prefix, (String) null); String ans = getOption(_attribute_namespace, (String) null); if (apfx != null && ans == null) { throw XProcException.dynamicError(34, "You can't specify a prefix without a namespace"); } if (ans != null && attrNameStr.contains(":")) { throw XProcException.dynamicError(34, "You can't specify a namespace if the attribute name contains a colon"); } if (attrNameStr.contains(":")) { attribute = new QName(attrNameStr, attrNameValue.getNode()); } else { // For Saxon 9.4, make sure there's some sort of prefix if there's a namespace; // Saxon will take care of resolving collisions, if necessary if (apfx == null && ans != null) { apfx = "_1"; } attribute = new QName(apfx == null ? "" : apfx, ans, attrNameStr); } label = getOption(_label); replace = getOption(_replace).getBoolean(); matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), getOption(_match)); result.write(matcher.getResult()); }
public void run() throws SaxonApiException { super.run(); RuntimeValue attrNameValue = getOption(_attribute); String attrNameStr = attrNameValue.getString(); String apfx = getOption(_attribute_prefix, (String) null); String ans = getOption(_attribute_namespace, (String) null); if (apfx != null && ans == null) { throw XProcException.dynamicError(34, "You can't specify a prefix without a namespace"); } if (ans != null && attrNameStr.contains(":")) { throw XProcException.dynamicError(34, "You can't specify a namespace if the attribute name contains a colon"); } if (attrNameStr.contains(":")) { attribute = new QName(attrNameStr, attrNameValue.getNode()); } else { // For Saxon 9.4, make sure there's some sort of prefix if there's a namespace; // Saxon will take care of resolving collisions, if necessary if (apfx == null && ans != null) { apfx = "_1"; } attribute = new QName(apfx == null ? "" : apfx, ans, attrNameStr); } label = getOption(_label); replace = getOption(_replace).getBoolean(); matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), getOption(_match)); result.write(matcher.getResult()); }