Re: [xsl] XSL-FO list with sublist

Subject: Re: [xsl] XSL-FO list with sublist
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Dec 2007 15:39:30 -0500
Lucas,

Well, it's true that if you never use anything
but xsl:for-each and xsl:value-of, you will soon
hit a wall. In general, an experienced XSLT
designer uses templates, which are designed
precisely to afford the necessary flexibility, in
preference to for-each and value-of.

Your structure is, however, very regular. Think of it like this:

for each goal, generate blocks for any content
then, make a list
  for each question in the goal, make an item
    inside, generate blocks for any content you want here
    then, if any metrics are present, make a list
      inside, for each metric, make an item
        inside it, generate blocks for any content you want here

You could do this entirely with for-each and
value-of. If you know for a fact that no question
appears without metric children, you could even
skip the conditional "if any metrics are
present". (The conditional is present to avoid
creating empty lists in case there is nothing to make an item in your
sublist.)

Does this help?

(We could use templates instead of for-each for
better code, but that wouldn't address the particular question you are
asking.)

Cheers,
Wendell

At 03:20 PM 12/12/2007, you wrote:
Hi,

But the problem is my xml, that is like below.
Inside gqmroot I have goals, inside each goal I
have questions and inside each question I have
metrics. In the normal XSLT I used the for-each
and value-of to get each xml node. In this way
that you told me to do the list, I think I can't use that or am I wrong?


Thanks again, Lucas


<?xml version="1.0" encoding="UTF-8"?>


<?xml-stylesheet type="text/xsl" href="F-GESGQM.xsl"?>
<!-- New document created at Thu Oct 18 08:53:18 CEST 2007 -->

<gqmroot titleRoot="F-GES GQM">
        <goal titleGoal="G.1. Aumento della qualit` esterna">
                <question titleQuestion="Q.1.1.
Quanti bug trova lutente? Quanti sono ad alta priorit`?">
                        <metric

titleMetric="M.1.1.1. Numero di bug riportati
nell'intervallo di tempo considerato, divisi per
centro di costo e per prodotto."
                                ChartLink="gesGQMReport_M111.html">
                        </metric>
                        <metric

titleMetric="M.1.1.2. Numero di bug ad alta
priorit` riportati dallutente al mese, divisi
per centro di costo e per prodotto."
                                ChartLink="gesGQMReport_M112.html">
                        </metric></question>
                <question titleQuestion="Q.1.2.
Quanto h soddisfatto lutente della nuova release?">
                        <metric

titleMetric="M.1.2.1 Numero di richieste di
cambiamento del sistema nell'intervallo di tempo per quella release"
                                ChartLink="gesGQMReport_M121.html">
                        </metric>
                        <metric

titleMetric="M.1.2.2. Numero di bug riportati
dall'utente nell'intervallo di tempo facenti riferimento a quella release"
                                ChartLink="">
                        </metric>
                        <metric

titleMetric="M.1.2.3. Tempo medio di fix dei bug ad alta priorit`"
                                ChartLink="">
                        </metric>
                </question>
                <question titleQuestion="Q.1.3.
Quanto viene usata una release prima che sia rilasciata quella
successiva?">
<metric

titleMetric="M.1.3.1. Effort di utilizzo dell'applicazione"
                                ChartLink="">
                        </metric></question>
                <question titleQuestion="Q.1.4.
Qual h l'aderenza tra bisogno dell'utente
(identificato in una storia) e rilascio?">
                        <metric

titleMetric="M.1.4.1. Numero di richieste di
cambiamento del sistema nel primo intervallo di tempo"
                                ChartLink="">
                        </metric>
                        <metric

titleMetric="M.1.4.2. Valutazione soggettiva da parte dei beta-tester"
                                ChartLink="">
                        </metric>
                        <metric

titleMetric="M.1.4.3. Numero di falsi negativi tra le richieste di
intervento"
                                ChartLink="">
                        </metric>
                </question>
        </goal>
</gqmroot>


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread