|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: RE: Hello, some problems with XSL-FO
I have looked at a course catalogue a time or two in my life. Here's what I think you want, please correct me if I am mistaken.
For each <course_group> element in "courses_codes.xml" you want to gather all <course> elements in the "courses.xml" document with a <course_group> element whose value matches the value of the <course_group>.
For example, if you had passed "ANTH" as the value of the "group" parameter to your stylesheet, you want an output like this:
Anthropology and Archaeology
The Archaeology of the American Southwest ............................ 2
[Here would be other course titles taken from the <course> elements in "courses.xml", all with "ANTH" as the value of the <course_group> element sorted alphabetically on the <title> element.]
On page 2 (I'm assuming that the "2" at the end of the leader dots is a page number), you want to have all sections of this course (sorted by title) listed for the those <course> element with an "acad_year" attribute whose value matches the value of the "year" parameter you passed to the stylesheet.
I fear that sending you to the explanation of Meunchian grouping may have been a waste of your time. After re-reading your post, I recognize now that the groupings are defined in the file "courses.xml" and that you don't have to synthesize them from the "courses_codes.xml" file.
I don't have my XSL-FO reference books at hand so this sample stylesheet will need work. Let me know if it satisfies the basic need for the table of contents.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:param name="group" select="'ANTH'" />
<xsl:param name="year" select="'2003'" />
<xsl:variable name="look-up" select="document('courses.xml')" />
<xsl:template match="/dce_courses">
<xsl:text>
</xsl:text>
<xsl:value-of select="$look-up/courses_codes/course_groups/course_group[@code=$group]/@name " />
<xsl:text>
</xsl:text>
<fo:block>
<xsl:for-each select="course[@acad_year=$year and course_group=$group]">
<xsl:sort select="title" />
<fo:block text-align-last="justify">
<fo:basic-link>
<xsl:attribute name="internal-destination">
<xsl:value-of select="generate-id()" />
</xsl:attribute>
<xsl:value-of select="title" />
<fo:leader leader-pattern="dots" />
<fo:page-number-citation>
<xsl:attribute name="ref-id">
<xsl:value-of select="generate-id()" />
</xsl:attribute>
</fo:page-number-citation>
</fo:basic-link>
</fo:block>
</xsl:for-each>
</fo:block>
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell@xxxxxxxxxx - email
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








