加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

.net – 如何将xsl stylesheet节点添加到XmlSerializer生成的XML

发布时间:2020-12-16 00:01:00 所属栏目:百科 来源:网络整理
导读:我有一个WCF REST服务,它返回使用XmlSerializer序列化的对象. 如何将WSL样式表信息(如下所示)添加到WCF服务返回的输出中? ?xml version="1.0" encoding="utf-8"??xml-stylesheet type="text/xsl" href="transforms/Customer.xsl"?Customer NameFoo/Name/Cus
我有一个WCF REST服务,它返回使用XmlSerializer序列化的对象.
如何将WSL样式表信息(如下所示)添加到WCF服务返回的输出中?
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="transforms/Customer.xsl"?>
<Customer>
    <Name>Foo</Name>
</Customer>

我目前的业务合同:

[OperationContract,XmlSerializerFormat]
[WebGet( UriTemplate = "{id}" )]
Customer GetById( string id );

我希望能够做什么,以便控制样式表参考:

[OperationContract,XmlSerializerFormat]
[XslStylesheet( Href = "transforms/Customer.xsl" )]
[WebGet( UriTemplate = "{id}" )]
Customer GetById( string id );
This article描述了如何引入[IncludeXmlDeclaration]属性.你应该能够为你的XslStylesheet属性做类似的事情.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读