By definition the setting method="text" in xsl:output should only output
the contents of the text nodes in the result tree:
"16.3 Text Output Method
The text output method outputs the result tree by outputting the
string-value of every text node in the result tree in document order without
any escaping."
http://www.w3.org/TR/xslt#section-Text-Output-Method
"Jürgen Holly" <ju***********@immorent.at> wrote in message
news:2b**************************@posting.google.c om...
Hi!
I have the following xml-node:
<docu>
<p>Sample: <b>bold</b></p>
<p>and text in <i>italic</i></p>
</docu>
I need to create a text-file, so I set the output-mode to text.
In a docu-node you can write normal text and additionally html-tags.
In the text-file I should output that:
"<p>Sample: <b>bold</b></p><p>and text in <i>italic</i></p>"
i.e. compress text between <docu> and </docu> in a single line.
I wrote this template - but it dont't work. The html-tags are filtered
out and the linebreak is still there.
By definition the setting method="text" in xsl:output should only output
the contents of the text nodes in the result tree:
"16.3 Text Output Method
The text output method outputs the result tree by outputting the
string-value of every text node in the result tree in document order without
any escaping."
http://www.w3.org/TR/xslt#section-Text-Output-Method
Therefore, if you need the element nodes copied, you must node use
method="text".
<xsl:template match="docu">
<xsl:copy-of select="."/>
</xsl:template>
In html-mode the html-tags will be copied.
How can I do this??
You must read all about whitespace nodes processing in xslt.
The above xsl:copy-of in your code copies the subtree with root the current
node ("docu") and this includes all of its whitespace-only descendents.
In case you do not need to process whitespace only nodes in your document,
you can use:
<xsl:strip-space elements="*"/>
This specifies that the whetespace-only text nodes of all elements are to be
striped.
In case you only need to ignore whitespace-only children of specific
elements and presereve the whitespace-only children for others, then you
must explicitly specify the value of the "elements" attribute of
xsl:strip-space as a blank-separated list of element names, whose
children-whitespace-only-text nodes are to be stripped.
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL