I don't have a workstation that is set up with my usual tools today, so I
haven't been able to test this, but try out this stylesheet and let us know if
it does what you want, and if not, explain further.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="gqmroot">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="goal">
<h4><xsl:value-of select="@titleGoal"/></h4>
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="question">
<li>
<h4><xsl:value-of select="@titleQuestion"/></h4>
<ul>
<xsl:apply-templates />
</ul>
</li>
</xsl:template>
<xsl:template match="metric">
<li>
<h4><xsl:value-of select="@titleMetric"/></h4>
<h4><xsl:value-of select="unparsed-text(@ChartLink)"
disable-output-escaping="yes"/></h4>
</h4>
</li>
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Lucas Gonçalves Grossi <lggrossi(_at_)uol(_dot_)com(_dot_)br>
Sent: Thu, 29 Nov 2007 17:41:59 -0200
To: "xsl-list" <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] Help with tree menu
Hello everybody,
I'm having a problem in my XSL code. My XSL file get an xml as input and
derives an html. In the output html I'm trying to do a tree menu, and the
<h4> html tag is the initializator of the button in menu, i.e. when I click
in this button, the menu open, like this "+" of xml.
The problem is that, as the h4 is after the for-each, it's appearing just in
the first value. So, the menu is ok (open) just for the first value. Ex:
goal
+question1
+question2
If I click on question 1, open or close his submenu. If i click on question
2, should appear his submenu, but it open or close the menu of question 1 too.
Can anybody help me? Thanks a lot.
<xsl:for-each select="gqmroot/goal">
<h4><xsl:value-of select="@titleGoal"/></h4>
<ul>
<li><xsl:for-each select="question">
<h4><xsl:value-of select="@titleQuestion"/></h4>
<ul>
<li><xsl:for-each select="metric">
<h4><xsl:value-of select="@titleMetric"/></h4>
<h4>
<xsl:value-of select="unparsed-text(@ChartLink)"
disable-output-escaping="yes"/>
</h4>
</xsl:for-each>
</li>
</ul>
</xsl:for-each>
</li>
</ul>
</xsl:for-each>
My xml file:
<?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>
</question>
</goal>
<goal titleGoal="G.2 Aumento della qualità interna">
<question titleQuestion="Q.2.1. Qual è la probabilità che una modifica
introduca un nuovo bug?">
<metric
titleMetric="M.2.1.1. Rapporto tra numero di test che falliscono ed il numero
totale di test durante la fase di integrazione notturna"
ChartLink="">
</metric></question>
<question titleQuestion="Q.2.2. Quanto è espressivo il codice?">
<metric titleMetric="M.2.2.1. Complessità ciclomatica"
ChartLink="">
</metric>
<metric titleMetric="M.2.2.2. Weighted Methods per Class"
ChartLink="">
</metric>
</question>
</goal>
</gqmroot>
Thanks,
LUCAS
--~------------------------------------------------------------------
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>
--~--