Re: xalan extensions - get the result tree

Mukul Gandhi <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <[email protected]>
Hi Jan,
   Perhaps you can do this in two passes. In the first pass, you copy the tree:

<text>
   some words
   some more words
</text>

in some variable. Then in second pass, you can find the count of words
and create the required attribute.

On Thu, Jun 18, 2009 at 5:59 PM, Jan Hoeft<[email protected]> wrote:
> Hi,
> is it possible to get the result tree and work on it?
>
> I am able to do the transformation on my own via executeChildTemplates. But
> I have not found a way to process the result.
>
> <xalan:component prefix="my" elements="countwords">
>   <xalan:script lang="javascript">
>       function countwords(context, elem){
>           transf = context.getTransformer();
>           transf.executeChildTemplates(elem,true);
>           return "";
>       }
>   </xalan:script>
> </xalan:component>
>
> <xsl:template match="/">
>   <my:countwords>
>       <text>
>           some words
>           <xsl:value-of select="."/>
>       </text>
>   </my:countwords>
> </xsl:template>
>
> my xml file:
>
> <root>
>   some more words
> </root>
>
> What i am trying to do is to add an attribute count to the text output.
>
> <text count="5">
>    some words
>    some more words
> </text>
>
> Any idea how to do this?
> Cheers
> Jan


-- 
Regards,
Mukul Gandhi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.