我真的不知道XSL但是我需要修复这个代码,我已经减少了它以使它更简单.
我收到了这个错误
无效的XSLT/XPath函数
在这条线上
<xsl:variable name="text" select="replace($text,'a','b')"/>
Run Code Online (Sandbox Code Playgroud)
这是XSL
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:inm="http://www.inmagic.com/webpublisher/query" version="1.0">
<xsl:output method="text" encoding="UTF-8" />
<xsl:preserve-space elements="*" />
<xsl:template match="text()" />
<xsl:template match="mos">
<xsl:apply-templates />
<xsl:for-each select="mosObj">
'Notes or subject'
<xsl:call-template
name="rem-html">
<xsl:with-param name="text" select="SBS_ABSTRACT" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="rem-html">
<xsl:param name="text" />
<xsl:variable name="text" select="replace($text, 'a', 'b')" />
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
谁能告诉我它有什么问题?
我需要从MRSS RSS提要中的所有属性执行查询字符串的正则表达式替换,将它们剥离到仅仅是url.我在这里尝试了一些使用建议的东西:未找到XSLT替换功能但无济于事
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<atom:link href="http://www.videojug.com/user/metacafefamilyandeducation/subscriptions.mrss" type="application/rss+xml" rel="self" />
<title>How to and instructional videos from Videojug.com</title>
<description>Award-winning Videojug.com has over 50k professionally-made instructional videos.</description>
<link>http://www.videojug.com</link>
<item>
<title>How To Calculate Median</title>
<media:content url="http://direct.someurl.com/54/543178dd-11a7-4b8d-764c-ff0008cd2e95/how-to-calculate-median__VJ480PENG.mp4?somequerystring" type="video/mp4" bitrate="1200" height="848" duration="169" width="480">
<media:title>How To Calculate Median</media:title>
..
</media:content>
</item>
Run Code Online (Sandbox Code Playgroud)
任何建议真有帮助
我正在从XSLT定义一个JavaScript变量,并且由于未转义的字符串而出现错误.我知道我需要将其替换为',但我不确定如何在XSLT 1.0中执行此操作.
XSLT示例:
var currentComment = '<xsl:value-of select="root/Reviews/Review/Comment" />';
Run Code Online (Sandbox Code Playgroud)
使用未转义的单引号呈现的javascript:
var currentComment = 'Let's test a string.',
// Causing an error ------^
Run Code Online (Sandbox Code Playgroud) 我正在编写一个XSLT模板,需要为xml Sitemap输出有效的xml文件.
<url>
<loc>
<xsl:value-of select="umbraco.library:NiceUrl($node/@id)"/>
</loc>
<lastmod>
<xsl:value-of select="concat($node/@updateDate,'+00:00')"/>
</lastmod>
</url>
Run Code Online (Sandbox Code Playgroud)
不幸的是,输出的Url包含一个撇号 - /what's-new.aspx
我需要逃避'去'谷歌Sitemap.不幸的是,我尝试过的所有尝试都将字符串' ''视为''',这是无效的 - 令人沮丧.XSLT有时会让我发疯.
对技术的任何想法?(假设我可以找到解决XSLT 1.0模板和函数的方法)
我使用VS 2008,.net 3.5使用XSLT生成页面html.
我有消息,包含\ r \n(换行符)
我在XSL文件中使用它:
<b>Message: </b><xsl:value-of select="Message"/><br/>
Run Code Online (Sandbox Code Playgroud)
我需要<br/>在xsl中替换\ r \n .我看过几个引用,但没有得到我的问题的解决方案:
我在调用转换XSLT之前使用此代码C#,但不对:
m = m.Replace(@"\r\n", "
");
m = m.Replace(@"\n", "
");
//m = System.Web.HttpUtility.HtmlDecode(m);
m = m.Replace(@"\r\n", "<br/>");
m = m.Replace(@"\n", "<br/>");
msg = "<Exception>"
+ "<Description>" + d + "</Description>"
+ "<Message>" + m + "</Message>"
+ "<DateTime>" + localTimeString + "</DateTime>"
+ "</Exception>";
Run Code Online (Sandbox Code Playgroud)
我使用这个引用,但不是解决方案
替换功能仅在XSLT 2.0版中可用,而不是在Visual Studio使用的1.0版中.仅仅因为你指定了version ="2.0"并不意味着Visual Studio支持它.
我使用它像最后一个引用,但我得到错误:
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="Message"/>
<xsl:with-param name="replace" select="\r\n"/>
<xsl:with-param name="by" select="<br/>"/>
</xsl:call-template> …Run Code Online (Sandbox Code Playgroud)