tags:

views:

18

answers:

1

I have a part's list built out in XML and each part is labeled as such:

<division>
<parts>
    <part number="123456     " drawing="123456    " cad="y">
        <attribute>
            <header>Header</header>
            <list>2</list>
        </attribute>
    </part>

And I need to get the data behind the number and drawing attributes without the white space. I tried xsl:strip-space on the specific elements, and across the board, but that only strips the content in between the tags. I unfortunately have no access to the back-end that's producing the XML, so removing the spaces there doesn't look like an option.

+1  A: 

You can use either:

normalize-space()

or

translate(.,' &#9;&#xA;&#xC;', '')

The first will eliminate the leading and trailing whitespace in the string, and will also replace any other (inner) whitespace with a single space.

The second eliminates all whitespace.

Dimitre Novatchev