/// <summary>
        /// Transforms a Flat OPC <see cref="XDocument" />.
        /// </summary>
        /// <param name="document">The Flat OPC <see cref="XDocument" /> to be transformed.</param>
        /// <returns>The transformed Flat OPC <see cref="XDocument" />.</returns>
        public override sealed XDocument Transform(XDocument document)
        {
            if (document == null)
            {
                return(null);
            }

            using (var packageDocument = TransformationTools.FromFlatOpcDocument <TDocument>(document))
                return(TransformInPlace(packageDocument).ToFlatOpcDocument());
        }
        /// <summary>
        /// Transforms an instance of a subclass of <see cref="OpenXmlPackage" />.
        /// </summary>
        /// <param name="packageDocument">The document to be transformed.</param>
        /// <returns>The cloned and transformed document.</returns>
        public override sealed TDocument Transform(TDocument packageDocument)
        {
            if (packageDocument == null)
            {
                return(null);
            }

            var result = Transform(packageDocument.ToFlatOpcDocument());

            return(TransformationTools.FromFlatOpcDocument <TDocument>(result));
        }
 public XDocument ToXml(XDocument document)
 {
     return(document == null ? null : ToXml(TransformationTools.FromFlatOpcDocument <TDocument>(document)));
 }