return TAG_NAME;
}
public Mediator createMediator(OMElement elem) {
XSLTMediator transformMediator = new XSLTMediator();
OMAttribute attXslt = elem.getAttribute(ATT_KEY);
OMAttribute attSource = elem.getAttribute(ATT_SOURCE);
OMAttribute attTarget = elem.getAttribute(ATT_TARGET);
if (attXslt != null) {
transformMediator.setXsltKey(attXslt.getAttributeValue());
} else {
handleException("The 'key' attribute is required for the XSLT mediator");
}
if (attSource != null) {
try {
transformMediator.setSourceXPathString(attSource.getAttributeValue());
AXIOMXPath xp = new AXIOMXPath(attSource.getAttributeValue());
OMElementUtils.addNameSpaces(xp, elem, log);
transformMediator.setSource(xp);
} catch (JaxenException e) {
handleException("Invalid XPath specified for the source attribute : " +
attSource.getAttributeValue());
}
}
if (attTarget != null) {
transformMediator.setTargetPropertyName(attTarget.getAttributeValue());
}
// after successfully creating the mediator
// set its common attributes such as tracing etc
processTraceState(transformMediator, elem);
// set the features
Iterator iter = elem.getChildrenWithName(FEATURE_Q);
while (iter.hasNext()) {
OMElement featureElem = (OMElement) iter.next();
OMAttribute attName = featureElem.getAttribute(ATT_NAME);
OMAttribute attValue = featureElem.getAttribute(ATT_VALUE);
if (attName != null && attValue != null) {
String name = attName.getAttributeValue();
String value = attValue.getAttributeValue();
if (name != null && value != null) {
if ("true".equals(value.trim())) {
transformMediator.addFeature(name.trim(),
true);
} else if ("false".equals(value.trim())) {
transformMediator.addFeature(name.trim(),
false);
} else {
handleException("The feature must have value true or false");
}
} else {
handleException("The valid values for both of the name and value are need");
}
} else {
handleException("Both of the name and value attribute are required for a feature");
}
}
transformMediator.addAllProperties(
MediatorPropertyFactory.getMediatorProperties(elem));
return transformMediator;
}