* @throws TemplateException
*/
public static Expression attributeValue(TagData data,TagLibTag tag, String type,boolean parseExpression,boolean isNonName, Expression noExpression) throws TemplateException {
Expression expr;
try {
ExprTransformer transfomer=null;
if(parseExpression){
transfomer = tag.getTagLib().getExprTransfomer();
}
else {
if(data.getSimpleExprTransformer()==null) {
data.setSimpleExprTransformer(new SimpleExprTransformer('#'));
//set.setSpecialChar();
}
transfomer=data.getSimpleExprTransformer();
}
if(isNonName) {
int pos=data.cfml.getPos();
try {
expr=transfomer.transform(data.page,data.ep,data.flibs,data.scriptTags,data.cfml,data.settings);
}
catch(TemplateException ete) {
if(data.cfml.getPos()==pos)expr=noExpression;
else throw ete;
}
}
else expr=transfomer.transformAsString(data.page,data.ep,data.flibs,data.scriptTags,data.cfml,data.settings,true);
if(type.length()>0) {
expr=CastOther.toExpression(expr, type);
}
} catch (TagLibException e) {
throw new TemplateException(data.cfml,e);