cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "roy huang" <lingererhu...@hotmail.com>
Subject [Help]writing SAX Transformer
Date Fri, 27 Feb 2004 09:51:26 GMT
I wrote a transformer extend AbstractSAXTransformer to transform woody form define file base
on action and state.
The transformer do two thing:
1.turn <wd:field> to <wd:output> for read-only
2.delete some define widgets under certain condition.I use this.startRecording(); this.endRecording
to delete the widget .
Question 1:
It looks fine when I use browser to see the xml output.But if I check the source ,I found
if the original xml is like:
<?xml version="1.0" encoding="utf-8"?>
<root>
    <a>
        a
    </a>
    <b>
        b
    </b>
    <c>
        c
    </c>
</root> 
if I delete <a> <b> using startRecording the source code turns into:
<?xml version="1.0" encoding="utf-8"?>
<root>


    <c>
        c
    </c>
</root>
left many blank and tab.How to solve it or I am in the wrong way?
Question 2:
in the transformer I also and some xinclude tag,like:
   attr.addAttribute(
    "http://www.w3.org/2001/XInclude",
    "href",
    "href",
    "CDATA",
    flowUri);
   super.startTransformingElement("", "include", "xi:include", attr);
   super.endTransformingElement("", "include", "xi:include");
   attr.clear();
the xml is fine,but can't be transform by XInclude transformer,but if I save the xml and use
an another pipeline to use the xml in the disk,it can be transform by Xinclude.
If I use a xslt file to transform it first ,it can also transform by Xinclude.
So I believe it my transformer's problem,can you help?

Thanks advanced!

Roy Huang
Mime
View raw message