Hello,

thanks for your answer David,

How can I return a node set ? for example this node set
"<example>example1<example>", I saw the file FunctionDocument.cpp and I
didn't get what I want from it.

thanks a lot,

2008/8/28 David Bertoni <[EMAIL PROTECTED]>

> anas.eh wrote:
>
>> Hi,
>>
>> My problem is :
>>
>> In a XSL file I make a call to an external function :
>>
>> <xsl:value-of select="external:ListToXML()"/>
>>
>> The function ListToXML() is like thatt :
>>
>> XObjectPtr NGATranslatorXSLFunctionListToXML::execute(
>>        XPathExecutionContext&       io__executionContext,
>>        XalanNode*                   io__context,
>>        const XObjectArgVectorType&  i__args,
>>        const LocatorType*           i__locator) const
>> {
>>    string l__xml;
>>        l__xml = "<exemple>exemple1</exemple><exemple>exemple2</exemple>";
>>        return io__executionContext.getXObjectFactory().createString(
>>                                                    XalanDOMString(
>>                                                            l__xml.c_str())
>>                                                            );
>> }
>>
>>
>> What I get in output (after transformation) is a XML part like that :
>>
>>
>> &lt;exemple&gt;exemple1&lt;/exemple&gt;&lt;exemple&gt;exemple2&lt;/exemple&gt;
>>
> You asked for a string, which, when copied to the source tree, creates a
> text node.  During serialization, markup characters are escaped so the
> result is well-formed.
>
>
>> How can I get a correct XML part ?
>>
> You want to return either a result tree fragment or a node set.  It's
> simpler to return a node set, although it's not the best choice if your
> stylesheet will be generating lots of these node sets.
>
> Take a look at the implementation of the document() function, which is
> implemented in src/xalanc/XSLT/FunctionDocument.cpp for more details.
>
> Also, please remember that functions in XPath anbd XSLT must be free of
> side-effects.  That means that no matter how many times your function is
> called, if it's called with the same arguments, it must produce the same
> result.
>
> Dave
>



-- 
Anas EL HAJJAJI
Ingénieur Étude et Développement
Sagem Sécurité Maroc
[ENSIAS'08]

Reply via email to