У меня есть xml:
<node1>
some text here
<newline/>
and some text here.
</node1>
xml генерируется третьей стороной, поэтому он не может его изменять. Я просто хочу скопировать текст и игнорировать <newline/>
. В настоящее время я получаю следующую информацию:
some text here<newline/>and some text here
Хотя я хочу этот вывод, заменив тег newline пробелом:
some text here and some text here
Пожалуйста помоги. Благодарю!
Используйте этот XSLT 1.0;
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="node1">
<xsl:value-of select="normalize-space()" />
</xsl:template>
</xsl:stylesheet>
Это даст вам,
some text here and some text here.