Web Development

General discussion



By elrey103 ·
My friend is looking for how to do something in XML - here's what he wrote......
he knows XML fairly well - but can't figure out for the life of him how to get it to ALPHABITZE the stuff...
There are lots of tutorials and stuff that assume he knows too much already apparently....
Please write a complete script that will pull the data from the following XML database and list the names in alphabetical order and display it on a webpage


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Jaqui In reply to XML QUESTION

I would recommend your friend uses a perlscript cgi for the sorting, have it send it as the xml.
xml is more markup than data manipulation, designed for layout.
a scripting language has the tools for a sort already.
I'm not sure it's possible to run a sort in a layout language.

Collapse -

by grantwparks In reply to XML QUESTION

If you an XSL transform facility available you can use XSL stylesheet:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" omit-xml-declaration="yes" />

<xsl:template match="/company">
<xsl:apply-templates select="employee" />
<h3>Sorted by name</h3>
<xsl:apply-templates select="employee">
<xsl:sort select="name"/>
<xsl:template match="employee">
<p><xsl:value-of select="name"/></p>

Collapse -

by Sara L In reply to XML QUESTION

Data is coming from a database, right? Can't you just use an ORDER BY clause in the SQL statement?

Just a thought.

Related Discussions

Related Forums