
com.thesett.common.xml.XslTransformerUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xmlutils Show documentation
Show all versions of xmlutils Show documentation
My xmlutils library, a mixed bag of re-usable utility code.
/*
* Copyright The Sett Ltd, 2005 to 2014.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thesett.common.xml;
import java.io.Reader;
import java.io.Writer;
import java.net.URL;
import java.util.Map;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
/**
* Utility Class to perform xsl transformations.
*
*
CRC Card
* Responsibilities Collaborations
* Perform a parameterized xsl transformation between two character streams.
*
*
* @author Rupert Smith
*/
public class XslTransformerUtils
{
/**
* Convert an XML string to another XML string using the XSL specified.
*
* @param documentReader A reader to read the input document through.
* @param xslt The URL of the xsl transformation file.
* @param parameters A map of (String, Object) parameters to pass into the transformation.
* @param outputWriter A writer that will accept the output of the transformation.
*
* @throws TransformerException If there was error during the tranformation.
*/
public static void performXslTransformation(Reader documentReader, URL xslt, Map© 2015 - 2025 Weber Informatics LLC | Privacy Policy