Hi! 

I have the same problem  with text-transform1.xml and
text-transform2.xml.
The SAXParser splits the text into two parts and the FOText converts the
second part's first character to uppercase.
It is possible because the SAX specification allows it.
"Note too that there is no promise that the output will be sent as a
single call. As is always true in SAX, one logical string may be split
 across multiple blocks of memory and hence delivered as several
successive events."

the generated xml fragment for text-transform1.xml
<block bap="0 0 0 0" bpd="14400" bpda="14400" ipd="360000"
ipda="360000">
        <lineArea bap="0 0 0 0" bpd="14400" bpda="14400" ipd="0">
                <text color="#000000" font-family="F1" font-size="12000"
vpos="10266">capitalize: </text>
                <text color="#000000" font-family="F1" font-size="12000"
vpos="10266">This T</text>
                <text color="#000000" font-family="F1" font-size="12000"
vpos="10266">Ext Is Capitalized.</text>
        </lineArea>
</block>

I managed to solve this problem by concatenating these parts and convert
them when addChildNode or endOfNode call occur.
The tests now passed, the generated xml:
<block bap="0 0 0 0" bpd="14400" bpda="14400" ipd="360000"
ipda="360000">
        <lineArea bap="0 0 0 0" bpd="14400" bpda="14400" ipd="0">
                <text color="#000000" font-family="F1" font-size="12000"
vpos="10266">capitalize: </text>
                <text color="#000000" font-family="F1" font-size="12000"
vpos="10266">This Text Is Capitalized.</text>
        </lineArea>
</block>


diff:
Index: src/java/org/apache/fop/fo/FOText.java
===================================================================
RCS file:
/home/cvspublic/xml-fop/src/java/org/apache/fop/fo/FOText.java,v
retrieving revision 1.39
diff -r1.39 FOText.java
31a32
> import org.xml.sax.Locator;
98c99
<     public FOText(char[] chars, int start, int end, FONode parent) {
---
>     public FOText(FONode parent) {
100,103c101,118
<         endIndex = end - start;
<         this.ca = new char[endIndex];
<         System.arraycopy(chars, start, ca, 0, endIndex);
< //      System.out.println("->" + new String(ca) + "<-");
---
>     }
>
>     protected void addCharacters(char[] data, int start, int end,
>             PropertyList list, Locator locator) throws FOPException {
>
>         int length=end - start;
>         int calength=0;
>         char[] nca = null;
>         if (ca!=null) {
>             calength=ca.length;
>             nca = new char[calength+length];
>             System.arraycopy(ca,0, nca, 0, calength);
>         } else {
>             nca = new char[length];
>         }
>         System.arraycopy(data, start, nca, calength, length);
>         endIndex = nca.length;
>         this.ca = nca;
123c138
<     protected void startOfNode() {
---
>     protected void endOfNode() throws FOPException {
Index: src/java/org/apache/fop/fo/FObjMixed.java
===================================================================
RCS file:
/home/cvspublic/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v
retrieving revision 1.47
diff -r1.47 FObjMixed.java
30a31,34
>
>
>     protected FOText ft = null;
>
51,54c55,60
<         FOText ft = new FOText(data, start, end, this);
<         ft.setLocator(locator);
<         ft.bind(pList);
<         ft.startOfNode();
---
>         if (ft==null) {
>             ft = new FOText(this);
>               ft.setLocator(locator);
>               ft.bind(pList);
>         }
>         ft.addCharacters(data, start, end, null,null);
56,57c62,84
<         getFOEventHandler().characters(ft.ca, ft.startIndex,
ft.endIndex);
<         addChildNode(ft);
---
>     }
>
>     protected void endOfNode() throws FOPException {
>         flushText();
>         super.endOfNode();
>     }
>
>     /**
>      * @throws FOPException
>      */
>     protected void flushText() throws FOPException {
>         if (ft!=null) {
>               FOText lft = ft;
>               ft=null;
>             lft.endOfNode();
>               getFOEventHandler().characters(lft.ca, lft.startIndex,
lft.endIndex);
>               addChildNode(lft);
>         }
>     }
>
>     protected void addChildNode(FONode child) throws FOPException {
>         flushText();
>         super.addChildNode(child);
Index: src/java/org/apache/fop/fo/flow/Block.java
===================================================================
RCS file:
/home/cvspublic/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v
retrieving revision 1.54
diff -r1.54 Block.java
176a177
>         super.endOfNode();
332a334
>         flushText();
Index: src/java/org/apache/fop/fo/flow/Inline.java
===================================================================
RCS file:
/home/cvspublic/xml-fop/src/java/org/apache/fop/fo/flow/Inline.java,v
retrieving revision 1.39
diff -r1.39 Inline.java
119a120
>         super.endOfNode();
Index: src/java/org/apache/fop/fo/flow/Marker.java
===================================================================
RCS file:
/home/cvspublic/xml-fop/src/java/org/apache/fop/fo/flow/Marker.java,v
retrieving revision 1.25
diff -r1.25 Marker.java
99c99,100
<     protected void endOfNode() {
---
>     protected void endOfNode() throws FOPException {
>         flushText();


Szabolcs


-----Original Message-----
From: Matthias Wessendorf [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 06, 2005 3:52 PM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: [Tests] automated Tests for FOP's XSL-Standard compilance

I loaded FOP stuff via CVS this morning.



> -----Original Message-----
> From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 06, 2005 3:21 PM
> To: fop-dev@xmlgraphics.apache.org
> Subject: Re: [Tests] automated Tests for FOP's XSL-Standard compilance
> 
> 
> Are you really sure you got the latest sources? I've just updated 
> everything and don't see the problem. At first, I thought it would be 
> a problem with the Xalan version because the XPath statements might 
> not have been resolved correctly, but obviously text-transform doesn't

> even have an effect on your side. Strange.
> 
> On 06.06.2005 15:12:57 Matthias Wessendorf wrote:
> > :)
> > 
> > here are all messages, I got (only on junit target (which
> are the interesting one))
> > 
> > HTH,
> > Matthias
> > 
> 
> <snip/>
> 
> >     [junit] Testcase: 
> text-transform1.xml(org.apache.fop.layoutengine.LayoutEngineTe
> stSuite$1):   Caused an ERROR
> >     [junit] Expected XPath expression to evaluate to
> 'capitalize: This Text Is Capitalized.', but got 'capitalize: 
> This TExt Is Capitalized.' (XPath: //flow/block[2])
> >     [junit] java.lang.RuntimeException: Expected XPath
> expression to evaluate to 'capitalize: This Text Is Capitalized.', but

> got 'capitalize: This TExt Is Capitalized.' (XPath: //flow/block[2])
> >     [junit] at
> org.apache.fop.layoutengine.EvalCheck.check(EvalCheck.java:64)
> >     [junit] at
> org.apache.fop.layoutengine.LayoutEngineTester.checkAll(Layout
> EngineTester.java:195)
> >     [junit] at
> org.apache.fop.layoutengine.LayoutEngineTester.runTest(LayoutE
> ngineTester.java:145)
> >     [junit] at
> org.apache.fop.layoutengine.LayoutEngineTestSuite$LayoutEngine
> TestCase.testMain(LayoutEngineTestSuite.java:132)
> >     [junit] at
> org.apache.fop.layoutengine.LayoutEngineTestSuite$1.runTest(La
> youtEngineTestSuite.java:111)
> > BUILD FAILED: 
> C:\Programme\eclipse-SDK-3.0.2\eclipse\workspace\apache
> fop\build.xml:754: Test
> org.apache.fop.layoutengine.LayoutEngineTestSuite failed
> 
> <snip/>
> 
> 
> Jeremias Maerki
> 
> 

Reply via email to