Re: Re: Error when piping XSL-FO to FOP driver using SAXResult

2003-05-14 Thread Om Narayan
Thanks for the response. Yes, its definitely a hack because I could not put
a /fo:table-row inside the xsl:if tag. I get an error message saying
The element type xsl:if must be terminated by the matching end-tag
/xsl:if

Is there a better way to accomplish what I need to do...i.e. ouputting
portions of table-row tags depending on certain conditions? Thanks.

==
You MUSTN'T enclose XML tags to be written to the output in CDATA
sections. In SAX that will result in calls to characters() instead of
startElement/endElement and therefore your closing fo:table-row tags
don't get recognized as tags. What you did here is a hack. Try to
reformulate that snippet.

On 14.05.2003 07:23:17 Om Narayan wrote:
 Here is a snippet of the code from the XSL
 ===

 fo:table-body
xsl:text
 disable-output-escaping=yes![CDATA[fo:table-row]]/xsl:text
   xsl:for-each select=customerPF
  xsl:if test=position()!=1
 xsl:if test=(position()-1) mod 3 = 0
xsl:text
 disable-output-escaping=yes![CDATA[/fo:table-row]]/xsl:text
xsl:text
 disable-output-escaping=yes![CDATA[fo:table-row]]/xsl:text
/xsl:if
   /xsl:if
   fo:table-cellfo:blockxsl:value-of
 select=position()//fo:block/fo:table-cell
  /xsl:for-each
   xsl:text
 disable-output-escaping=yes![CDATA[/fo:table-row]]/xsl:text
 /fo:table-body



Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Re: Error when piping XSL-FO to FOP driver using SAXResult

2003-05-14 Thread Fernando López Carballeda
Look at http://www.dpawson.co.uk/xsl/sect2/N4486.html#d4085e94

From the [EMAIL PROTECTED] [Grouping]

HTH

Fernando López Carballeda

-Original Message-
Sent: miércoles, 14 de mayo de 2003 20:02
Subject: Re: Re: Error when piping XSL-FO to FOP driver using SAXResult


Thanks for the response. Yes, its definitely a hack because I could not put
a /fo:table-row inside the xsl:if tag. I get an error message saying
The element type xsl:if must be terminated by the matching end-tag
/xsl:if

Is there a better way to accomplish what I need to do...i.e. ouputting
portions of table-row tags depending on certain conditions? Thanks.

==
You MUSTN'T enclose XML tags to be written to the output in CDATA
sections. In SAX that will result in calls to characters() instead of
startElement/endElement and therefore your closing fo:table-row tags
don't get recognized as tags. What you did here is a hack. Try to
reformulate that snippet.

On 14.05.2003 07:23:17 Om Narayan wrote:
 Here is a snippet of the code from the XSL
 ===

 fo:table-body
xsl:text
 disable-output-escaping=yes![CDATA[fo:table-row]]/xsl:text
   xsl:for-each select=customerPF
  xsl:if test=position()!=1
 xsl:if test=(position()-1) mod 3 = 0
xsl:text
 disable-output-escaping=yes![CDATA[/fo:table-row]]/xsl:text
xsl:text
 disable-output-escaping=yes![CDATA[fo:table-row]]/xsl:text
/xsl:if
   /xsl:if
   fo:table-cellfo:blockxsl:value-of
 select=position()//fo:block/fo:table-cell
  /xsl:for-each
   xsl:text
 disable-output-escaping=yes![CDATA[/fo:table-row]]/xsl:text
 /fo:table-body



Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Re: Error when piping XSL-FO to FOP driver using SAXResult

2003-05-14 Thread Savino, Matt C
Below is something we use as part of a much more involved stylesheet. Although 
looking at it now it's not the most efficient piece of code as it loops through 
the same nodes several times. (We use it to break output into groups of five 
columns and know we'll never have more than 3 or 4 groups, so we didn't need to 
worry about running through the same nodes a few extra times.) 

I think for efficiency and straighforwardness, the Steve Tinney example from 
the link in the previous post is probably the best way to go. 
(http://www.dpawson.co.uk/xsl/sect2/N4486.html#d4085e94)

-matt


[...]
fo:table-body
   
  xsl:for-each select=customerPF
xsl:if test=(position()-1) mod 3 = 0

xsl:call-template name=new-row
 xsl:with-param name=row-num select=position() - 1 /
/xsl:call-template

/xsl:if
   fo:table-cellfo:blockxsl:value-of 
select=position()//fo:block/fo:table-cell
  /xsl:for-each
 
/fo:table-body
[...]


xsl:template name=new-row
 xsl:param name=row-num/
 
   fo:table-row

xsl:for-each select=../customerPF
 xsl:if test=$row-num lt; position()
  xsl:if test=$row-num+4 gt; position()
fo:table-cellfo:blockxsl:value-of 
select=position()//fo:block/fo:table-cell   
  /xsl:if
 /xsl:if
/xsl:for-each
   
  /fo:table-row
xsl:template



 Thanks for the response. Yes, its definitely a hack because I 
 could not put
 a /fo:table-row inside the xsl:if tag. I get an error 
 message saying
 The element type xsl:if must be terminated by the matching end-tag
 /xsl:if
 
 Is there a better way to accomplish what I need to do...i.e. ouputting
 portions of table-row tags depending on certain conditions? Thanks.
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Re: Error when piping XSL-FO to FOP driver using SAXResult

2003-05-14 Thread Savino, Matt C
Woops, that first fo:table-cell... tag below should have been removed. 
Actually if you use this:

xsl:for-each select=../customerPF[$row-num lt; position() and $row-num+4 
gt; position()]

instead of the xsl:for-each followed by 2 xsl:if-s below, our code might be 
somewhat efficient after all. I just tested and it seems ok on first pass.

Apparently we were still learning our XSLT back then. Now comes the age-old 
question of whether or not to rewrite code that works fine just because we know 
it can be done better. I think that question usually comes down on the 
do-not-rewrite side.



 -Original Message-
 From: Savino, Matt C 
 Sent: Wednesday, May 14, 2003 11:47 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Re: Error when piping XSL-FO to FOP driver using 
 SAXResult
 
 
 Below is something we use as part of a much more involved 
 stylesheet. Although looking at it now it's not the most 
 efficient piece of code as it loops through the same nodes 
 several times. (We use it to break output into groups of five 
 columns and know we'll never have more than 3 or 4 groups, so 
 we didn't need to worry about running through the same nodes 
 a few extra times.) 
 
 I think for efficiency and straighforwardness, the Steve 
 Tinney example from the link in the previous post is probably 
 the best way to go. 
 (http://www.dpawson.co.uk/xsl/sect2/N4486.html#d4085e94)
 
 -matt
 
 
 [...]
 fo:table-body

   xsl:for-each select=customerPF
 xsl:if test=(position()-1) mod 3 = 0
 
   xsl:call-template name=new-row
xsl:with-param name=row-num select=position() - 1 /
   /xsl:call-template
 
 /xsl:if
fo:table-cellfo:blockxsl:value-of 
 select=position()//fo:block/fo:table-cell
   /xsl:for-each
  
 /fo:table-body
 [...]
 
 
 xsl:template name=new-row
  xsl:param name=row-num/
  
fo:table-row
 
 xsl:for-each select=../customerPF
  xsl:if test=$row-num lt; position()
   xsl:if test=$row-num+4 gt; position()
 fo:table-cellfo:blockxsl:value-of 
 select=position()//fo:block/fo:table-cell   
   /xsl:if
  /xsl:if
 /xsl:for-each

   /fo:table-row
 xsl:template
 
 
 
  Thanks for the response. Yes, its definitely a hack because I 
  could not put
  a /fo:table-row inside the xsl:if tag. I get an error 
  message saying
  The element type xsl:if must be terminated by the matching end-tag
  /xsl:if
  
  Is there a better way to accomplish what I need to 
 do...i.e. ouputting
  portions of table-row tags depending on certain conditions? Thanks.
  
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]