有没有办法基于XSD文件动态创建XSL文件 [英] Is there a way to dynamically create XSL file based on XSD file

查看:34
本文介绍了有没有办法基于XSD文件动态创建XSL文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我需要将 XML 文件转换为 CSV 文件,反之亦然.我不能使用单个 XSL 文件,因为有不同的 XML 和 CSV 格式.所以,我只是想知道是否有任何方法(任何工具或编辑器或任何 API)可以基于 XSD 文件创建 XSL 文件.

I have a project where I need to convert a XML file to CSV file and vice versa. I can't use a single XSL file because, there are different XML and CSV formats. So, I am just wondering if there is any way (any tool or editors or any APIs) to create XSL file based on XSD file.

我也愿意接受任何其他建议(我相信我无法避免使用 XSL,因为将来我可能会被要求转换为不同的格式,例如 pdf、html 等)

I am also open to any other suggestions too (I believe I can't avoid XSL because in the future I might be asked to convert to different formats such as pdf, html etc)

推荐答案

XSD 文件描述了符合特定规则的有效 XML 文件的结构.XSLT 文件描述了如何将输入 XML 文档转换为某种输出形式,可能是也可能不是 XML.无法从 XSD 文件推断出 XSL 转换,因为它们处理 XML 的完全不同方面.

An XSD file describes the structure of a valid XML file that conforms to certain rules. An XSLT file describes how to transform an input XML document to some output form, which may or may not be XML. It is not possible to deduce an XSL transformation from an XSD file as they address completely different aspects of XML.

换句话说,XSD 允许您确认 XML 文档遵守一组预定义的约束,但没有说明如何处理 XML,或如何将其转换为其他内容.

In other words, an XSD allows you to confirm that an XML document adheres to a predefined set of constraints, but says nothing about what to do with the XML, or how to transform it to something else.

这篇关于有没有办法基于XSD文件动态创建XSL文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆