/* * Copyright (c) 2013 Fraunhofer IGD * * All rights reserved. This program and the accompanying materials are made * available under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * Fraunhofer IGD */ package eu.esdihumboldt.hale.functions.bgis.sourcedesc; import com.google.common.collect.ListMultimap; import eu.esdihumboldt.hale.common.align.model.Cell; import eu.esdihumboldt.hale.io.xslt.XsltGenerationContext; import eu.esdihumboldt.hale.io.xslt.functions.XslVariable; import eu.esdihumboldt.hale.io.xslt.transformations.base.AbstractFunctionTransformation; /** * XSL implementation of source description function. * * @author Simon Templer */ public class XslSourceDescription extends AbstractFunctionTransformation { @Override public String getSequence(Cell cell, ListMultimap<String, XslVariable> variables, XsltGenerationContext xsltContext, Cell typeCell) { String descString = SourceDescriptionUtil.getSourceDescription(typeCell); if (descString != null) { StringBuilder builder = new StringBuilder(); builder.append("<xsl:text>"); builder.append(descString); builder.append("</xsl:text>"); return builder.toString(); } // otherwise a null result return "<def:null/>"; } }