[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

more about filtering and sorting

Subject: more about filtering and sorting
From: Linda van den Brink <lvdbrink@xxxxxxx>
Date: Tue, 30 Mar 1999 10:22:44 +0200
sort and filter html table
Hi all, 

I succeeded in processing nodes multiple times, so that I could produce
several HTML tables with different sorting of the same data. My next steps
are giving me more problems to achieve... 

I have my list of documents in XML format, looking something like this: 

<contents>
  <document lang="french" cat="install">
    <nr>7160</nr>
    <language>french</language>
    <category>2install</category>
    <title>Guide d'utilisation Baan Enterprise Decision Navigator</title>
    <url>..\..\documents\fr\U7160BFR.pdf</url>
  </document>
  
  <document lang="dutch" cat="manual">
    <nr>7160</nr>
    <language>dutch</language>
    <category>3manual</category>
    <title>Gebruikershandleiding Baan Enterprise Decision Navigator</title>
     <url>..\..\documents\nl\U7160BNL.pdf</url>vvv
  </document>
</contents>

I have documents in different languages and different categories. I want to
produce three HTML tables for each language: one sorted by title, one sorted
by nr, and one sorted by category. Now, I want to do this for each language.
So I must somehow do a repeated filtering for each language and then do
three sortings for each language. What's the easiest way to do this? 

My current stylesheet is below. This version generates the three sorted
tables for german documents only. How do I add templates for the other
languages? I want to keep my stylesheet as short as possibly, because I can
have up to 12 languages... 

===================================
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">
	<xsl:apply-templates select="contents"/>
</xsl:template>

<!-- als het werkt, nog comments toevoegen -->

<xsl:template match="contents">
	<table cellspacing="0" cellpadding="0">
		<xsl:apply-templates select="document[language='german']">
			<xsl:sort select="title"/>
		</xsl:apply-templates>
	</table>
	<table cellspacing="0" cellpadding="0">
		<xsl:apply-templates select="document[language='german']">
			<xsl:sort select="nr"/>
		</xsl:apply-templates>
	</table>
	<table cellspacing="0" cellpadding="0">
		<tr><td colspan="3" class="cat">Release
Information</td></tr>
		<xsl:apply-templates select="document[category='1release'
and language='german']">
			<xsl:sort select="category"/>
			<xsl:sort select="nr"/>
		</xsl:apply-templates>
		<tr><td colspan="3" class="cat">Installation
Guides</td></tr>
		<xsl:apply-templates select="document[category='2install'
and language='german']">
			<xsl:sort select="category"/>
			<xsl:sort select="nr"/>
		</xsl:apply-templates>
		<tr><td colspan="3" class="cat">Manuals/Guides</td></tr>
		<xsl:apply-templates select="document[category='3manual' and
language='german']">
			<xsl:sort select="category"/>
			<xsl:sort select="nr"/>
		</xsl:apply-templates>
	</table>
</xsl:template>

<xsl:template match="document">
	<tr>
		<xsl:apply-templates select="nr"/>
		<xsl:apply-templates select="title"/>
	</tr>
</xsl:template>

<xsl:template match="nr">
    <td><em>
    <xsl:apply-templates/>
    </em></td>
</xsl:template>

<xsl:template match="title">
    <td>
    <xsl:apply-templates/>
    </td>
    <td><xsl:apply-templates select="ancestor(document)/url"/></td>
</xsl:template>    

<xsl:template match="url">
	<span class="origin" onClick="conloc.href=('..\..\..\docs{.}')">Open
document</span>
</xsl:template>

</xsl:stylesheet>

==========================================


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.