Wendell,
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
What you said above I think is what I'm trying to do in my code. Take a look:
In this way, it's not working, because when I open a <fo:list-item> i think
XSL-FO don't permit open another one inside without closing the first.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simple"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="2cm"
margin-left="2.5cm"
margin-right="2.5cm">
<fo:region-body margin-top="3cm"/>
<fo:region-before extent="3cm"/>
<fo:region-after extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simple">
<fo:flow flow-name="xsl-region-body">
<fo:block text-align="center"
text-indent="5mm"
font-family="arial"
font-size="18pt"
space-before="5mm"
space-after="10mm">
<xsl:value-of
select="gqmroot/@titleRoot"/>
</fo:block>
<fo:list-block>
<fo:list-item>
<fo:list-item-label>
<fo:block></fo:block>
</fo:list-item-label>
<fo:list-item-body>
<xsl:for-each
select="gqmroot/goal">
<fo:block
text-indent="5mm"
font-family="arial" font-size="12pt"
space-before="5mm" space-after="5mm">
<xsl:value-of select="@titleGoal"/>
<fo:list-item>
<fo:list-item-label>
<fo:block></fo:block>
</fo:list-item-label>
<fo:list-item-body>
<xsl:for-each select="question">
<fo:block text-indent="5mm"
font-family="arial" font-size="12pt"
space-before="5mm" space-after="5mm">
<xsl:value-of select="@titleQuestion"/>
<fo:list-item>
<fo:list-item-label>
<fo:block></fo:block>
</fo:list-item-label>
<fo:list-item-body>
<xsl:for-each select="question">
<fo:block text-indent="5mm"
font-family="arial" font-size="12pt"
space-before="5mm" space-after="5mm">
<xsl:value-of
select="@titleQuestion"/>
<fo:list-item>
<fo:list-item-label>
<fo:block></fo:block>
</fo:list-item-label>
<fo:list-item-body>
<xsl:for-each select="metric">
<fo:block text-indent="5mm"
font-family="arial" font-size="12pt"
space-before="5mm" space-after="5mm">
<xsl:value-of select="@titleMetric"/>
<xsl:value-of select="unparsed-text(@ChartLink)"
disable-output-escaping="yes"/>
</fo:block>
</xsl:for-each>
</fo:list-item-body>
</fo:list-item>
</fo:block>
</xsl:for-each>
</fo:list-item-body>
</fo:list-item>
</fo:block>
</xsl:for-each>
</fo:list-item-body>
</fo:list-item>
</fo:block>
</xsl:for-each>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
Thanks,
LUCAS
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 l?utente? 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 dall?utente al mese, divisi
per centro di costo e per prodotto."
ChartLink="gesGQMReport_M112.html">
</metric></question>
<question titleQuestion="Q.1.2.
Quanto è soddisfatto l?utente 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 è 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(_at_)mulberrytech(_dot_)com
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
======================================================================
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--