2013-03-06 56 views
0

我有一個簡單的XML文件,並試圖創建一個XSLT文件來將XML處理成HTML。從XSLT使用媒體名稱空間 - 僅支持1.0功能?

的XML

<?xml version="1.0" ?> 
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> 
    <channel> 
<title>PDF</title> 
<ttl>10</ttl> 
<link>https://teele.box.com/shared/3m9en769bdh36d4y2hjy/rss.xml</link> 
<description>PDF file updates</description> 
<lastBuildDate>Tue, 05 Mar 2013 13:59:22 -0800</lastBuildDate> 
<copyright>Copyright 2009 box.net</copyright> 
<webMaster>[email protected] (No reply)</webMaster> 
<item> 
    <title>Kat Martin - Sinclair Sisters Trilogy 02 - Desert Heat.pdf</title> 
    <description></description> 
    <pubDate>Sun, 03 Feb 2013 17:19:36 -0800</pubDate> 
    <link>https://teele.box.com/index.php?rm=box_download_shared_file&amp;shared_name=3m9en769bdh36d4y2hjy&amp;file_id=f_5920615203&amp;rss=1</link> 
    <media:content url="https://teele.box.com/index.php?rm=box_download_shared_file&amp;shared_name=3m9en769bdh36d4y2hjy&amp;file_id=f_5920615203&amp;rss=1" /> 
    <media:text></media:text> 
    <media:title>Kat Martin - Sinclair Sisters Trilogy 02 - Desert Heat.pdf</media:title> 
    <media:thumbnail url="https://ak3.boxcdn.net/resources/rcxnqksqis/thumbs/43x51/application/pdf.gif" height="48" width="48"/> 
</item> 

和我的XSLT

<?xml version='1.0'?> 
<xsl:stylesheet version="2.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:media="http://search.yahoo.com/mrss/"> 

<xsl:output method="html" /> 

<xsl:template name="Content"> 
    <xsl:for-each select="rss/channel/item"> 
    <xsl:value-of select="media:thumbnail/@url"/> 
    </xsl:for-each> 
</xsl:template> 

<xsl:template match="/"> 
    <xsl:call-template name="Content" /> 
</xsl:template> 
</xsl:stylesheet> 

當我處理這個我從http://www.online-toolz.com/tools/xslt-transformation.php以下錯誤,我正在測試的XSLT

埃羅r:XSLTProcessor :: importStylesheet()[xsltprocessor.importstylesheet]:xsl:version:僅支持1.0功能

它與media:標記有關,但我不知道它是什麼意思,並且我定義了命名空間。

回答

1

剛剛成立的版本= 「2.0」 到版本= 「1.0」,它不會引發錯誤。

此外,你可以得到你的XSLT處理器是這​​樣一些信息:

xsl:version=<xsl:value-of select="system-property('xsl:version')" /> 
xsl:vendor=<xsl:value-of select="system-property('xsl:vendor')" /> 
xsl:vendor-url=<xsl:value-of select="system-property('xsl:vendor-url')" /> 
xsl:product-name=<xsl:value-of select="system-property('xsl:product-name')" /> 
xsl:product-version=<xsl:value-of select="system-property('xsl:product-version')" /> 
xsl:is-schema-aware=<xsl:value-of select="system-property('xsl:is-schema-aware')" /> 
xsl:supports-serialization=<xsl:value-of select="system-property('xsl:supports-serialization')" /> 
xsl:supports-backwards-compatibility=<xsl:value-of select="system-property('xsl:supports-backwards-compatibility')" /> 
msxsl:version=<xsl:value-of select="system-property('msxsl:version')" />