Calling java.util.Arrays.asList() won't work

Help
2004-11-26
2012-10-08
  • James Francis Cerra

    As a test, I tried directly using java.util.Arrays.asList() from saxon:

    <xsl:for-each
    select='Arrays:asList("Larry", "Moe", "Curly")'
    xmlns:Arrays="java:java.util.Arrays"
    >
    <xsl:value-of select="." />
    </xsl:for-each>

    However, that doesn't work; I get a error message:

    Cannot find a matching 3-argument function named {java:java.util.Arrays}asList()
    Transformation failed: Run-time errors were reported

    According to Sun's Javadocs, this should work. Does anyone konw why it doesn't work? (And yes, this is a trivial problem to workaround - it was only a test).

     
    • Michael Kay

      Michael Kay - 2004-11-26

      The asList() expects a single argument, but you have called it with three arguments. Try passing a single sequence-valued argument:

      Arrays:asList(("Larry", "Moe", "Curly"))

      (not tested)

      Michael Kay

       
      • James Francis Cerra

        That worked. (Odd, since the example was based on the JavaDocs.) Thanks.

         

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks