使用XSLT进行XML到XML的转换 [英] XML to XML conversion using XSLT

查看:66
本文介绍了使用XSLT进行XML到XML的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想使用XSLT从XML创建XML。输入xml将包含一些需要在输出xml中替换或添加的标记。我想写一个XSL文件同样可以帮助我这个



例如:

输入XML:

 <   add    名称  =  ABC    connectionstring   = 数据源= abc;初始目录= abc;集成安全性= SSPI    /  >  





使用XSLT生成的输出XML: -

 <   configuration  >  
< connectionstrings >
< add name = abc connectionstring < span class =code-keyword> = 数据源= abc;初始目录= abc;集成安全性= SSPI / >
< / connectionstrings >
< system.web >
< 成员资格 defaultprovider = abc userisonlinetimewindow = 20 >
< 提供商 >
< span class =code-keyword>< clear / >
< add name = abc type = aabc。 BusinessObject。<?xml version = 1.0 = ?>< br mode = 保持 = />< configuration>< br mode = abc = connectionString = data = source = abc; Initial catalog = abc;集成 security = SSPI / >

< system.web >
< 成员资格 defaultprovider = abc userisonlinetimewindow = < span class =code-keyword> 20 >
< 提供商 >
< clear / >
< add name = abc type = aabc.BusinessObject.abc passwordformat = 加密 < span class =code-attribute> connectionstrin gname = abc enablepasswordretrieval = true enablepasswordreset = false requiresquestionandanswer = false writeexceptionstoeventlog < span class =code-keyword> = true minrequiredpasswordlength = 5 minrequirednonalphanumericcharacters = 0 requiresuniqueemail = false / >
< / providers >
< / membership >
< / system.web >
< / configuration >



passwordFormat =Encrypted connectionStringName =abcenablePasswordRetrieval =trueenablePasswordReset =falserequiresQuestionAndAnswer =falsewriteExceptionsToEventLog =trueminRequiredPasswordLength =5minRequiredNonalphanumericCharacters =0requiresUniqueEmail =false/>



请帮帮我。等待你的回复。



谢谢。



Pre标签已添加,但不知道如何格式化最后一部分,因此将其保存在代码块中。 [/ Edit]

解决方案

几个教程网站,以帮助您入门。



http://www.w3schools.com/xsl/xsl_languages.asp

http://webdesign.about.com/od/xslt/a/xslt-tutorial-1.htm

Hi

I want to create an XML from a XML using XSLT. The input xml would contain some tags that needs to be replaced or added in the output xml. I want write the XSL file for same can you please help me in this

e.g :
Input XML :

<add name="ABC" connectionstring="Data Source=abc;Initial Catalog=abc;Integrated Security=SSPI" />



Output XML generated using XSLT :-

<configuration>
  <connectionstrings>
    <add name="abc" connectionstring="Data Source=abc;Initial Catalog=abc;Integrated Security=SSPI" />
  </connectionstrings>
  <system.web>
    <membership defaultprovider="abc" userisonlinetimewindow="20">
      <providers>
        <clear />
        <add name="abc" type="aabc.BusinessObject.<?xml version=" 1.0="?><br mode=" hold=" /><configuration><br mode=" abc=" connectionString=" data="" source="abc;Initial" catalog="abc;Integrated" security="SSPI"/">
  
  <system.web>
    <membership defaultprovider="abc" userisonlinetimewindow="20">
      <providers>
        <clear />
        <add name="abc" type="aabc.BusinessObject.abc" passwordformat="Encrypted" connectionstringname="abc" enablepasswordretrieval="true" enablepasswordreset="false" requiresquestionandanswer="false" writeexceptionstoeventlog="true" minrequiredpasswordlength="5" minrequirednonalphanumericcharacters="0" requiresuniqueemail="false" />
      </providers>
    </membership>
  </system.web>
</configuration>


"passwordFormat="Encrypted" connectionStringName="abc" enablePasswordRetrieval="true" enablePasswordReset="false" requiresQuestionAndAnswer="false" writeExceptionsToEventLog="true" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="false"/>

Please help me in this. Waiting for your response.

Thanks.

[Edit]Pre tags added, but don''t know how to format the last part, so kept it inside code blocks.[/Edit]

解决方案

A couple of tutorial sites to get you started.

http://www.w3schools.com/xsl/xsl_languages.asp
http://webdesign.about.com/od/xslt/a/xslt-tutorial-1.htm


这篇关于使用XSLT进行XML到XML的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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