After transforming XSL to XML, how to remove white space from attribute or Node data?

I have a parts list built 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 data behind the numbers and drawing attributes without a space. I've tried xsl: strip-space on specific elements and across the board, but this only strips content between tags. Unfortunately I don't have access to the background content that the XML produces, so removing whitespace there doesn't seem like an option.

+2


a source to share


1 answer


You can use either:

normalize-space ()

or



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

The former eliminates leading and trailing whitespace in the string, and also replaces any other (internal) whitespace with a single space.

The second one excludes all spaces.

+1


a source







All Articles