xpath - How do I replace sequences of whitespaces by one space but don't trim in XSLT? -
the function normalize-space
removes leading , trailing whitespace , replaces sequences of whitespace characters single space. how can only replaces sequences of whitespace characters single space in xslt 1.0? instance "..x.y...\n\t..z."
(spaces replaced dot readability) should become ".x.y.z."
.
without becker's method, use discouraged character mark:
translate(normalize-space(concat('',.,'')),'','')
note: 3 function calls...
or character repeating expression:
substring( normalize-space(concat('.',.,'.')), 2, string-length(normalize-space(concat('.',.,'.'))) - 2 )
in xslt can declare variable:
<xsl:variable name="vnormalize" select="normalize-space(concat('.',.,'.'))"/> <xsl:value-of select="susbtring($vnormalize,2,string-length($vnormalize)-2)"/>
Comments
Post a Comment