Subject: Re: [xsl] Can't solve the following XSL transformation From: John Robb <john_ok@xxxxxx> Date: Mon, 25 Jul 2005 08:21:49 +0300 |
The first stage is a classical grouping problem: see
http://www.jenitennison.com/xslt/grouping for advice on using Muenchian
grouping in XSLT 1.0, or use the new xsl:for-each-group instruction in 2.0.
(Note, XSLT 1.1 doesn't really exist, it was a working draft that wasn't
followed up).
Insert the page breaks in a second pass through the data. This is a little
tricky (I use it as an exercise on courses) and requires processing the
sequence using recursion, passing a parameter in the recursive call that
indicates the number of lines processed so far.
Michael Kay http://www.saxonica.com/
-----Original Message-----
From: John Robb [mailto:john_ok@xxxxxx] Sent: 24 July 2005 22:45
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Can't solve the following XSL transformation
I'm a novice in XSLT and doesn't have any experience.Can you help me to perform the following transformation:
trasformed data should look as follows:
**************** Sector 1 **************** Subsector 1 ++++++++++++++++ ID[t]Value ---------------- id1[t]value1 ... idN valueN ---------------- Subsector 2 ++++++++++++++++ ID[t]Value ---------------- id1[t]value1 ... idN valueN ... **************** Sector 2 **************** Subsector 1 ++++++++++++++++ ID[t]Value ---------------- id1[t]value1 ... idN valueN ---------------- Subsector 2 ++++++++++++++++ ID[t]Value ---------------- id1[t]value1 ... idN valueN ...
There is a limitation: no more than 25 data rows (idX valueX) per page.Page breaks (<span style="page-break-before: always"></span>) cannot be inserted in the middle of data section but before sector/subsector only.I'm using XSLT v1.1.
Here is the xml:
<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
[t]<item id="i1"[t]sector="s1"[t]subsector="u1">561</item>
[t]<item id="i10"[t]sector="s3"[t]subsector="u4">15</item>
[t]<item id="i22"[t]sector="s2"[t]subsector="u2">1234</item>
[t]<item id="i11"[t]sector="s1"[t]subsector="u2">123</item>
[t]<item id="i17"[t]sector="s1"[t]subsector="u3">165</item>
[t]<item id="i61"[t]sector="s2"[t]subsector="u1">346</item>
[t]<item id="i12"[t]sector="s2"[t]subsector="u5">3425</item>
[t]<item id="i2"[t]sector="s3"[t]subsector="u4">78</item>
[t]<item id="i14"[t]sector="s3"[t]subsector="u4">51</item>
[t]<item id="i21"[t]sector="s1"[t]subsector="u5">346</item>
[t]<item id="i39"[t]sector="s3"[t]subsector="u2">463</item>
[t]<item id="i44"[t]sector="s2"[t]subsector="u3">151</item>
[t]<item id="i89"[t]sector="s1"[t]subsector="u1">451</item>
[t]<item id="i81"[t]sector="s2"[t]subsector="u4">771</item>
[t]<item id="i36"[t]sector="s2"[t]subsector="u5">5654</item>
[t]<item id="i27"[t]sector="s3"[t]subsector="u3">362</item>
[t]<item id="i15"[t]sector="s1"[t]subsector="u5">234</item>
[t]<item id="i18"[t]sector="s3"[t]subsector="u2">73</item>
[t]<item id="i51"[t]sector="s3"[t]subsector="u5">567</item>
[t]<item id="i26"[t]sector="s1"[t]subsector="u4">17</item>
[t]<item id="i95"[t]sector="s3"[t]subsector="u5">67489</item>
[t]<item id="i13"[t]sector="s1"[t]subsector="u3">54</item>
[t]<item id="i71"[t]sector="s1"[t]subsector="u3">2</item>
[t]<item id="i23"[t]sector="s2"[t]subsector="u1">345</item>
[t]<item id="i7"[t]sector="s2"[t]subsector="u1">67</item>
[t]<item id="i80"[t]sector="s1"[t]subsector="u3">7754</item>
[t]<item id="i9"[t]sector="s3"[t]subsector="u4">343</item>
[t]<item id="i4"[t]sector="s1"[t]subsector="u2">51</item>
[t]<item id="i99"[t]sector="s3"[t]subsector="u5">5637</item>
[t][t]
[t][t]<sector id="s1">Sector 1</sector>
[t]<sector id="s2">Sector 2</sector>
[t]<sector id="s3">Sector 3</sector>
[t]<subsector id="u1">Subsector 1</subsector> [t]<subsector id="u2">Subsector 2</subsector> [t]<subsector id="u3">Subsector 3</subsector> [t]<subsector id="u4">Subsector 4</subsector> [t]<subsector id="u5">Subsector 5</subsector> </data>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Can't solve the following, Michael Kay | Thread | RE: [xsl] Can't solve the following, Michael Kay |
RE: [xsl] Can't solve the following, Michael Kay | Date | RE: [xsl] Can't solve the following, Michael Kay |
Month |