[xslt] Not expanding entities



I need an xslt processor that passes character entities in the 
stylesheet on unexpanded into the output, so I started poking around in 
the source to xsltproc.  Lo and behold, I found the line:

/*
  * Replace entities with their content.
  */
xmlSubstituteEntitiesDefault(1);

so I tried changing it to a 0.  Unfortunately, this caused xsltproc to 
choke on my stylesheet with the message:

xsltParseTemplateContent: xslt:text content problem

I tracked this down to xslt.c in xsltParseTemplateContent() where it is 
parsing the xslt:text nodes:

if ((text->type != XML_TEXT_NODE) &&
      (text->type != XML_CDATA_SECTION_NODE)) {
      xsltPrintErrorContext(NULL, style, cur);
      xsltGenericError(xsltGenericErrorContext 
"xsltParseTemplateContent: xslt:text content problem\n");
     style->errors++;
      break;
}

Is there any reason why entity ref nodes aren't allowed here?  I tried 
adding them to the test and that got rid of the error, but it didn't 
make xsltproc pass the entities.  My guess is that they would need to be 
processed differently in the code that follows this check.  Perhaps 
rather than using its children it would just use its content?

Any help would be greatly appreciated.

Thanks,
Brent


-------------------------------------------------------------------------

"The programmer, like the poet, works only slightly removed from pure
  thought-stuff.  He builds his castles in the air, from air, creating
  by exertion of the imagination.  Few media of creation are so
  flexible, so easy to polish and rework, so readily capable of
  realizing grand conceptual structures."
                         -- Frederick Brooks, Jr., The Mythical Man Month




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]