Subject: RE: Exclude elements in transformation
From: Sönke Ruempler <ruempler@xxxxxxxxxxxxxxx>
Date: Fri, 17 Sep 2004 09:08:26 +0200
|
M. David Peterson <mailto:m.david@xxxxxxxxxx> wrote on Thursday, September
16, 2004 2:22 PM:
> Im not sure if I completely understand what you are trying to
> do. Ive checked
> your mentioned thread it seems that you are really trying to
> use template
> matching rules to group/ungroup, include/exclude data
> elements which is going to
> be better served by grouping the data together in the correct
> layout/format first and then apply-templates to the resulting
> temporary
> tree. Let me know if
> the following concept is what you are ultimately attempting
> to accomplish...
Thx for your answer. I am really no XML/XSLT geek. I just try to get my
template work :)
I'll try to write the whole story again:
I have a working XSLT Stylesheet for transforming a html-like syntax into
XSL-FO.
The output PDF should have the feature that a Heading never breaks with the
next elements into 2 pages.
XSL-FO has the the property "keep-with-next" for this issue, but I use FOP
as FO-processor and that only supports it within 2 table rows. So i needed a
template, that converts the <hX> tag and the following tag into a <fo:table>
with 2 rows. And the second template, that tells XSLT not to process the
elements preceeded by a <hX> tag twice. And i wrote you my stylesheets, but
the dont work:
>> [XSLT]
>> <xsl:template match="h1|h2|h3|h4|h5">
>> <fo:table table-layout="fixed" width="100%">
>> <fo:table-column
>> column-width="proportional-column-width(1)"/>
>> <fo:table-body>
>> <fo:table-row keep-with-next="always">
>> <fo:table-cell>
>> <fo:block
>> xsl:use-attribute-sets="name()">
>> <xsl:apply-templates/>
>> </fo:block>
>> </fo:table-cell>
>> </fo:table-row>
>> <fo:table-row>
>> <fo:table-cell>
>> <fo:block>
>> <xsl:apply-templates
>> select="following-sibling::*"/>
>> </fo:block>
>> </fo:table-cell>
>> </fo:table-row>
>> </fo:table-body>
>> </fo:table>
>> </xsl:template>
>>
>> <xsl:template match="*[preceding-sibling::(h1|h2|h3|h4|h5)]"/>
>> [/XSLT]
>>
>> But that does not work
>>
>> 1. The second element is there twice.
>> 2. The xsl:use-attribute-sets="name()" does not work here.
>>
>> Any idea?
So it's just a workaround and would not be possible if FOP supported the
"keep" for all elements as the standard says. I am happy with my 'dirty'
solution, because if FOP will support it the future, the workaround gets
kicked.
I would be really happy if you told me how to get this work!!
Thx, soenke.
|