[英]How to use embedded EXSLT from XSLTProcessor?
XSLTProcessor::hasExsltSupport() returns true. XSLTProcessor :: hasExsltSupport()返回true。 Now what do I have to modify so I can use it? 现在我需要修改什么才能使用它?
I have 我有
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="date">
Transformation what I'm trying to do: 转换我想做的事情:
<td>
<xsl:value-of select="date:format-date(translate(property[@name='changedate']/value, ' ', 'T'), 'd.m.y h:i')" />
</td>
Error: 错误:
Warning: XSLTProcessor::transformToXml() [xsltprocessor.transformtoxml]: xmlXPathCompOpEval: function date bound to undefined prefix format 警告:XSLTProcessor :: transformToXml()[xsltprocessor.transformtoxml]:xmlXPathCompOpEval:函数日期绑定到未定义的前缀格式
PHP version 5.2.9 PHP版本5.2.9
I fixed it with this. 我用这个解决了。 It moves date information to correct positions. 它将日期信息移到正确的位置。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="FormatDate">
<xsl:param name="DateTime" />
<xsl:variable name="mo">
<xsl:value-of select="substring($DateTime, 6, 2)" />
</xsl:variable>
<xsl:variable name="day">
<xsl:value-of select="substring($DateTime, 9, 2)" />
</xsl:variable>
<xsl:variable name="year">
<xsl:value-of select="substring($DateTime, 1, 4)" />
</xsl:variable>
<xsl:variable name="time">
<xsl:value-of select="substring($DateTime, 12, 8)" />
</xsl:variable>
<xsl:variable name="hh">
<xsl:value-of select="substring($time, 1, 2)" />
</xsl:variable>
<xsl:variable name="mm">
<xsl:value-of select="substring($time, 4, 2)" />
</xsl:variable>
<xsl:value-of select="$day" />
<xsl:value-of select="'.'" />
<xsl:value-of select="$mo" />
<xsl:value-of select="'.'" />
<xsl:value-of select="$year" />
<xsl:value-of select="' '" />
<xsl:value-of select="$hh" />
<xsl:value-of select="':'" />
<xsl:value-of select="$mm" />
</xsl:template>
</xsl:stylesheet>
"The following extension functions are not considered stable and are not part of the core of EXSLT - Dates and Times. Processors that claim support of EXSLT - Dates and Times might not support these functions." “以下扩展功能不是稳定的,也不属于EXSLT-Dates and Times的核心。声称支持EXSLT-Dates and Times的处理器可能不支持这些功能。” - this applies to format-date
as well. -这也适用于format-date
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.