Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to manipulate XML data with XMLStarlet for translation purposes as asked in Translate text nodes of GraphML XML (CAS)? but although the nodes I am trying to read are returned, there is whitespace/newlines returned. Sample XML can be found in the other question and the program call is as follows:

xml sel --noblanks --text --template --nl --value-of "//y:NodeLabel" --value-of "//y:EdgeLabel" my.graphml

resulting in

The node's text
          The edge's text

(... represents a blank line)

I would like an explanation of what is happening and whether the result is to be expected or if this is caused by XMLStarlet. A fixed program call would be appreciated, but of course alternative programs or - if neccessary - filtering the blank lines would be acceptable as well (grep/sed/awk, CMD).

share|improve this question
xmlstarlet sel -T -t -v "//node/item" file.xml

and it outputs the content of


as text without additional whitespace.

share|improve this answer

I still don't know but I solved the task with Python and lxml, which does not capture whitespace in a node's text member.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.