简体   繁体   中英

XSLT Code for multiple line data into single line

图像描述在这里

As in the picture the address line 1 is in two lines within the field Address Line-1 .

Example, this is how it is now:

Address Line 1: 1234 California street

                   APT 555

When I convert this data into XML its splitting the address into two lines. How to bring this address into single line in XSLT ?

After applying XSLT I want this into single line as following

Column/Field Name as Address Line-1

Address as 1234 California street APT 555

I seems that your source XML has the address split into 2 lines, maybe with some spaces at the beginning of the 2nd line, something like this:

<address>1234 California street
    APT 555</address>

So if you either apply an identity template to such a tag or use <xsl:value-of select="address"/> , the resulting text will also be divided into 2 lines, keeping leading spaces in the 2nd line .

Probably you should use <xsl:value-of select="normalize-space(address)"/> .

Normalize-space function will likely do the job, converting a sequence of internal "white" chars into a single space.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM