I think I found what I need for this.  The better route is the sax filter pre-processing (as Trevor Nash suggested), with subsequent handling by an xslt transform.  It appears that I may be able to get some help in the pre-processing by using the regular fragmentation stuff at http://simonstl.com/projects/fragment/ , or I may code it myself.
 
I take it from p.573 of XSLT 2nd. ed. (MK) that returning a NodeList from an extension function is best avoided, so I shall heed that admonition.
 
Thanks.
----- Original Message -----
From: David Penton
To: saxon-help@lists.sourceforge.net
Sent: Saturday, October 20, 2001 3:57 AM
Subject: [saxon] Extension functions & NodeLists

I want to use pattern matching methods to add some additional tags to the textual content of elements in some xml files.  The simplest example of what I have to do is to spit out paragraph numbers as separate elements preceding the paragraph:
 
<Paragraph>(a) This is some text.</Paragraph>
 
should end up as
 
<Label>(a)</Label><Paragraph>This is some text</Paragraph>
 
It seems to me that I might accomplish the task by passing text to a saxon extension function that does the pattern matching, splits the text up and returns a NodeList containing the additional markup that could then be processed by other templates.
 
I am a bit unclear on how to go about constucting the NodeList from the contents of the element.  I have read Michael's document on extensibility.  Is there another place to look on how to build the NodeList?
 
On a slightly different note, if anyone thinks there is a better way to do this, please let me know.  Maybe it would be simpler to run the xml files through a sax filter and do the pattern matching there.
 
Regards,
 
 
- David Penton -