Trevor,
You describe two separate problems:

1. no whitespace on output: what you need is <xsl:output indent="yes"/> in your 
template, _BUT_
this feature is not supported yet. Should be implemented in the very next release. For 
now, insert
<xsl:text> </xsl:text> or <xsl:text>&#160;</xsl:text> (as you do) to add a space or
<xsl:text>&#010;</xsl:text> to break lines. Sorry for the inconvenience.

2. the "funny character (Â)" seems to be your editor/viewer interpretation of the utf-8
representation of #160; Try to open your output text in a viewer (e.g. any browser) 
supporting
utf-8. You should try to specify another output encoding: <xsl:output ... 
encoding="iso-8859-1"/>

Regards,
Petr

Trevor Leffler wrote:

> What is the spec for whitespace in an XSL document?  sabcmd prints my
> fields all squished together, so I tried adding a &nbsp; and a funny
> character (Â) appears.
>
> Here are some snippets:
>
> ---XML---
> <?xml version="1.0" encoding="UTF-8"?>
>
> <schema table="blackbook">
>         <field name="ID" type="int(10) unsigned" default="0" null="no"
> auto_increment="yes"/>
>         <field name="fname" type="varchar(30)" default="" null="no"/>
>         <field name="lname" type="varchar(30)" default="" null="no"/>
>         <field name="phone" type="varchar(20)"/>
>         <field name="email" type="varchar(30)"/>
>         <key field="ID" type="primary key"/>
> </schema>
>
> ---XSL snippet---
>         <xsl:template match="field">
>                 <xsl:value-of select="@name"/> <xsl:value-of select="@type"/>
>                 <xsl:if test="@default"> DEFAULT '<xsl:value-of select="@default"/>'
> </xsl:if>
>                 <xsl:if test="@null = 'no'"> NOT NULL </xsl:if> ,
>         </xsl:template>
>
> ---sabcmd output snippet---
> IDint(10) unsigned DEFAULT '0'  NOT NULL  ,
>
> Notice how "ID" and "int(10)" have no whitespace.  Here the output when
> I use &nbsp;:
>
> IDÂ int(10) unsigned DEFAULT '0'  NOT NULL  ,
>
> Any suggestions on how I put whitespace in there?  I've attached the
> files for your perusal.
>
> Just for comparison, Xalan doesn't honor the whitespace, but does output
> the &nbsp; correctly.  And xslt-parser honors the whitespace and outputs
> &nbsp; literally.
>
> Thanks,
> --
> Trevor Leffler, Software Developer
> PETTT / Ed-Tech Development Group
> University of Washington
> (206) 616-3406 / OUGL 230, Box 353080
>
>   ------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
>
> <schema table="blackbook">
>         <field name="ID" type="int(10) unsigned" default="0" null="no" 
>auto_increment="yes"/>
>         <field name="fname" type="varchar(30)" default="" null="no"/>
>         <field name="lname" type="varchar(30)" default="" null="no"/>
>         <field name="phone" type="varchar(20)"/>
>         <field name="email" type="varchar(30)"/>
>         <key field="ID" type="primary key"/>
> </schema>
>
>   ------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE xsl:stylesheet [
>         <!ENTITY nbsp "&#160;">
> ]>
>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>         <xsl:output method="text" omit-xml-declaration="yes"/>
>
>         <xsl:template match="schema">
>                 create table <xsl:value-of select="@table"/> {
>                         <xsl:apply-templates/>
>                 };
>         </xsl:template>
>
>         <xsl:template match="field">
>                 <xsl:value-of select="@name"/>&nbsp;<xsl:value-of select="@type"/>
>                 <xsl:if test="@default"> DEFAULT '<xsl:value-of select="@default"/>' 
></xsl:if>
>                 <xsl:if test="@null = 'no'"> NOT NULL </xsl:if> ,
>         </xsl:template>
>
>         <xsl:template match="key">
>                 <xsl:value-of select="@type"/> (<xsl:value-of select="@field"/>),
>         </xsl:template>
> </xsl:stylesheet>

--
Petr Cimprich
Ginger Alliance
www.gingerall.com


Reply via email to