0N/A/*
661N/A * reserved comment block
661N/A * DO NOT REMOVE OR ALTER!
0N/A */
0N/A/*
661N/A * Copyright 2005 The Apache Software Foundation.
661N/A *
661N/A * Licensed under the Apache License, Version 2.0 (the "License");
661N/A * you may not use this file except in compliance with the License.
661N/A * You may obtain a copy of the License at
661N/A *
661N/A * http://www.apache.org/licenses/LICENSE-2.0
661N/A *
661N/A * Unless required by applicable law or agreed to in writing, software
661N/A * distributed under the License is distributed on an "AS IS" BASIS,
661N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
661N/A * See the License for the specific language governing permissions and
661N/A * limitations under the License.
661N/A *
661N/A */
661N/A/*
2362N/A * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
661N/A */
661N/A/*
661N/A * $Id: DOMXSLTTransform.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
0N/A */
0N/Apackage org.jcp.xml.dsig.internal.dom;
0N/A
0N/Aimport java.security.InvalidAlgorithmParameterException;
0N/Aimport org.w3c.dom.Element;
0N/Aimport org.w3c.dom.Node;
0N/A
0N/Aimport javax.xml.crypto.*;
0N/Aimport javax.xml.crypto.dsig.*;
0N/Aimport javax.xml.crypto.dsig.spec.TransformParameterSpec;
0N/Aimport javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec;
0N/A
0N/A/**
0N/A * DOM-based implementation of XSLT Transform.
0N/A * (Uses Apache XML-Sec Transform implementation)
0N/A *
0N/A * @author Sean Mullan
0N/A */
0N/Apublic final class DOMXSLTTransform extends ApacheTransform {
0N/A
0N/A public void init(TransformParameterSpec params)
0N/A throws InvalidAlgorithmParameterException {
0N/A if (params == null) {
0N/A throw new InvalidAlgorithmParameterException("params are required");
0N/A }
0N/A if (!(params instanceof XSLTTransformParameterSpec)) {
0N/A throw new InvalidAlgorithmParameterException("unrecognized params");
0N/A }
0N/A this.params = params;
0N/A }
0N/A
0N/A public void init(XMLStructure parent, XMLCryptoContext context)
0N/A throws InvalidAlgorithmParameterException {
0N/A
0N/A super.init(parent, context);
0N/A unmarshalParams(DOMUtils.getFirstChildElement(transformElem));
0N/A }
0N/A
0N/A private void unmarshalParams(Element sheet) {
0N/A this.params = new XSLTTransformParameterSpec
0N/A (new javax.xml.crypto.dom.DOMStructure(sheet));
0N/A }
0N/A
0N/A public void marshalParams(XMLStructure parent, XMLCryptoContext context)
0N/A throws MarshalException {
0N/A super.marshalParams(parent, context);
0N/A XSLTTransformParameterSpec xp =
0N/A (XSLTTransformParameterSpec) getParameterSpec();
0N/A Node xsltElem =
0N/A ((javax.xml.crypto.dom.DOMStructure) xp.getStylesheet()).getNode();
0N/A DOMUtils.appendChild(transformElem, xsltElem);
0N/A }
0N/A}