Hi,

I have get some trouble with the actual implementation of DVSL.
It appears when you used mixed xml elements (elements and text) as son
of a same element.
Like in this exemple of xml file :
<foo>a<bar value="1"/>b<bar value="2"/>c</foo>
when you apply a dvsl template to a such xml file your element are
process in a wrong order.
it process the two bar elements first and only after it process the text
elements (a,b,c).

So this missordering pb comes from the implementation of the
applyTemplates function in the Transformer class.

I have make some change to the DVSL code to process elements in the
rigth order ( IMHO :-) )

If they seems ok for you, i will be great if you may insert them in the
cvs version of DVSL.

If the change don't seems ok, please explain me how to change thinks.


Here is the modification apply to DVSL Code :

--------------------------


Adds this methode to Dom4jNodeImpl :

        /**
         * return a list of all child nodes
         */
        public List childNodes(){
                List list = new ArrayList();
                for( Iterator i = ((Branch)element).nodeIterator();
i.hasNext();)
                {
                                Node n = (Node) i.next();
                                if ( n != null )
                                {
                                                list.add( makeDVSLNode(
n ) );
                                }
                }
                return list;
        }

Adds this methode to DVSLNode :

        /**
         * return a list of all child nodes
         */
        public List childNodes();



Change this methode in Transformer


   public String applyTemplates()
        throws Exception
    {
        //return applyTemplates(currentContext.peekNode(),
        //
"*|@*|text()|comment()|processing-instruction()");

        List nodeset = currentContext.peekNode().childNodes();
        StringWriter sw =  new StringWriter();
        for (int i = 0; i < nodeset.size(); i++)
        {
            DVSLNode n = (DVSLNode) nodeset.get(i);
            invoke(n, sw);
        }
        return sw.toString();
    }

--------------------

Thanks in advance

Nicolas PERIDONT


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to