473,382 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

xsl:sort

Example XML:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<foo>
<index>1></index>
<bar>
<child />
<child />
</bar>
</foo>
<foo>
<index>n</index>
<bar>
<child />
<child />
</bar>
</foo>
</root>

My question is (as I understand pieces of how xsl:apply-templates works with
xsl:sort) why does this work:
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="root">
<xsl:apply-templates>
<xsl:sort select="index" order="descending" />
</xsl:apply-templates>
</xsl:template>

Since I haven't (at least without assuming) that I'm sorting 'foo' elements.

Thanks for any input.
Jul 20 '05 #1
1 1800
Why do you think this shouldn't work?
=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

<sm****@bluehome.com> wrote in message news:niZtb.62808$jy.24811@clgrps13...
Example XML:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<foo>
<index>1></index>
<bar>
<child />
<child />
</bar>
</foo>
<foo>
<index>n</index>
<bar>
<child />
<child />
</bar>
</foo>
</root>

My question is (as I understand pieces of how xsl:apply-templates works with xsl:sort) why does this work:
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="root">
<xsl:apply-templates>
<xsl:sort select="index" order="descending" />
</xsl:apply-templates>
</xsl:template>

Since I haven't (at least without assuming) that I'm sorting 'foo' elements.
Thanks for any input.

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jarle Presttun | last post by:
Hi, Sometimes I display values by combining information from different sections in the xml, like I do with gradeText in the student template bellow. Is it possible to sort on gradeText when I...
1
by: Derek Tinney | last post by:
Hi, I'm having difficulty building an XLST file that allows me to sort a list of log records. I put together an XSL file that allows me to output a copy of the input file and then I attempted...
3
by: Tjerk Wolterink | last post by:
I posted my problem earlier, but i simplified the examples, and i know what the cause of the problem is, but i dont know the solution, my xml file: <?xml version="1.0" encoding="ISO-8859-1"?>...
6
by: Mark Miller | last post by:
I have a scheduled job that uses different XSL templates to transform XML and save it to disk. I am having problems with the code below. The problem shows up on both my development machine (Windows...
0
by: Nicolas | last post by:
Hi, I've been working on this problem for a couple of days and now i have no more ideas. first, this problem only happens with jdk 1.5, everything was fine with jdk1.4. I'm using a...
2
by: jobooker | last post by:
I'm having issues sorting. The short description is, how do I set the select attribute of xsl:sort to be the value of an xsl:variable? The longer description follows: What I want to do is to be...
3
by: davisford | last post by:
Hi, If I have something like this: <parents> <parent name="foo"> <children> <child>fred</child> <child>barney</child> <child>wilma</child>
2
by: ajc308 | last post by:
I have an XML document that looks like the following: <root name="PlanRepository"> <directory name="connoraj"> <directory name="single_run1"> <file>insidebox.txt</file> ...
1
by: =?Utf-8?B?SWxsdXN0cmlz?= | last post by:
I'm hoping someone can help me with what looks like a very simple problem. My output does not sort the languages alphabetically as I would expect. Can someone inspect my XSLT please? TIA!! ...
7
by: otis | last post by:
Hi all, This is a small issue to make things prettier, but we all know how important that can be! I had an xsl:if to check if a node was the last one in a collection of nodes and if it was a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.