|
Subject: [xsl] Grouping and sorting nodes by the values of the 2 elements, and displaying only 1 in the HTML output From: ghostrider <ghostrider@xxxxxxxxxxx> Date: Thu, 28 Jun 2001 17:15:01 +0200 |
Hi everyone,
I'm trying to process the following XML file:
<----------XML-------------------------------->
<root>
<Bugs>
<Bug>
<Category1>aaa</Category1>
<Category2>111</Category2>
<Description>Some text</Description>
</Bug>
<Bug>
<Category1>aaa</Category1>
<Category2>222</Category2>
<Description>Some text</Description>
</Bug>
...
</Bugs>
</root>
<----------XML-------------------------------->
... where Cat2 is a subcategory of Cat1.
What I need is to get in the output is this:
<----------HTML-------------------------------->
<H1>aaa</H1>
<H2>111<H2>
<p>Some text</p>
...
<H2>222<H2>
<p>Description text2</p>
...
<H1>bbb</H2>
<H2>333<H2>
<p>Some text</p>
<----------HTML-------------------------------->
So all Bugs should be sorted by Category1, then by Category2, but i don't want
to output the value of Category1 for each Bug.
The second issue is that I need to generate a linked table of contents based
on Category1 element values:
-------------
Contents
aaa
bbb
ccc
--------------
Below is part of the XSL that I already have, and which outputs both cat1 and
cat2 (sorted) for each Bug node.
Someone please have a quick look at this - thanks!
Armin
<----------XSL-------------------------------->
<xsl:template match="root">
<html>
<body>
<xsl:apply-templates select="Bugs/Bug">
<xsl:sort select="Category1" order="ascending" />
<xsl:sort select="Category2" order="ascending" />
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="Bug">
<span >
<p>
<a name="Type"><xsl:value-of select="Category1"/></a></p>
<p><xsl:value-of select="Category2"/></p></span>
<div>
<p><xsl:value-of select="Description"/></p></div>
</xsl:template>
<----------XSL-------------------------------->
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Generating Link Reference, Rene de Vries | Thread | RE: [xsl] Grouping and sorting node, Michael Kay |
| [xsl] Generating Link References, Hewko, Doug | Date | [xsl] conditionally accessing attri, Yogesh |
| Month |