Re: [xslt] Question about white space output



On Thu, Apr 10, 2003 at 06:02:10PM +0200, Le grande pinguin wrote:
> On Thu, Apr 10, 2003 at 05:59:19PM +0200, srperan@sherlock.dif.um.es wrote:
> > 
> > Yes, that is the output I obtain with xsltproc, but when I use my
> > program, it returns an incorrect output. Maybe I have some mistake in my
> > parsing code, but I dont see it.
> > 
> > My code just check xml file with a dtd, parse file and process the file
> > with libxslt. I dont see where can be the problem.
> > Can you help me, please?
> 
> Not without the neccessary information. This is the first time you
> tell us that there is a custom program involved. Where's the code?
> Can you reduce the code to a minimal example that exposes the problem?
> How actually do you serialize the document (i _assume_ we are talking
> about an xmlDocPtr here, or?).
> 
> ralf mattes

I really apologize, my brain is too hot today after too many hours
thinking about it and I dont say you important info. Please, forgive me.

This is the basic code for the parsing :
int XSLTProcess::convert() {
  // process the input file and get the converted file through stdout

 xsltStylesheetPtr cur;
 xmlDocPtr doc, res;
 const char *params[16 + 1];

 params[0] = NULL;



 //Read the stylesheet
   cur = xsltParseStylesheetFile(inputXSLFile);

 //Get the xmlDoctr
  doc = inputXMLTree.getXMLDoc();

 //  if (cur == NULL)
 //    cout << "hola mundo\n\n";

 //Apply stylesheet
  res = xsltApplyStylesheet(cur, doc, params);

 //and save the output file
  xsltSaveResultToFile(stdout, res, cur);
}
			      

I think you see the basic source. Itīs easy to understand.

The main function, creates a XSLTProcess instance and calls to convert.

When creating the XSLTProcess instance, it creares a XMLTree instance
with the following constructor :

XMLTree::XMLTree(char *xmlfile)

  throw ( XMLDocumentException )
  {

  char *dtdfile = "./xmlfiles/dtdidl.dtd";
  //Create a XMLTree object that contain a sintax tree of xmlfile

  doc = xmlParseFile(xmlfile);

  //Validate the xml file with the dtd file
   if ( !ValidateFileWithDTD ( dtdfile ) )
       throw XMLDocumentException("The XML document isn't
	correct.\n");

   if (doc == NULL)     //if doc == NULL the document is
  not correct
      throw XMLDocumentException("I can't parse the XML
      document");

        root = xmlDocGetRootElement(doc);

 };

 The function ValidateFileWithDTD just do that.

 Itīs simple, and I dont see the problem.

 Lots of thanks again, and again, forgive me

> > Thanks
> > Jose Luis Peran
> > 
> > > 
> > > If you didn't specify ISO-8859-1 output encoding it's no surpise that
> > > you found something like '? ' for nbsp since the default encoding is
> > > utf8 and that's nbsp's utf8 represantation.
> > > 
> > 
> > I specify ISO-8859-1 encoding, so this is not the problem
> > 
> > > So it's just adding the WS to the text in the stylesheet apropiatly.
> > > (And perhaps knowing that pure whitespace between elements should be
> > > put into <xsl:text>...</xsl:text>; otherwise it's removed).
> > > 
> > 
> > I have added <xsl:text>...</xsl:text> and it doesnt correct the problem.
> > 
> > > HTH
> > > 	Morus
> > > _______________________________________________
> > _______________________________________________
> > xslt mailing list, project page http://xmlsoft.org/XSLT/
> > xslt@gnome.org
> > http://mail.gnome.org/mailman/listinfo/xslt
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/
> xslt@gnome.org
> http://mail.gnome.org/mailman/listinfo/xslt



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