xsl-list
[Top] [All Lists]

[xsl] Sorting Hex v. Decimal

2015-04-01 19:25:04
Hi all,

As a test for something a bit more complex, I am trying to do a simple sort of 
names, some of which start with character entity references:

<root>
    <author><surname>&#x00D6;born</surname></author>
    <author><surname>Jones</surname></author>
    <author><surname>Edwards</surname></author>
    <author><surname>Osgood</surname></author>
    <author><surname>&#x00C8;meraldo</surname></author>
    <author><surname>Smith</surname></author>    
</root>

Using this transform:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="1.0">
    <xsl:output encoding="ASCII"/>
    <xsl:template match="/">
        <html>
            <body>
                <h1>Author List</h1>
                <xsl:for-each select="//author">
                    <xsl:sort select="surname"/>
                        <p>
                         <xsl:value-of select="surname"/>
                       </p>
                </xsl:for-each>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

I want two things, the entities to come out in hex and the sort to treat 
characters with diacriticals as equivalent to same characters without 
diacriticals. So, e with an acute accent should be sorted equivalently with e 
without an acute accent. 

Using Oxygen, the sort works as intended when the transformer is Saxon 6.5.5, 
but the entities come out as decimal. 

<html>
   <body>
      <h1>Author List</h1>
      <p>Edwards</p>
      <p>&#200;meraldo</p>
      <p>Jones</p>
      <p>&#214;born</p>
      <p>Osgood</p>
      <p>Smith</p>
   </body>
</html>

If I change the transformer to Saxon 9.4.0.4, I get hex, but all the author 
names that start with a character entity reference get stuck at the end.

<html>
   <body>
      <h1>Author List</h1>
      <p>Edwards</p>
      <p>Jones</p>
      <p>Osgood</p>
      <p>Smith</p>
      <p>&#xc8;meraldo</p>
      <p>&#xd6;born</p>
   </body>
</html>

Like anyone else, I'd like to have my cake and eat it too. But, how? 

Thanks,
Charles 
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Sorting Hex v. Decimal, Charles O'Connor charles(_dot_)oconnor(_at_)sheridan(_dot_)com <=