RE: [xsl] Count problem

Subject: RE: [xsl] Count problem
From: "Arun Sinha" <arunsinha666@xxxxxxxxxxx>
Date: Fri, 17 Sep 2004 10:32:26 +0000
Hi,

As you have not provided the actual XML/XSL I will try to explain it theoritically.

Select all descendents from route for that class.
And check if there is a parent called "subvolume".

I hope that makes sense or you can send me the complete XML/XSL.

Cheers.

Arun


From: "Sebastian Fey" <fey@xxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] Count problem
Date: Fri, 17 Sep 2004 11:43:41 +0200

Hi there,

I need to count nodes to number a ordered list in fo.
I now got an easy structure where a toc of all linked books is built up
from.
The trick is that there is one structure file for all books i got, but
there result 3 different TOCs from, depending on the product_class
attribute of the single books.

Here is the actual structure:

Structure.xml
----------------
(...)
<volume>
<title>title of the volume</title>
<book fileref="book 1 (of class A)" />
<book fileref="book 2 (of class B)" />
<book fileref="book 3 (of class C)" />
<book fileref="book 4 (of class A)" />
</volume>

Linking to books like this:

Book1.xml
----------
<book product_class="A">
(...)

Book2.xml
----------
<book product_class="B">
(...)

The xslt:
----------

The script is runned three times, one run for each product class.
What it does is counting all books in a volume that have the actual
product_class.

<xsl:number count="book[document(@fileref)/book/@product_class =
$product_class]" />

The output looks like (eg for class A):
----------------------
Volume 1 title of the volume

1. title of book 1
2. title of book 4


This works so far, but now i have to change the structure to something like this

NEWStructure.xml
----------------
(...)
<volume>
<title>title of the volume</title>
<book fileref="book 1 (of class A)" />
<book fileref="book 2 (of class C)" />
<book fileref="book 3 (of class B)" />
<subvolume>
	<title>title of the subvolume</title>
	<book fileref="book 4 (of class A)" />
	<book fileref="book 5 (of class B)" />
</subvolume>
<book fileref="book 6 (of class C)" />
<book fileref="book 7 (of class A)" />
<book fileref="book 8 (of class B)" />
</volume>


The new output should look like (for Class A): ---------------------- Volume 1 title of the volume

1. title of book 1
2. title of the subvolume
   title of book 4
4. title of book 7

(for Class C):
----------------------
Volume 1 title of the volume

1. title of book 2
2. title of book 6

(notice that the subvolume doesnt appear here cause it does not contain
any book of class C)


...nice. I really got no idea how to manage this.



Thx a lot in advance, sebastian




--+------------------------------------------------------------------ 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@xxxxxxxxxxxxxxxxxxxxxx> --+--


_________________________________________________________________
Win a trip to Singapore! Experience the magic! http://eu.xmts.net/80450 Click here for details!


Current Thread