XSL xmlns问题 [英] XSL xmlns problem

查看:83
本文介绍了XSL xmlns问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个xsl转换将xml转换为另一个(非标准)数据结构。一切都很好,直到我有一个带有xmlns atts的xml文件,然后我得到的是元素内容输出,没有我写过的标记。从xml中删除xmlns atts,一切都很好。我尝试将xml中的xmlns添加到xsl的xsl:stylesheet元素中但得到相同的结果。这与xmlspy和xalan相同。


有人能指出我出错的方向吗?


谢谢

E

Hi,

I have an xsl transform to convert xml into another (non-standard) data structure. All is fine until I have an xml file with xmlns atts and then all I get is the element contents output with none of the tagging that I have written in. Remove the xmlns atts from the xml and all is fine. I’ve tried adding in the xmlns from the xml into the xsl:stylesheet element of the xsl but get the same result. This is the same run on xmlspy and with xalan.

Can anyone point me in the direction of where I’m going wrong?

Thanks
E

推荐答案

您需要编辑xpath以使用命名空间。


例如,假设您的xpath是" / root / somenode / leaf / @ id"

声明您的命名空间如xmlns:sns =" www。 google.ca"

你的xpath然后变成:" / sns:root / sns:somenode / sns:leaf / @ id"
You need to edit your xpaths to use the namespace.

eg, say your xpath is "/root/somenode/leaf/@id"
declare your namespace like xmlns:sns="www.google.ca"
your xpath then becomes: "/sns:root/sns:somenode/sns:leaf/@id"





我可能会错误理解这个...请看下面的虚拟示例


我虽然这个 - xmlns =" http:/ /xml.dummy.com/schema/analytical" ;-会给出某种默认值


如果你通过xsl运行xml你不会得到任何(古老的)在xsl:text元素输出中标记但是从xml的文档节点中删除xmlns atts并且你做了...


仍然充满了我很害怕。 />

感谢您对此的帮助...

xml
展开 | 选择 | Wrap | 行号


< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


这篇关于XSL xmlns问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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