开发者

how to trace by carriage return in a string

开发者 https://www.devze.com 2023-03-25 11:28 出处:网络
i m facing small issue my xml which looks like this mentioned as bellow for this i m writting a logic in xslt but i cant able to re开发者_Python百科ach output can any one help me please kindly asap

i m facing small issue my xml which looks like this mentioned as bellow for this i m writting a logic in xslt but i cant able to re开发者_Python百科ach output can any one help me please kindly asap here my XML

  <block4>  
    <tag>
    <name>72</name>
    <value>/BNF/
           FETA/ABNAAFU000000D93--16.560-10/</value>
  </tag>
  </block4>

here my XSL

<xsl:for-each select="block4/tag[name = '72']">
<xsl:value-of  select="concat((concat(substring-before(value,'&#13;'),',')),(substring-after(value,'&#13;'))) "/>
</xsl:for-each>,<xsl:text/> 

output required: /BNF/,FETA/ABNAAFU000000D93--16.560-10/

note : i am trying to get output as such LINE1,LINE2


Well I'm not exactly sure what you're trying to do, but I think a combination of the normalize-space and translate functions are what you want, something like this:

<xsl:for-each select="block4/tag[name = '72']">
    <xsl:value-of  select="translate(normalize-space(value), ' ', ',')"/>
</xsl:for-each>,<xsl:text/>

The normalize-space will turn all whitespace into spaces, and convert multiple spaces into a single space. The translate will turn all the remaining spaces into commas.

0

精彩评论

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

关注公众号