You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Gary L Peskin <ga...@firstech.com> on 2001/04/25 02:08:33 UTC
Re: Iterating through data structures returned by extensionfunctions
Vanessa --
Have a look at the tokenize (string, delimiters) extension function:
http://xml.apache.org/xalan-j/extensionslib.html#tokenize
If you pass your string to it, it will return a node-set containing one
text node for each token in the string. You can specify the comma as
your delimiter and normalize-space your returned nodes and it should do
what you want.
Something like this:
<xsl:template match="Debug1 | Debug2">
<xsl:apply-templates select="xalan:tokenize(string(.), ',')"
mode="doNames/>
</xsl:template>
<xsl:template match="text()" mode="doNames">
<name><xsl:value-of select=normalize-space()"/></name>
<xsl:template>
Gary
Vanessa D Johnson wrote:
>
> I am not sure if this is the correct mailing list. I have a Java extension
> function that takes a string and returns a Vector. I am not sure how to
> iterate through the result with XSL.
>
> The result comes back from the function in the following format -
>
> <Debug1>[This, the, string]</Debug1><Debug2>[this, is, the, string]</Debug2>
>
> Is there any XSL function that can easily iterate through these types of
> lists so I can output something of the following sort:
>
> <name>This</name>
> <name>the</name>
> <name>string</name> ....
>
> Thanks
>
> Vanessa
>
> Vanessa D. Johnson
> Advanced Mission Software Technology Group
> Mission Execution and Automation - Section 368
> Jet Propulsion Laboratory
> voice: (818) 354-3885