-
xsl:sort with complex types (?)
Hello,
maybe it is really something simple, but I have not been able to solve it working through different examples, guides and forums.
An example from my XML file:
---------------
<thesaurus>
<term>
<title>origin</title>
<narrowerterm>type of origin</narrowerterm>
<narrowerterm>propagation</narrowerterm>
</term>
<term>
<title>type of origin</title>
<broaderterm>origin</broaderterm>
<narrowerterm>biochemical</narrowerterm>
<narrowerterm>techno-physical</narrowerterm>
<narrowerterm>supernatural</narrowerterm>
</term>
<term>
<title>propagation</title>
<broaderterm>origin</broaderterm>
<narrowerterm>physical contact</narrowerterm>
<narrowerterm>airborne</narrowerterm>
<narrowerterm>waterborne</narrowerterm>
<narrowerterm>spells</narrowerterm>
</term>
</thesaurus>
---------------
The XSL code I apply to this:
---------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="thesaurus">
<html>
<body>
<a name="top"><h2>Thesaurus</h2></a>
<xsl:apply-templates>
<xsl:sort select="title"/>
<xsl:sort select="broaderterm"/>
<xsl:sort select="narrowerterm"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="term">
<p>
<xsl:apply-templates select="title"/>
<xsl:apply-templates select="broaderterm"/>
<xsl:apply-templates select="narrowerterm"/>
</p>
<a href="#top">return to top of page</a><br/><br/>
</xsl:template>
<xsl:template match="title">
<span style="font-weight: bold">
<a name="{.}"><xsl:value-of select="."/></a></span>
<br />
</xsl:template>
<xsl:template match="broaderterm">
<pre> BT: <a href="#{.}"><xsl:value-of select="."/></a></pre>
</xsl:template>
<xsl:template match="narrowerterm">
<pre> NT: <a href="#{.}"><xsl:value-of select="."/></a></pre>
</xsl:template>
</xsl:stylesheet>
---------------
What I want:
---------------
Thesaurus
origin
NT: propagation
NT: type of origin
return to top of page
propagation
BT: origin
NT: airborne
NT: physical contact
NT: spells
NT: waterborne
return to top of page
type of origin
BT: origin
NT: biochemical
NT: supernatural
NT: techno-physical
return to top of page
---------------
What I get:
---------------
Thesaurus
origin
NT: type of origin
NT: propagation
NT: place of origin
return to top of page
place of origin
BT: origin
NT: extra-dimensional
NT: extra-terrestrial
NT: terrestrial
return to top of page
propagation
BT: origin
NT: physical contact
NT: airborne
NT: waterborne
NT: spells
return to top of page
type of origin
BT: origin
NT: biochemical
NT: techno-physical
NT: supernatural
return to top of page
---------------
xsl:sort only has an effect on title, but not on narrowerterm within a term.
Questions:
Why does sort for narrowerterm within a term no work?
Is the xsl:sort applied to term and has no effect on sorting within a term?
Thanks a lot!
All the best
qlumbus
Similar Threads
-
By muli_treiber in forum VB Classic
Replies: 2
Last Post: 02-01-2009, 08:09 AM
-
By Peter_APIIT in forum C++
Replies: 22
Last Post: 07-20-2007, 10:53 PM
-
Replies: 7
Last Post: 12-01-2005, 11:29 PM
-
Replies: 0
Last Post: 11-30-2001, 06:04 AM
-
By Tahui in forum VB Classic
Replies: 2
Last Post: 11-22-2000, 10:24 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks