Sort list item by it's value

Sort list item by it's value

So if I have a list like this

  1. <ul>
  2. <li>2</li>
  3. <li>4</li>
  4. <li>1</li>
  5. <li>3</li>
  6. </ul>

How can I sort them so they end up like:

  1. <ul>
  2. <li>1</li>
  3. <li>2</li>
  4. <li>3</li>
  5. <li>4</li>
  6. </ul>
?