You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/10/17 00:24:25 UTC

DO NOT REPLY [Bug 13710] New: - ProcessorExsltFunction throws incorrect TransformerException

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13710>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13710

ProcessorExsltFunction throws incorrect TransformerException

           Summary: ProcessorExsltFunction throws incorrect
                    TransformerException
           Product: XalanJ2
           Version: 2.4
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xalan.processor
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: avandenhoven@cucbc.com


If you include or import a transform which has a func:function element, it 
incorrectly throws a TransformerException "func:function element must be
top level."

Basically if I take a function block and put it in my main stylesheet, it works 
fine, if I move it directly into an include, it fails as suggested above.

You can reproduce the effect with the following:
source.xml
-------------------
<?xml version="1.0"?>
<doc>
  <section index="section1" index2="atr2val">
    <section index="subSection1.1">
      <p>Hello</p>
      <p>Hello again.</p>
    </section>
  </section>
  <section index="section2">
    <p>Hello2</p>
    <section index="subSection2.1">
      <p>Hello</p>
      <p>Hello again.</p>
    </section>
    <section index="subSection2.2">
      <p>Hello</p>
      <p>Hello again.</p>
    </section>
    <p>Hello2 again.</p>
    <section index="subSection2.3">
      <p>Hello</p>
      <p>Hello again.</p>
    </section>
  </section>
</doc>

test.xsl:
-------------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:func="http://exslt.org/functions" xmlns:my="ext" extension-element-
prefixes="func">
  <xsl:include href="lib.xsl"/>
  <xsl:template match="/">
    <out>
      <xsl:value-of select="my:count-elements()"/>
    </out>
  </xsl:template>
</xsl:stylesheet>

lib.xsl
-------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:func="http://exslt.org/functions" xmlns:my="ext" extension-element-
prefixes="func">
  <func:function name="my:count-elements">
    <xsl:for-each select="(//*)[1]">
      <func:result select="count(//*)"/>
    </xsl:for-each>
  </func:function>
</xsl:stylesheet>