David,

Here is a quick adaption of some code I use that bundles a list of strings into
a NodeSet of text nodes.  It makes for quick XSL processing since they are
just a list of text nodes, there is minimal XPath processing.

HTH
John G

<xsl:template match="foo">
  <xsl:variable name="myStrings" select="myNS:getStrings()"/>
  If there are no strings, NULL is an easy test.
  <xsl:if test="$myStrings">
     <xsl:for-each select="$myStrings">
         The current context is the current string in the list
      </xsl:for-each>
  </xsl:if>
</xsl:template>

public NodeSet getStrings()
{
try
{
  NodeSet resultSet = new NodSet();

  Document lDoc = null;
  Iterator i = stringList():
  // You need to create a new document here so you can generate nodes.
  // At least this is the easiest way I have found...
   if (i.hasNext()) lDoc = getDocBuilder().newDocument();
   while(i.hasNext())
  {
       String name = (String) i.next();
       resultSet.addNode(lDoc.createTextNode(name));
  }
return resultSet;
}
catch(Exception e)
{
  return null;
 }

Karr, David wrote:

I may be jumping the gun on this, but I'm trying to figure out how I can
write a Java extension function that returns a list of objects (list of
strings, being regexp group values), and how to process that list in a
stylesheet.  I don't see exactly how to do this from the Xalan
documentation.

I'm investigating this because I think I can't use the EXSLT
regexp:match function in WebLogic running JDK 1.4.2 (the EXSLT docs seem
to say this, and it fails when I run it in Stylus Studio).


--
--------------------------------------
John Gentilin
Eye Catching Solutions Inc.
18314 Carlwyn Drive
Castro Valley CA 94546

   Contact Info
[EMAIL PROTECTED]
Ca Office 1-510-881-4821
NJ Office 1-732-422-4917

Reply via email to