I have a list of letters in xml that need to be output 3 to a page in a pdf. My
stylesheet snippet is xslt 1.0 (that works) and performs this is:
<xsl:for-each select="Letter[position() mod 3 = 1]">
<!-- New Page -->
<fo:page-sequence master-reference="mainPSM">
<fo:flow flow-name="xsl-region-body" font-size="12pt"
font-family="monospace">
<fo:block-container padding-top="2.8cm" height="9.3cm"/>
<xsl:call-template name="formatLetter"/>
<fo:block-container padding-top=".5cm"/>
<xsl:for-each select="following-sibling::Letter[ position() < 3 ]">
<fo:block-container padding-top="3.1cm" height="9.3cm"/>
<xsl:call-template name="formatLetter"/>
<fo:block-container padding-top=".5cm"/>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
New requirements now request that the letters be sorted by zip code. If I place
an <xsl:sort .../> tag after each for-each tag, it doesn't sort properly. It
appears to sort the elements where 'mod 3 = 1' is true but then the subsequent
letters on the page are not sorted properly. When I tried using a key on the
AccountNumber, I quickly found that each key has a position of 1, so each
letter got its own page. When I tried copying the sorted list to a variable,
the 'following-sibling::Letter[ position() < 3 ]' code give me this error:
A node test that matches either NCName:* or QName was expected.
I am certain that I am overlooking something here but input would be greatly
appreciated. Below is a snapshot of the xml I am working with:
<Letters>
<Letter>
<Account>
<AccountNumber checkdigit="3">296</AccountNumber>
<NoticeType>Final</NoticeType>
<Customer>
<FirstName />
<MiddleName />
<SecondName />
<SecondFirstName />
<LastName>LastName1</LastName>
<NameSuffix />
<WorkPhone />
</Customer>
<MailZip>43218-2308</MailZip>
<Balance>737.43</Balance>
<LateCharge>21.48</LateCharge>
</Account>
</Letter>
<Letter>
<Account>
<AccountNumber checkdigit="9">3
<FirstName />
<MiddleName />
<SecondName />
<SecondFirstName />
<LastName>LastName3</LastName>
<NameSuffix />
<WorkPhone />
</Customer>
<MailZip>38363-0550</MailZip>
<Balance>124.34</Balance>
<LateCharge>5.00</LateCharge>
</Account>
</Letter>
<Letter>
<Account>
<AccountNumber checkdigit="5">299</AccountNumber>
<NoticeType>Final</NoticeType>
<Customer>
<FirstName />
<MiddleName />
<SecondName />
<SecondFirstName />
<LastName>LastName2</LastName>
<NameSuffix />
<WorkPhone />
</Customer>
<MailZip>40233-6230</MailZip>
<Balance>55.00</Balance>
<LateCharge>.30</LateCharge>
</Account>
</Letter>
</Letters>
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--