· tech · 2 min read
RDF数据读取到XMLDataSource
前段时间看ASP.NET 2.0的讲座视频,了解到了用XPath(""), 这种读取xml数据的无赖方法。一开始用的很开心,但是后来发现有rdf:RDF(貌似rss1.0的),这种结构的就没有办法解析了。google了一下,发现这个XMLDatasource果然还是不支持rdf这种数据格式的,但是找到一个解决办法(好像暂时是唯一的一个办法),就是建一个xsl的文件,来转换原来xml的格式。
引用内容
convert RDF to RSS with XSL
Funny headline !?
As i have written in a longer article (german) on www.devtrain.de,
i searched for a way to display RDF data (which includes
namespaces rdf:RDF) with xmldatasource. XMLDatasource
can not handle namespaces in xpath.
Following XSL converts it to RSS which solves the problem
程序代码
<xsl:stylesheet version=“1.0”
xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” >
<xsl:template match=”/”>
<xsl:for-each select=”/*/*[name()=‘item’]“>
Share: