Re: [xslt] Question about white space output



On Thu, Apr 10, 2003 at 01:41:49PM +0200, Le grande pinguin wrote:
> On Thu, Apr 10, 2003 at 01:34:42PM +0200, srperan@sherlock.dif.um.es wrote:
> > Well, maybe I did not explain correctly. Excuse me, but my english is
> > not very good.
> 
> No need to apologize, o lot of us aren't native speakers.
> But (IMHU) Daniel's main point was: be precise in what you provide
> as context information. Best: provide a small (but complete!, see below)
> sample case that demonstrates the problem (input, stylefile, output,
> expected output). Also, since this is _not_ a "general tipps and
> help for XSLT" mailing list: have you tested your data with other
> XSLT processors and do they give different output? If not there's a good
> chance that your XSLT is incorrect.
>

I know this list is not a help list, but I am two days with this and I
need to solve this, so I though I can ask here.

I have tried with xalan, but I obtain a parse error (This error is
strange because I obtain the error in a line without errors, I have seen
that). My xsl and xml filer are correct, I am sure.


> > I have a XML file, and I use libxslt to process it. The output is a TEXT
> > file.
> > I want to insert white spaces into the output TEXT file.
> > I am not talking about a libxslt bug. I am just asking how to do it.
> > 
> > I have been reading past messages and I have seen similar questions, but
> > I think those questions was not regarding a TEXT output.
> > I will be more explicit. We have this XML piece :
> > 
> > 
> > <sequence name="secuencia2">
> >   <sequence>
> >     <sequence type="long">
> >     </sequence>
> >   </sequence>
> > </sequence>
> > 
> > 
> > and using this template, we want to obtain a TEXT output:
> 
> This is _not_ enough! There's the stylesheet tag missing. Even more
> important: what's the value of the 'method' attribute of the
> 'xsl:output' tag (you _did_ use a 'method' attribute, or?).
> 

Here is the header of the XSL file :

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >
 <xsl:output method="text" />
   <xsl:preserve-space elements="*"/>
     <xsl:template match="/">






> > <xsl:template match="sequence">
> > <xsl:choose>
> > 	<xsl:when test="@name">typedef sequence &lt;<xsl:apply-templates
> > 	select="sequence"/><xsl:if test="@max">,<xsl:value-of
> > 	select="@max"/></xsl:if> &gt; <xsl:value-of
> > 	select="@name"/>;</xsl:when>
> > 		<xsl:when test="@type">sequence &lt;<xsl:value-of
> > 		select="@type"/><xsl:if test="@max">, <xsl:value-of
> > 		select="@max"/></xsl:if> &gt; </xsl:when>
> > 			<xsl:otherwise>sequence &lt;<xsl:apply-templates
> > 			select="sequence"/><xsl:if test="@max">,
> > 			<xsl:value-of select="@max"/></xsl:if>&gt;
> > 			</xsl:otherwise>
> > 			</xsl:choose> <xsl:value-of select="@nombre"/>
> > </xsl:template>
> > 
> > 
> > When we process this, we obtain this output :
> > 
> > typedef sequence < sequence < sequence < long >>>secuencia2;
> > 
> > When we need :
> > 
> > typedef sequence < sequence < sequence < long > > > secuencia2;
> > 
> > Now, the question is, how can I insert the white spaces between symbols?
> > symbols?
> 
> 
> Hmm, hmmm:
>  </xsl:if> &gt; </xsl:when>
> 
> There's whitespace at the beginning and end of the text node ....
> Depending on your output method that's dangerous. How about:
> 
>  </xsl:if><xsl:text>  </xsl:text>&gt;<xsl:text>  </xsl:text></xsl:when>
> 
> 

It doesnt work :(

> hth Ralf Mattes
> > 
> > Thank You.
> > 
> > Jose Luis Peran
> > 
> > 
> > 
> > 
> > 
> > Daniel Veillard wrote:
> > > On Thu, Apr 10, 2003 at 11:44:16AM +0200, srperan@sherlock.dif.um.es wrote:
> > > > Hello. I am using libxslt to process a XML file and output a plain text
> > > > file and I need to insert white spaces. I have tried with <xsl:text>
> > > > &#160; </xsl:text> but this returns a symbol, not whitespace.
> > > 
> > >  What symbol ? This is probably equivalent to the &#160;
> > > 
> > > > I have read that this is an encoding problem
> > > 
> > >   Where ? how ? by whom ? Pointer please ! If someone think there is a bug
> > > in libxslt, he better state it clearly and give a full example, you
> > > included ! Have you read http://xmlsoft.org/XSLT/bugs.html ? If yes
> > > why didn't you follow the guidelines 
> > >   "send the command showing the error as well as the input and stylesheet"
> > > 
> > > > but I can tell to libxslt that the
> > > > output must be ISO-8859-1.
> > > 
> > >  Your report is terribly unprecise. You "can" or you "did" ask for 
> > > ISO-8859-1 ? 
> > >  You don't even tell what kind of output you asked for, xml ? html ? text ?
> > > I doubt it's a bug, on the other hand you sound very confused. And your
> > > report contains no way to check what you're trying to argue about, nor
> > > even to try to get an idea of what exactly is the problem. As a result
> > > we are both loosing time :-( . Follow the guidelines, they are there for
> > > good reasons !
> > > 
> > > Daniel
> > > 
> > > -- 
> > > Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
> > > veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
> > > http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
> > > _______________________________________________
> > > 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
> _______________________________________________
> 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]