XQuery error when doing a xslt transform
I have a working style-sheet that works fine with saxon.Now I am using simple XQuery:
transform:transform($xmlNode, $xslNode, ()),
to do the same thing, it always complains about a syntax in my style sheet, which is:
<xsl:template match="CrossRefer开发者_如何转开发ence ">
<xsl:variable name="currentNode" select="//*[@Target=@pointer]"/>
<xsl:if test="$currentNode/name()!= 'Figure'">
...
</xsl:if>
</xsl:template>
It always complains about the line, and the message is "An exception occurred while compiling the stylesheet: Unknown nodetype: name". Seems that it cannot understand the function name()?
Could anyone help? Thanks.
You cannot use a function call as part of a path (i.e. after a slash /
) in XPath 1.x. To work around this the built-in XPath functions typically accept a node-set as their argument and default to .
if the argument is omitted. That is, name()
is shorthand for name(.)
.
Try this instead:
<xsl:if test="name($currentNode) != 'Figure'">
精彩评论