Re: [xslt] Question about white space output



On Thu, Apr 10, 2003 at 02:08:03PM +0200, Morus Walter wrote:

 
> 
> If I use 
>  
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>   <xsl:output indent="no" encoding="ISO-8859-1" method="text"/>
>   <xsl:strip-space elements="sequence"/>
> <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>
> </xsl:stylesheet>
> 
> I get
> typedef sequence < sequence < sequence < long >  >  > secuencia2;
> which seems to be what you want (unless you have a problem with two
> blanks).

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?

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
> _______________________________________________



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