Re: [xslt] question on extension elements



le jeu 28-02-2002 à 17:12, Vakoc, Mark a écrit :
> I want to write an extension function that can handle something like this:
> 
> <xsl:template match="mynode">
> <xsl:variable name="results">
> <gss:process-node-set>
>  <SQLTABLE name="F0101">
>   <SELECTION><ADDRESS_BOOK value="{@abnumber}"/></SELECTION
>   <SEQUENCING><xsl:copy-of select="SEQUENCING"/></SEQUENCING>
>  </SQLTABLE>
> </gss:process-node-set>
> </xsl:variable>
> 
> (SQLTABLE defines a SQL query, and the results are added as children to the
> SQLTABLE node)
> 
> I know how to get to the children nodes of gss:process-node-set, but before
> I can use them, they have have to have their attributes evaluated and
> translated to actual values.  So, within an extension element, how do I
> evaluate the children nodes so the attributes that use {} are subsitutued
> and any <xsl:/> functions are evaluated?

Look at libexslt/functions.c, function exsltFuncFunctionFunction.
The trick is to change the tctxt->insert node then call
xsltApplyOneTemplate, and then restore the initial insert node.
The result of the subtree evaluation will be added as children of your
own insert node, so you'll be able to operate on it later, without
disturbing the normal behaviour of the transformation.

Tom.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]