Hi sorry to bother you.

I have another problem with XSL file.

I have to sort out the codes in numerical order

the codes have four characters and four numerals

for example,

COMP2100
COMP2400
COMP3410
LAWS2202
LAWS2250

when I just do <xsl:sort select="code" order="ascending" />

it displays above result.

However, I want that to be in 'numerical order' that is

COMP2100
LAWS2202
COMP2250
COMP2400
COMP3410

How do I do this?

Recommended Answers

All 4 Replies

can u send the xml code now

      <xsl:for-each select="nodename">
        <xsl:sort select="substring(., 5, 4)" data-type="number" order="ascending"/>
      </xsl:for-each>

That will work, we substring the node value to only look at the numerical part of it and then sort accordingly.

i am asking xml document not an xsl

That was not a response to your request. I was answering the thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.