Re: [xslt] Locating 'Invalid type' errors



Daniel, thanks for the explanation.

Daniel Veillard wrote:

Send me a sample example reproducing the problem with xsltproc

This is as concise as I can manage:

<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:func="http://exslt.org/functions";
    xmlns:exsl="http://exslt.org/common";
    xmlns:myfunctions="myfunctions"
    extension-element-prefixes="func exsl myfunctions">

<xsl:template match="/">
  <xsl:copy-of select="exsl:node-set(myfunctions:foo())/foo/baa"/>
  <!-- <xsl:copy-of select="myfunctions:foo()/foo/baa"/> -->
</xsl:template>

<func:function name="myfunctions:foo">
  <xsl:variable name="rtf">
    <foo><baa species="sheep" color="#000000" wool="no"/></foo>
  </xsl:variable>
  <func:result select="$rtf"/>
</func:function>

</xsl:stylesheet>

You can call it against any XML including itself, eg

$ xsltproc invalid_demo.xsl invalid_demo.xsl
<?xml version="1.0"?>
<baa species="sheep" color="#000000" wool="no"/>

If you swap the commenting in the main template, you get

$ xsltproc invalid_demo.xsl invalid_demo.xsl
XPath error : Invalid type

Regards,

Mark Howe



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]