EXSLT syntax problem
No doubt this will be something obvious, but the following code has 2 errors on the marked line:
<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">
<xsl:import href="date/d开发者_JAVA百科ate.xsl" />
<xsl:template match="//day">
<td>
<date:day-in-month(<xsl:value-of select='@start_date' />)/> <!--problem here-->
</td>
</xsl:template>
</xsl:stylesheet>
The errors are:
- Tag missing closing bracket '>'
- Missing end tag "date:day-in-month"
So far as I can see neither of those is the case. Any thoughts, or am I just blind?
For starters, XSLT must always be valid XML. Yours clearly isn't, since you nest one tag inside another. This is your first clue that you do something wrong.
Second, date:day-in-month
is an XPath function, not an element, and therefore must be used in an XPath expression. The latter can, for example, be a value of xsl:value-of/@select
attribute:
<xsl:value-of select='date:day-in-month(@start_date)' />
精彩评论