Removing blank lines in XSLT
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
精彩评论