如何删除字符串< string xmlns =" http://schemas.microsoft.com/2003/10/Serialization/">在xml中使用xslt [英] How to remove string <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/"> in xml with xslt

查看:92
本文介绍了如何删除字符串< string xmlns =" http://schemas.microsoft.com/2003/10/Serialization/">在xml中使用xslt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


感谢您阅读我的问题......


我正在努力将一个xml转换为另一个xml xslt。


以下是我的代码。


 


                     StringBuilder的OSB =新的StringBuilder();

                     XmlDocument的XDOC =新的XmlDocument();

                     xDoc.LoadXml(的 sSourceXML );

                     XslCompiledTransform myXslTrans =新XslCompiledTransform();

                     myXslTrans.Load(的 sXsltPath );

                     System.IO.StringWriter SW =新System.IO.StringWriter(OSB);

            &NBSP ;       XmlTextWriter的myWriter =新的XmlTextWriter(SW);

                &NBSP ;   myXslTrans.Transform(XDOC,NULL,myWriter);

               &NBSP ;    return oSB.ToString();


我得到的结果xml低于字符串。


< string xmlns =" http://schemas.microsoft.com/2003/10/Serialization/">


我希望在我的结果xml中删除字符串以上..


你能告诉我怎么做......


AnilJayanti

解决方案

如果要更改XSLT代码而不是输出该命名空间,那么我们需要查看您的XSLT代码。它可能只是有例如。


  < XSL:样式表的xmlns:XS = QUOT; HTTP://www.w3.org/1999/XSL/Transform"


&NBSP;&NBSP;&NBSP;&NBSP; version =" 1.0"


     xmlns =" http://schemas.microsoft.com/2003/10/Serialization/">


然后将其更改为


&NBSP; < XSL:样式表的xmlns:XS = QUOT; HTTP://www.w3.org/1999/XSL/Transform"


&NBSP;&NBSP;&NBSP;&NBSP; version =" 1.0">


可能就足够了。


 


 


Hi,

Thanks for reading my question...

i'm working on transforming one xml to another xml using xslt.

below is my code.

 

                    StringBuilder oSB = new StringBuilder();
                    XmlDocument xDoc = new XmlDocument();
                    xDoc.LoadXml(sSourceXML);
                    XslCompiledTransform myXslTrans = new XslCompiledTransform();
                    myXslTrans.Load(sXsltPath);
                    System.IO.StringWriter SW = new System.IO.StringWriter(oSB);
                    XmlTextWriter myWriter = new XmlTextWriter(SW);
                    myXslTrans.Transform(xDoc, null, myWriter);
                    return oSB.ToString();

i'm getting a result xml with below string.

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">

i want to be removed above string in my result xml..

can u show me how to do this...


AnilJayanti

解决方案

If you want to change the XSLT code not to output that namespace then we need to see your XSLT code. It might simply have e.g.

  <xsl:stylesheet xmlns:xs="http://www.w3.org/1999/XSL/Transform"

     version="1.0"

     xmlns="http://schemas.microsoft.com/2003/10/Serialization/">

and then changing that to

  <xsl:stylesheet xmlns:xs="http://www.w3.org/1999/XSL/Transform"

     version="1.0">

might suffice.

 

 


这篇关于如何删除字符串&lt; string xmlns =&quot; http://schemas.microsoft.com/2003/10/Serialization/&quot;&gt;在xml中使用xslt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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