You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Peter B. West" <pb...@powerup.com.au> on 2001/12/06 15:25:03 UTC

Numeric properties

I found it very difficult to develop a coherent way of representing 
numeric property values when I was looking at the property values 
expression evaluator.  My initial approach had a structure that looked 
something like:

                     PropertyValue
                           |
                           v
                        Numeric
                       /   |   \
                      /    v    \
                Number   Length  Percentage

with inheritance flowing down.  The problem was that Numeric types are 
changeable.  Any numeric with a unit power of zero is a number; any 
numeric with a unit power of one is a measure of some kind, and other 
unit powers represent intermediate calulation results in the expression 
evaluator.

A PropertyValue can start life as a Length, become a number (unit power 
0) through a multop, and then theoretically mutate into a completely 
different form of measurement, e.g. an Angle.  The table I used for this is:

 * Operations defined on combinations of the types (where a percentage
 * is treated in the same manner as a number) are:
 * number      anyop  number      = number
 * baseunit    anyop  baseunit2   = Illegal
 * number      multop baseunit    = baseunit
 * number      addop  baseunit    = Illegal
 * baseunit    multop baseunit    = baseunit (with changed power)
 * baseunit^n  addop  baseunit^n  = baseunit^n
 * baseunit^n  addop  baseunit^m  = Illegal
 *

I don't know how kosher this is, and would appreciate any comments.  I 
am also puzzled by the constraint in the spec (5.9.6 Absolute Numerics) 
that:

In addition, only the mod, addition, and subtraction operators require 
that the numerics on either side of the operation be absolute numerics 
of the same unit power. For other operations, the unit powers may be 
different and the result should be mathematically consistent as with the 
handling of powers in algebra.

As I read this, it means that, while I can divide a <length> by a 
number, resulting in a <length> of the same unit power, I cannot take 
the mod of a <length> using a number.  Can anyone explaing the reasons 
for this restriction?

The approach taken in the current expression evaluator is that all 
arithmetic operations involving property values require that the operand 
be another property value, and the operation generates a new property 
value object.  This may well be the cleanest way, but I am experimenting 
with expressing the result of the operation directly in the 
PropertyValue object on which the arithmetic operation is invoked.

In order for this to work, I had to eliminate the subclasses of Numeric. 
 These (Length, Percentage, IntegerType, Angle, Time, Frequency and 
possibly Number) remain as "static" classes which provide the class 
methods makeLength, makePercentage, etc, all of which return Numerics. 
 The type of a Numeric is distinguished by the baseunit, which may 
change as a result of arithmetic operations.
I am currently working my way through the Numeric and other subclasses 
of PropertyValue, and setting up any necessary PropertyValue objects to 
express the initial values of the properties in Properties.java, the 
monster properties file.

The propertyStacks in PropertyConsts.java will contain PropertyTriplet 
objects, which potentially contain specified, computed and actual 
property values.  Specified is a String; the othes are PropertyValue 
objects.  I will upload the latest versions to my web page later 
tonight, for anyone who is interested.

Peter



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


RE: break-after vs break-before

Posted by Jim Urban <ji...@netsteps.net>.
Here is the solution to your blank page problem:

	<xsl:for-each select="....">
		<fo:block white-space-collapse="false">
			<xsl:call-template ...>
			</xsl:call-template>
		</fo:block>
		<xsl:if test="position() >= 1 and  position() != last()">
			<fo:block break-before="page" />
		</xsl:if>
	</xsl:for-each>


-----Original Message-----
From: John M. Corro [mailto:john.corro@cornerstone.net]
Sent: Thursday, December 06, 2001 11:22 AM
To: fop-dev@xml.apache.org
Subject: break-after vs break-before


I'm trying to put together a report that has automatic page breaking (for
ref. the XSL is at the bottom of the email).  My problem is that the report
starts w/ a blank page when I use 'break-before', but if I try 'start-after'
a blank page is at the end of the report.  The blank page at the end isn't
so bad, but if there's a way to remove it that'd be nice.

Also, does the 'break-XXX' attribute simply add page breaks whenever you
reach the end of a page or is it smarter than that?  For example, say a
table is 3 pages in size.  Can you use the 'break-XXX' attribute to make it
such that table headers are printed at the top of all 3 pages?  My
understanding is that the table will simply print across the 3 pages w/ no
regards for adding table headers at the top of each page.
<fo:block break-after="page">

    <fo:table...

        <!-- call to template that produces table headers -->

        <fo:for-each...>

            <!-- call to template that produces table's contents -->

        </fo:for-each>

   </fo:table>

</fo:block>





---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


break-after vs break-before

Posted by "John M. Corro" <jo...@cornerstone.net>.
I'm trying to put together a report that has automatic page breaking (for
ref. the XSL is at the bottom of the email).  My problem is that the report
starts w/ a blank page when I use 'break-before', but if I try 'start-after'
a blank page is at the end of the report.  The blank page at the end isn't
so bad, but if there's a way to remove it that'd be nice.

Also, does the 'break-XXX' attribute simply add page breaks whenever you
reach the end of a page or is it smarter than that?  For example, say a
table is 3 pages in size.  Can you use the 'break-XXX' attribute to make it
such that table headers are printed at the top of all 3 pages?  My
understanding is that the table will simply print across the 3 pages w/ no
regards for adding table headers at the top of each page.
<fo:block break-after="page">

    <fo:table...

        <!-- call to template that produces table headers -->

        <fo:for-each...>

            <!-- call to template that produces table's contents -->

        </fo:for-each>

   </fo:table>

</fo:block>





---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Numeric properties

Posted by "Peter B. West" <pb...@powerup.com.au>.
Joerg,

I must remember to trim.
I must remember to trim.
I must...

Peter
Peter B. West wrote:

> Christopher,
>
> Many thanks.  It's glaringly obvious, isn't it?  Oh well.




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Numeric properties

Posted by "Peter B. West" <pb...@powerup.com.au>.
Christopher,

Many thanks.  It's glaringly obvious, isn't it?  Oh well.

Peter


Christopher R. Maden wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>At 06:25 6-12-2001, Peter B. West wrote:
>
>>I don't know how kosher this is, and would appreciate any comments.  I am 
>>also puzzled by the constraint in the spec (5.9.6 Absolute Numerics) that:
>>
>>In addition, only the mod, addition, and subtraction operators require 
>>that the numerics on either side of the operation be absolute numerics of 
>>the same unit power. For other operations, the unit powers may be 
>>different and the result should be mathematically consistent as with the 
>>handling of powers in algebra.
>>
>>As I read this, it means that, while I can divide a <length> by a number, 
>>resulting in a <length> of the same unit power, I cannot take the mod of a 
>><length> using a number.  Can anyone explaing the reasons for this restriction?
>>
>
>Modulo only makes sense when the quotient is an integer.  When you divide 
>four inches by three, there isn't anything left over; you have three parts 
>of 4/3 inches each.  But if you take three-inch pieces of four inches, you 
>have one inch left over.
>
>~Chris
>- -- 
>Christopher R. Maden, Principal Consultant, HMM Consulting Int'l, Inc.
>DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
><URL: http://www.hmmci.com/ > <URL: http://crism.maden.org/consulting/ >
>PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA
>-----BEGIN PGP SIGNATURE-----
>Version: PGP Personal Privacy 6.5.8
>
>iQA/AwUBPA/ffKxS+CWv7FjaEQIycACgvX6WIK89d3IwFXPHttoY88RKEFgAn0sE
>ZBNJfMtghi3TrqwYfQpWSw8r
>=Dk6f
>-----END PGP SIGNATURE-----
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
>For additional commands, email: fop-dev-help@xml.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Numeric properties

Posted by "Christopher R. Maden" <cr...@maden.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 06:25 6-12-2001, Peter B. West wrote:
>I don't know how kosher this is, and would appreciate any comments.  I am 
>also puzzled by the constraint in the spec (5.9.6 Absolute Numerics) that:
>
>In addition, only the mod, addition, and subtraction operators require 
>that the numerics on either side of the operation be absolute numerics of 
>the same unit power. For other operations, the unit powers may be 
>different and the result should be mathematically consistent as with the 
>handling of powers in algebra.
>
>As I read this, it means that, while I can divide a <length> by a number, 
>resulting in a <length> of the same unit power, I cannot take the mod of a 
><length> using a number.  Can anyone explaing the reasons for this restriction?

Modulo only makes sense when the quotient is an integer.  When you divide 
four inches by three, there isn't anything left over; you have three parts 
of 4/3 inches each.  But if you take three-inch pieces of four inches, you 
have one inch left over.

~Chris
- -- 
Christopher R. Maden, Principal Consultant, HMM Consulting Int'l, Inc.
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://www.hmmci.com/ > <URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.8

iQA/AwUBPA/ffKxS+CWv7FjaEQIycACgvX6WIK89d3IwFXPHttoY88RKEFgAn0sE
ZBNJfMtghi3TrqwYfQpWSw8r
=Dk6f
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org