franta-hg@97: /** franta-hg@97: * Alt2XML franta-hg@97: * Copyright © 2014 František Kučera (frantovo.cz) franta-hg@97: * franta-hg@97: * This program is free software: you can redistribute it and/or modify franta-hg@97: * it under the terms of the GNU General Public License as published by franta-hg@111: * the Free Software Foundation, version 3 of the License. franta-hg@97: * franta-hg@97: * This program is distributed in the hope that it will be useful, franta-hg@97: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@97: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@97: * GNU General Public License for more details. franta-hg@97: * franta-hg@97: * You should have received a copy of the GNU General Public License franta-hg@97: * along with this program. If not, see . franta-hg@97: */ franta-hg@97: package cz.frantovo.alt2xml.out.xpath; franta-hg@97: franta-hg@97: import javax.xml.namespace.QName; franta-hg@97: import javax.xml.xpath.XPathVariableResolver; franta-hg@97: franta-hg@97: /** franta-hg@97: * franta-hg@97: * @author Ing. František Kučera (frantovo.cz) franta-hg@97: */ franta-hg@97: public class CompoundVariableResolver implements XPathVariableResolver { franta-hg@97: franta-hg@97: private final XPathVariableResolver[] resolvers; franta-hg@97: franta-hg@97: public CompoundVariableResolver(XPathVariableResolver... resolvers) { franta-hg@97: this.resolvers = resolvers; franta-hg@97: } franta-hg@97: franta-hg@97: @Override franta-hg@97: public Object resolveVariable(QName variableName) { franta-hg@97: for (XPathVariableResolver r : resolvers) { franta-hg@97: Object value = r.resolveVariable(variableName); franta-hg@97: if (value != null) { franta-hg@97: return value; franta-hg@97: } franta-hg@97: } franta-hg@97: return null; franta-hg@97: } franta-hg@97: }