Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2441

Empty NodeVector in scripts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.1
    • None
    • Xalan-extensions
    • None

    Description

      I try to use scripts within xslt style sheets, but I can not transfer node sets as parameters to the functions. Instead of Nodeiterators the retrieved objects are always from type org.apache.xml.utils.NodeVector with a size of 0. I tried JavaScript and Jruby as languages.

      Here a sample style sheet:

      <?xml version="1.0" encoding="UTF-8"?>

      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ext="ext" xmlns:xalan="http://xml.apache.org/xalan" version="1.0">
      <xsl:output method="xml" encoding="UTF-8"/>
      <xalan:component functions="test" prefix="ext">
      <xalan:script lang="javascript"><![CDATA[
      function test(nodes)

      { return ""+nodes+" "+nodes.size(); }

      ]]></xalan:script>
      </xalan:component>
      <xsl:template match="/">
      <name>
      <xsl:value-of select="ext:test(/ResultSet/row)"/>
      </name>
      </xsl:template>
      </xsl:stylesheet>

      XML:

      <?xml version="1.0" encoding="UTF-8"?>
      <ResultSet>
      <row>
      <id>1000000074</id>
      </row>
      <row>
      <id>1090</id>
      </row>
      <row>
      <id>12552</id>
      </row>
      <row>
      <id>245858</id>
      </row>
      </ResultSet>

      The result is:
      <?xml version="1.0" encoding="UTF-8"?><name xmlns:xalan="http://xml.apache.org/xalan" xmlns:ext="ext">org.apache.xml.utils.NodeVector@13a317a 0</name>

      Attachments

        Activity

          People

            Unassigned Unassigned
            okax@gmx.de Olaf
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: