IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

incorrect ascending order Options · View
Milko
Posted: Tuesday, December 27, 2011 7:23:18 PM
Rank: Advanced Member

Joined: 6/28/2011
Posts: 76
Location: Vicenza
hello altova forum
i need to order my title films (ascending order) but the result is not always correct
this is xslt
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="*">
        <xsl:copy>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="sale_cinema">
        <xsl:copy>
            <xsl:apply-templates>
                <xsl:sort data-type="text" select="nome_salacinema/testo" order="ascending"/>
            </xsl:apply-templates>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="films">
        <xsl:copy>
            <xsl:apply-templates>
                <xsl:sort data-type="text" select="titolo_film/testo" order="ascending"/>
            </xsl:apply-templates>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>


this is my xml:
Code:
                                <sala>
                                    <nome_salacinema>
                                        <testo>Starplex Orzinuovi</testo>
                                    </nome_salacinema>
                                    <comune>
                                        <testo>Orzinuovi</testo>
                                    </comune>
                                    <indir>
                                        <testo>Via Lombardia 26/28</testo>
                                    </indir>
                                    <tel>
                                        <testo>030 94.36.05</testo>
                                    </tel>
                                    <films>
                                        <film>
                                            <titolo_film>
                                                <testo>Sherlock Holmes - Gioco di ombre</testo>
                                            </titolo_film>
                                            <cast>
                                                <regia>
                                                    <testo>Guy Ritchie</testo>
                                                </regia>
                                                <attori>
                                                    <attore>
                                                        <testo>Robert Downey Jr.</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Jude Law</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Noomi Rapace</testo>
                                                    </attore>
                                                </attori>
                                            </cast>
                                            <orari>
                                                <orario>
                                                    <testo>17.35</testo>
                                                </orario>
                                                <orario>
                                                    <testo>20.10</testo>
                                                </orario>
                                                <orario>
                                                    <testo>22.40</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                        <film>
                                            <titolo_film>
                                                <testo>Vacanze di Natale a Cortina</testo>
                                            </titolo_film>
                                            <cast>
                                                <regia>
                                                    <testo>Neri Parenti</testo>
                                                </regia>
                                                <attori>
                                                    <attore>
                                                        <testo>Christian De Sica</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Sabrina Ferilli</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Ricky Memphis</testo>
                                                    </attore>
                                                </attori>
                                            </cast>
                                            <orari>
                                                <orario>
                                                    <testo>17.45</testo>
                                                </orario>
                                                <orario>
                                                    <testo>20.15</testo>
                                                </orario>
                                                <orario>
                                                    <testo>22.35</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                        <film>
                                            <titolo_film>
                                                <testo>Le Idi di marzo</testo>
                                            </titolo_film>
                                            <cast>
                                                <regia>
                                                    <testo>George Clooney</testo>
                                                </regia>
                                                <attori>
                                                    <attore>
                                                        <testo>Ryan Gosling</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>George Clooney</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Philip Seymour Hoffman</testo>
                                                    </attore>
                                                </attori>
                                            </cast>
                                            <orari>
                                                <orario>
                                                    <testo>17.35</testo>
                                                </orario>
                                                <orario>
                                                    <testo>20.20</testo>
                                                </orario>
                                                <orario>
                                                    <testo>22.35</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                        <film>
                                            <titolo_film>
                                                <testo>Il Principe del deserto</testo>
                                            </titolo_film>
                                            <cast>
                                                <regia>
                                                    <testo>Jean-Jacques Annaud</testo>
                                                </regia>
                                                <attori>
                                                    <attore>
                                                        <testo>Tahar Rahim</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Antonio Banderas</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Mark Strong</testo>
                                                    </attore>
                                                </attori>
                                            </cast>
                                            <orari>
                                                <orario>
                                                    <testo>17.20</testo>
                                                </orario>
                                                <orario>
                                                    <testo>20.10</testo>
                                                </orario>
                                                <orario>
                                                    <testo>22.35</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                        <film>
                                            <titolo_film>
                                                <testo>Finalmente la felicità</testo>
                                            </titolo_film>
                                            <cast>
                                                <regia>
                                                    <testo>Leonardo Pieraccioni</testo>
                                                </regia>
                                                <attori>
                                                    <attore>
                                                        <testo>Leonardo Pieraccioni</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Ariadna Romero</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Rocco Papaleo</testo>
                                                    </attore>
                                                </attori>
                                            </cast>
                                            <orari>
                                                <orario>
                                                    <testo>16.45</testo>
                                                </orario>
                                                <orario>
                                                    <testo>18.40</testo>
                                                </orario>
                                                <orario>
                                                    <testo>20.35</testo>
                                                </orario>
                                                <orario>
                                                    <testo>22.30</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                        <film>
                                            <titolo_film>
                                                <testo>Il Gatto con gli stivali 3D</testo>
                                            </titolo_film>
                                            <orari>
                                                <orario>
                                                    <testo>16.45</testo>
                                                </orario>
                                                <orario>
                                                    <testo>18.35</testo>
                                                </orario>
                                                <orario>
                                                    <testo>20.30</testo>
                                                </orario>
                                                <orario>
                                                    <testo>22.25</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                        <film>
                                            <titolo_film>
                                                <testo>Il figlio di Babbo Natale</testo>
                                            </titolo_film>
                                            <cast>
                                                <regia>
                                                    <testo>Sarah Smith</testo>
                                                </regia>
                                                <attori>
                                                    <attore>
                                                        <testo>James McAvoy</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Hugh Laurie</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Bill Nighy</testo>
                                                    </attore>
                                                </attori>
                                            </cast>
                                            <orari>
                                                <orario>
                                                    <testo>16.40</testo>
                                                </orario>
                                                <orario>
                                                    <testo>18.30</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                        <film>
                                            <titolo_film>
                                                <testo>Capodanno a New York</testo>
                                            </titolo_film>
                                            <cast>
                                                <regia>
                                                    <testo>Garry Marshall</testo>
                                                </regia>
                                                <attori>
                                                    <attore>
                                                        <testo>Robert De Niro</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Zac Efron</testo>
                                                    </attore>
                                                    <attore>
                                                        <testo>Lea Michele</testo>
                                                    </attore>
                                                </attori>
                                            </cast>
                                            <orari>
                                                <orario>
                                                    <testo>20.20</testo>
                                                </orario>
                                                <orario>
                                                    <testo>22.40</testo>
                                                </orario>
                                            </orari>
                                        </film>
                                    </films>
                                </sala>


as u can see applying xslt the result is not properly correct.
could you help finding the mistake (please) ?

:-)
happy holidays
Milko
Posted: Tuesday, December 27, 2011 8:17:08 PM
Rank: Advanced Member

Joined: 6/28/2011
Posts: 76
Location: Vicenza
it seems to be a case-order problem, but using case-order="lower-first" does'nt solve anything...
is it possible to obtain a case insensitive order ?
vlad
Posted: Wednesday, December 28, 2011 9:12:33 AM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Use lower-case function in select

select="lower-case(titolo_film/testo)"
Milko
Posted: Sunday, January 1, 2012 10:36:22 PM
Rank: Advanced Member

Joined: 6/28/2011
Posts: 76
Location: Vicenza
hi vlad: are you already married ?
:-D

Thanks and good year !

Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.