Hi Corinna,
This is a bit tricky in Xalan-C++ as we don't really have a public
interface for creating fragments. One thing you can do is to look at the
code to see how we create things internally, then copy that code into your
function. Other ways include generating the element and attributes using
xsl:element and xsl:attribute, or creating a result tree fragment and use
the nodeset extension function to convert it into a nodeset. Those are
easier than writing an extension function, provided you have a way to get
the data from the Width and Height attributes.
Extension functions can be dangerous if they have any side-effects. They
also require that you install the function into the run-time. A result
tree fragment requires no extra support, aside from the already-supplied
nodeset extension function. Also, when moving to XSLT 2.0, there will no
longer be any need for the nodeset function, so your stylesheet can be
quickly modified to be portable, rather than proprietary
If you can describe more about the source for the data you'll be using to
create the element and attributes, perhaps someone can illustrate how you
can accomplish what you want to do without resorting to an extension
function.
Dave
|---------+--------------------------->
| | [EMAIL PROTECTED]|
| | m (Corinna |
| | Kinchin) |
| | |
| | 04/11/2002 10:35|
| | AM |
| | Please respond |
| | to xalan-dev |
| | |
|---------+--------------------------->
>---------------------------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED]
|
| cc: (bcc: David N Bertoni/Cambridge/IBM)
|
| Subject: Help! Extension functions ...
|
>---------------------------------------------------------------------------------------------------------------------------|
Hi all,
I'm trying to write an extension function which
creates a new `Dim' element with `Width' and `Height'
attributes set to numeric values, and which returns the
`Dim' element as a node-set. More generally, I want
to return a set of values from an extension function,
rather than just a string or number (which is beautifully
illustrated in the ExternalFunction example).
Being new to this area, I can't for the life of me
figure out how to do this yet ... I can create
a node set but how to add an element (node?) to it??
(haven't quite got a grip on the terminology yet).
If anyone has any pointers (eg code snippets which might
give me some ideas, they don't have to be complete or perfect),
I'd really appreciate your feedback.
Thanks!
Yours flummoxedley,
Corinna ...
Corinna Kinchin email: [EMAIL PROTECTED]
Datazone Ltd. Tel: +44-(0)20-7221 8026
133 Notting Hill Gate Fax: +44-(0)20-7727 6045
London W11 3LB, England. URL: http://www.miramo.com
Datazone - makers of `Miramo', the automated publishing tool