Re: [xslt] libxslt-0.8 drops text() nodes in identity transform
- From: Daniel Veillard <veillard redhat com>
- To: xslt gnome org
- Subject: Re: [xslt] libxslt-0.8 drops text() nodes in identity transform
- Date: Wed, 25 Apr 2001 10:57:24 -0400
Hum, right, I overlooked the TEXT and CDATA support in xsl:copy
the enclosed patch seems to fix it:
orchis:~/XSLT/tests/general -> xsltproc bug-13-.xsl ../docs/bug-13-.xml
<?xml version="1.0"?>
<some>text</some>
orchis:~/XSLT/tests/general ->
Daniel
On Wed, Apr 25, 2001 at 10:27:33AM -0400, Steve Tinney wrote:
[...]
> applied to this input:
>
> <some>text</some>
>
> produces:
>
> <some/>
>
> It should produce
>
> <some>text</some>
>
> Steve
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: transform.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/transform.c,v
retrieving revision 1.82
diff -c -r1.82 transform.c
*** transform.c 2001/04/22 20:47:02 1.82
--- transform.c 2001/04/25 14:56:42
***************
*** 1294,1299 ****
--- 1294,1324 ----
oldInsert = ctxt->insert;
if (ctxt->insert != NULL) {
switch (node->type) {
+ case XML_TEXT_NODE:
+ case XML_CDATA_SECTION_NODE:
+ /*
+ * This text comes from the stylesheet
+ * For stylesheets, the set of whitespace-preserving
+ * element names consists of just xsl:text.
+ */
+ #ifdef WITH_XSLT_DEBUG_PROCESS
+ if (node->type == XML_CDATA_SECTION_NODE)
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsl:copy: CDATA text %s\n", node->content);
+ else
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsl:copy: text %s\n", node->content);
+ #endif
+ copy = xmlNewText(node->content);
+ if (copy != NULL) {
+ if (node->name == xmlStringTextNoenc)
+ copy->name = xmlStringTextNoenc;
+ xmlAddChild(ctxt->insert, copy);
+ } else {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:copy: text copy failed\n");
+ }
+ break;
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]