cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: Cocoon PDF creation problems
Date Mon, 20 May 2002 16:55:42 GMT
Spectron International, Inc. wrote:
> And yes I'm using disable-output-escaping somewhere. Don't tell me I cant?

Exactly. This is a VFAQ and standard l0ser trap.
XSLT works on a node tree, not on XML strings.  You try to
generate tags by using d-o-e. This works if the tree is
serialized to a string and reparsed. In Cocoon (and other
applications), the constructed result tree is passed to
the next pipeline stage without being serialized.
What you think of "tags" is still text.

> I
> need it because I have the following xml :
> 
> <data>
>   <number>1</number>
>   <number>1</number>
>   <number>1</number>
>   <number>1</number>
>   <number>1</number>
>   <number>1</number>
> </data>
> 
> and I want a table with 3 numbers in each row, there can be from 1 to 300
> numbers.

This problem occurs very often and is known as "grouping by position".
Look into the XSL FAQ:
  http://www.dpawson.co.uk/xsl/

The standard solution is
   ...
   <fo:table-body>
     <fo:table-row>
       <fo:table-cell/>
       <xsl:for-each select="number[position() mod 12=1]">
         <xsl:for-each select=".|following-sibling::number[position() &lt; 12]">
          <fo:table-cell>
           <fo:block font-size="12pt" text-align="end"
              padding-bottom="10pt"><xsl:value-of select="."/></fo:block>
           </fo:table-cell>
         </xsl:for-each>
       <xsl:for-each>
     </fo:table-row>
   </fo:table-body>

Repeat: XSLT operates on nodes, not on strings with tags.
You can't create half a node. You have to understand this
in order to use XSLT efficiently, especially in the Cocoon
environment.

J.Pietschmann


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message