Subject: [xsl] Re: XSL-List Digest V4 #1219 From: "Kathrin Compostella" <Kathrin.Compostella@xxxxxxxx> Date: Tue, 20 May 2003 14:08:00 +0200 (CEST) |
Hi Dave, At long last was able to have time to concentrate on my problem. I have solved the problem sofar with the combination of 'generate-id' and 'page-number-citation'. Maybe you didn't realise I needed to use more than one 'generate-id' in the same for-each block. I solved it by using a different element for each 'generate-id' (I didn't realise you could do this). Then in the table of contents I was able to refer to the different generated ids for the page number as a reference for 'page-number-citation'. Now I have a problem that I can't get my page numbers aligned to the right properly even though I use text-align="end". Check with my code below maybe somebody can enlighten me. ____________________________________________________ MINI SAMPLE INPUT occurrence <First_Collection> (1-n) <Bean_Suggestion key="39"> (1) <name> John </name> <surname> Burke </surname> <type> 123 </type> <Second_Collection key="1"> (1-n) < Bean_Finance> (1) <product> 3 </product> <Second_Collection key="2"> < Bean_Finance> <product> 2 </product> <Second_Collection key="3"> < Bean_Finance> <product> 1 </product> ETC. ETC ______________________________________________________________ SOURCE CODE ________________________________________________________________ <!-- FLOW --> <fo:flow flow-name="xsl-region-body"> <xsl:call-template name="Coverpage"/> <!-- START OF FOR-EACH BLOCK WHERE I GENERATE MORE THAN ONE ID --> <!-- THERE CAN BE SEVERAL 'First_Collection's --> <xsl:for-each select="First_Collection"> <!-THE FIRST GENERATE-ID --> <fo:block id="{generate-id(name)}"> </fo:block> <!-- FOR EACH 'First_Collection's 'BLOCK 1' IS NEEDED --> <!-- START BLOCK 1 --> <xsl:call-template name="ParaOne"/> <xsl:call-template name="ParaTwo"/> <xsl:call-template name="ParaThree"/> <!-- END BLOCK 1 --> <!-- UNDER EACH 'First_Collection' THERE CAN BE SEVERAL 'Second_Collections's AND TO EACH 'Second_Collection' THERE IS ONE 'Bean_Finance' --> <xsl:if test="Second_Collection/Bean_Finance[product = or product = 4]"> <!-THE SECOND GENERATE-ID --> <fo:block id="{generate-id(surname)}" break-before="page"> </fo:block> <xsl:for-each select="Second_Collection"> <xsl:if test="Bean_Finance[product = 3 or product = 4]"> <xsl:call-template name="SectionTwo"/> </xsl:if> </xsl:for-each> <fo:block break-before="page"> </fo:block> <!-THE THIRD GENERATE-ID --> <fo:block id="{generate-id(type)}"> </fo:block <xsl:call-template name="SectionThree"/> </xsl:for-each> --> <!-- END OF FOR-EACH BLOCK WITH THREE DIFFERENT GENERATE-ID TO BE ABLE TO DIFFERENTIATE BETWEEN IN THE TABLE OF CONTENTS --> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template> <!--========================================================== ! Section 'Coverpage' with Table of Contents !===========================================================--> <xsl:template name ="Coverpage"> <!-- 3 Columns --> <fo:table keep-together="always"> <fo:table-column column-width="50mm"/> <fo:table-column column-width="50mm"/> <fo:table-column column-width="50mm"/> <fo:table-body padding="0mm"> <!-- ROW 1 / Column 1-2 --> <fo:table-row keep-with-next="always" keep-together="always"> <fo:table-cell number-columns-spanned="3" xsl:use-attribute-sets="font-helv10b"> <fo:block> Table of Contents </fo:block> </fo:table-cell> </fo:table-row> <!-- ROW 2 / Column 1-2 --> <fo:table-row keep-with-next="always" keep-together="always"> <fo:table-cell number-columns-spanned="2"> <fo:block> </fo:block> </fo:table-cell> <!-- ROW 2 / Column 3 --> <fo:table-cell number-columns-spanned="1" xsl:use-attribute-sets="font-helv10n"> <fo:block text-align="end" text-decoration="underline"> Page </fo:block> </fo:table-cell> </fo:table-row> <!-- BEGIN OF THE FOR-EACH ROUTINE --> <!-- A REPEATED BLOCK FOR THE TABLE OF CONTENTS INCLUDING PAGE NUMBERS --> <xsl:for-each select="First_Collection"> <!-- ROW 3 / Column 1-2 --> <fo:table-row keep-with-next="always" keep-together="always"> <fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="font-helv10n"> <fo:block> - Section One </fo:block> </fo:table-cell> <!-- ROW 3 / Column 3 --> <fo:table-cell number-columns-spanned="1" xsl:use-attribute-sets="font-helv10n"> <!-FIRST REFERENCE TO THE GENERATE ID FOR THE PAGE-NUMBER-CITATION --> <fo:block text-align="end"> <fo:page-number-citation ref-id="{generate-id(name)}"/> </fo:block> </fo:table-cell> </fo:table-row> <!-- ROW 4 / Column 1-2 --> <xsl:if test="/section/First_Collection/Second_Collection/Bean_Finance[pro duct = 3 or product = 4]"> <fo:table-row keep-with-next="always" keep-together="always"> <fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="font-helv10n"> <fo:block> - Section Two </fo:block> </fo:table-cell> <!-- ROW 4 / Column 3 --> <fo:table-cell number-columns-spanned="1" xsl:use-attribute-sets="font-helv10n"> <!-SECOND REFERENCE TO THE GENERATE ID FOR THE PAGE-NUMBER-CITATION --> <fo:block text-align="end"> <fo:page-number-citation ref-id="{generate-id(surname)}"/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:if> <!-- ROW 5 / Column 1-2 --> <fo:table-row keep-with-next="always" keep-together="always"> <fo:table-cell number-columns-spanned="2" xsl:use-attribute-sets="font-helv10n"> <fo:block> - Section Three </fo:block> </fo:table-cell> <!-- ROW 5 / Column 3 --> <fo:table-cell number-columns-spanned="1" xsl:use-attribute-sets="font-helv10n"> <!-THIRD REFERENCE TO THE GENERATE ID FOR THE PAGE-NUMBER-CITATION --> <fo:block text-align="end"> <fo:page-number-citation ref-id="{generate-id(type)}"/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each> <!-- END THE FOR-EACH ROUTINE --> </fo:table-body> </fo:table> </xsl:template> </xsl:stylesheet> __________________________________________________________________ ______ OUPUT HOW IT IS NOW Table of Contents Page - Section One 2 - Section Two 4 - Section Three 7 - Section One 9 - Section Two 12 - Section Three 14 OUPUT HOW I WOULD LIKE WITH NUMBERS ALIGNED AS FOLLOWS: (so that the 2, 4, 7 & 9 are aligned over the 2 of 12 and 4 of 14). Table of Contents Page - Section One 2 - Section Two 4 - Section Three 7 - Section One 9 - Section Two 12 - Section Three 14 (there can be several repeats of these blocks) I tried as follows, but I just couldn't get my numbers right aligned as above: <fo:table-cell number-columns-spanned="1" xsl:use-attribute-sets="font-helv10n"> <fo:block text-align="end"> <fo:page-number-citation ref-id="{generate-id(name)}"/> </fo:block> </fo:table-cell> Maybe one can't align page-number-citation ref-id="{generate-id(name)}" with text-align and you have to use something else!!!?? Help is really appreciated. Thanks Kathrin XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Maintaining character ent, David Carlisle | Thread | [xsl] Remove xalan extension functi, TP |
RE: [xsl] document() function., Michael Kay | Date | Re: [xsl] string matching problem, Myriam Delperier |
Month |