[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fop-user
Subject:    RE: XSL Variable Question
From:       "Michael Halpin" <mhalpin () globaluniversity ! edu>
Date:       2008-04-25 16:27:55
Message-ID: 529330663856A04AA2D3F39D73EDE64171AA58 () mail ! globaluniversity ! edu
[Download RAW message or body]

I put the whole header in the retrieval marker and it worked great
thanks a bunch.

-----Original Message-----
From: Andreas Delmelle [mailto:andreas.delmelle@telenet.be] 
Sent: Tuesday, April 22, 2008 2:32 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: XSL Variable Question

On Apr 22, 2008, at 18:56, Michael Halpin wrote:

Hi

> I am relatively new to XSL and FOP.

OK, we'll go easy on you then... ;-)

>  For the project that I am working on they do not want any kind of  
> folio headers at the top of new chapter pages, which are libel to  
> appear on any page anywhere with no pattern, so I have written the  
> following code to try to get it to omit the headers on pages marked  
> noHeader using the fo:retrieve-marker command.  Here is the problem  
> code:
>
>   <xsl:template name="footer-odd">   <!-- This is the folio line  
> info -->
>     <fo:block font-family="Times New Roman" font-size="11pt">
>       <xsl:if test="$version">
>
>                         <xsl:variable name="chapterNumber">
>                                     <fo:retrieve-marker retrieve- 
> class-name="chapterID"
>                     retrieve-position="first-starting-within-page"
>                     retrieve-boundary="page-sequence" />
>                         </xsl:variable>

So, your variable will ALWAYS contain the result-tree-fragment:  
<fo:retrieve-marker ... />

As a consequence, the below xsl:choose will ALWAYS use the  
xsl:otherwise branch. No way that that variable can ever evaluate to  
the string 'noHeader'.

>                         <xsl:choose>
>                                     <xsl:when test="$chapterNumber  
> = 'noHeader'">  <!--If marked noHeader -->
>                                                 No Headers!       
> <!--Then omit headers (delete text later) -->
>                                     </xsl:when>  <!--end if no  
> headers -->
>
>                                     <xsl:otherwise>             <!-- 
> else draw full header -->
> <snip />
> I realize after browsing some of the archives that my problem most  
> likely stems from trying to use <xsl:variable> in conjunction with  
> <fo:retrieve-marke>, which if I understand correctly occurs after  
> all the xsl items are processed.

Correct. FOP processes the FO that results from the XSL transform. By  
the time the input reaches FOP, there will be no more elements in the  
XSLT namespace in the document. Those will have all been processed by  
then.

> So my question is does anyone know a way I can either fix this code  
> or anything else that I can do to achieve my objective?

Look at it a bit differently: a fo:retrieve-marker works in  
conjunction with fo:markers. Now, if you can just make sure that, on  
the pages in question, the retrieved fo:marker is empty or non- 
existing, then you will get the result you want.

Right now, you're testing for a retrieved fo:marker that contains the  
text 'noHeader', which doesn't work for the reason you mentioned.
As a very rough first try: change those fo:markers to empty ones. No  
xsl:choose needed. The default marker-retrieval mechanism should take  
care of the rest for you.


HTH!

>
> Thanks,
> Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic