0

When running like this

$ xmlstarlet sel -t -v '//department[@id="123879"]/user/@name' -n file.xml 

it returns only the first user's name T:106603 and an empty line.

Here is the related XML code inside a file called file.xml (for testing purposes):

<config name="department" version="1.11">
     <xad version="1459" nocheckoutver="1701">
        <!-- ... -->
        <department name="/fighters" id="123879" group="channel" case="none" use="no">
            <replication region="4334">
                <options index_name="index.html" listing="0" sum="no" allowed="no" />
                <!-- ... -->
            </replication>
            <target prefix="http" suffix=".net" />
            <!-- ... -->
            <user name="T:106603" />
            <user name="T:123879" />
            <user name="test" />
            <user name="ele::123456" />
            <user name="company-temp" />
            <user name="companymw2" />
            <user name="bird" />
            <user name="coding11" />
            <user name="plazamedia" />
            <allow go="123456=abcdefghijklmnopqrstuvwxyz" />
            <!-- ... -->
        </department>
        <department name="/dancers" id="876543" group="floor" case="yes" use="no">
            <!-- ... -->
        </department>
    <!-- ... -->
    </xad>
</config>
npostavs
  • 4,877
  • 1
  • 24
  • 43
m_s
  • 37
  • 4
  • This is the same problem as [Why doesn't xmlstarlet select all nodes?](http://stackoverflow.com/q/6390807/319698) Short answer is updgrade to 1.3.0+ – npostavs Aug 12 '14 at 05:00
  • Looks like this is the problem as my company is using an old version (1.0.1). – m_s Aug 12 '14 at 15:25

0 Answers0