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 Kathryn Watson <ka...@transcanada.com> on 2000/05/01 19:52:59 UTC
Re: Newbie User Q ...
Yes, that does help. I'll rework my xml to fit how things work .. which seems kind
of strange but easily done. Of course, that solution does help remove the
newlines, but what about the cases where I do want the newlines? Since the match
is made at the parent, I can't go find the child again in a different match, or can
I??
Thanks again, Kathryn.
Arved_37@chebucto.ns.ca wrote:
> It's true that FOP does not yet implement inline-container (off the top of my
> head), but the workaround is in how you use XSL.
>
> It strikes me (I'm guessing) that you have XML info stored like this:
>
> <person>
> <salutation>Mr.</salutation>
> <name>John Doe</name>
> </person>
>
> or something similar. Well, when you do <xsl:apply-templates/> inside a match
> on "person", even though you are only supplying templates for "salutation" and
> "name", the XSL default templates (and there are several mentioned in the XSL
> spec) take over, so you are actually capturing the whitespace inside
> the "person" element. This often includes newlines, and is a frequent source of
> consternation to peoople starting out with XSL.
>
> Try explicit matches, using <xsl:apply-templates select="..."/>, to pull out
> exactly the 2 elements you want inside the template representing the "person"
> (assuming you have things set up like this), or try the <xsl:strip-space/>
> element in your stylesheet.
>
> Arved
>
> Quoting Kathryn Watson <ka...@transcanada.com>:
>
> > Hello,
> >
> > I'm patiently trying to understand blacks, and inlines and all the
> > properties that go with them ..but I'm failing. Following are two block
> > statements, that correctly pull the information out of the xml document
> > and looks something like the following:
> >
> > ATTENTION: Mr.
> > John Doe.
> >
> > What do I use to get it to look like this:
> >
> > ATTENTION: Mr. John Doe.
> >
> > I know I have to sit down and read the working draft from beginning to
> > end to understand all this .. but can anyone give me a clue to start me
> > off in the right direction??
> >
> > Thanks, Kathryn.
> >
> > fo:block statements:
> >
> > <xsl:template match="cust_info/contact/saluation">
> > <fo:block font-size="12pt" text-align-last="left"
> > space-before.optimum="24pt">ATTENTION:
> > <xsl:apply-templates/></fo:block>
> > </xsl:template>
> >
> > <xsl:template match="cust_info/contact/name">
> > <fo:block font-size="12pt">
> > <xsl:apply-templates/></fo:block>
> > </xsl:template>
> >
> > *************************** complete stylesheet
> > ********************************
> > <xsl:stylesheet
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:fo="http://www.w3.org/1999/XSL/Format">
> >
> > <xsl:template match="clnewpea">
> > <xsl:processing-instruction
> > name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
> > <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
> > <fo:layout-master-set>
> > <fo:simple-page-master
> > page-master-name="right"
> > margin-top="75pt"
> > margin-bottom="25pt"
> > margin-left="100pt"
> > margin-right="50pt">
> > <fo:region-body margin-bottom="50pt"/>
> > <fo:region-after extent="25pt"/>
> > </fo:simple-page-master>
> > <fo:simple-page-master
> > page-master-name="left"
> > margin-top="75pt"
> > margin-bottom="25pt"
> > margin-left="50pt"
> > margin-right="100pt">
> > <fo:region-body margin-bottom="50pt"/>
> > <fo:region-after extent="25pt"/>
> > </fo:simple-page-master>
> > </fo:layout-master-set>
> >
> > <fo:page-sequence initial-page-number="auto-even">
> >
> > <fo:sequence-specification>
> > <fo:sequence-specifier-alternating
> > page-master-first="right"
> > page-master-odd="right"
> > page-master-even="left"/>
> > </fo:sequence-specification>
> >
> > <fo:static-content flow-name="xsl-after">
> > <fo:block text-align-last="centered"
> > font-size="10pt"><fo:page-number/></fo:block>
> > </fo:static-content>
> >
> > <fo:flow>
> > <xsl:apply-templates/>
> > </fo:flow>
> > </fo:page-sequence>
> >
> > </fo:root>
> > </xsl:template>
> >
> > <xsl:template match="cust_info/contact/saluation">
> > <fo:block font-size="12pt" text-align-last="left"
> > space-before.optimum="24pt">ATTENTION:
> > <xsl:apply-templates/></fo:block>
> > </xsl:template>
> >
> > <xsl:template match="cust_info/contact/name">
> > <fo:block font-size="12pt">
> > <xsl:apply-templates/></fo:block>
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> >
>
> ---------------------------------------------------------------
> This mail was sent through the Nova Scotia Provincial Server,
> with technical resources provided by Chebucto Community Net.
> http://nsaccess.ns.ca/mail/ http://www.chebucto.ns.ca/