开发者

Removing blank lines in XSLT

开发者 https://www.devze.com 2023-01-07 05:59 出处:网络
I\'m using: <xsl:template match=\"material_id | location_code\"></xsl:template> To get rid of elements in the source XML called material_id and location_code, but whitespace lines remai

I'm using:

<xsl:template match="material_id | location_code"></xsl:template>

To get rid of elements in the source XML called material_id and location_code, but whitespace lines remain, leaving an output XML something like:

<entries>
    <Identity>开发者_高级运维conflab1</Identity>


    <price>24.36</price>
    <pricedate>15-Jul-2010 13:35:18 UTC</price_date>
</entries>

How should I stop it from leaving the newline characters?

Thanks,

Matt


Try:

<xsl:strip-space  elements="*"/>

at the top of the document.


You should combine strip-space and preserve-space together, so that you strip all spaces except those you define, eg:

<xsl:preserve-space  elements="Identity price price_date"/>
<xsl:strip-space  elements="*"/>

Source: https://www.w3schools.com/xml/ref_xsl_el_strip-space.asp

0

精彩评论

暂无评论...
验证码 换一张
取 消