Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Using $.teaser$ in xml

I want to output $.headline$, $.teaser$, and $.abslink$ to an xml file for use elsewhere.  headline and abslink work fine, but teaser doesn't.

If the teaser has more than one sentence, and there is a space between the two sentences, CD puts in a " " to create the space.  XML seems to have trouble with this.

I get the following error message:
Reference to undefined entity 'nbsp'. Error processing resource

Is there any way around this?

raghu ramachandran
Monday, October 21, 2002

please provide more detail about your template and the generated output. I don't think &nbsp is the problem, more likely some unmatched tags. Unmatched are also single html entities, e.g. <BR> should be <br/>

to use in xml, articles it should be in xhtml... and this is not CD1.0's strongest point.

Adriaan van den Brand
Monday, October 21, 2002

The following code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<blog>
{$foreach 5 x in (folder "articles")SortDescendBy .filedDate $}
<article>
<link>http://salsa.bbh.com/news/{$x.abslink$}</link>
<headline>{$x.headline$}</headline>
</article>
{$next$}
</blog>

produces

http://salsa.bbh.com/news/xmlindex.xml

This is ok.

The following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<blog>
{$foreach 5 x in (folder "articles")SortDescendBy .filedDate $}
<article>
<link>http://salsa.bbh.com/news/{$x.abslink$}</link>
<headline>{$x.headline$}</headline>
<teaser>{$x.teaser$}</teaser>
</article>
{$next$}
</blog>

produces

http://salsa.bbh.com/news/xmlteaser.xml

This does not work.

raghu ramachandran
Monday, October 21, 2002

Try wrapping it in a CDATA, e.g.:

<?xml version="1.0" encoding="ISO-8859-1"?>
<blog>
{$foreach 5 x in (folder "articles")SortDescendBy .filedDate $}
<article>
<link>http://salsa.bbh.com/news/{$x.abslink$}</link>
<headline>{$x.headline$}</headline>
<teaser>
<![CDATA[
{$x.teaser$}
]]>
</teaser>
</article>
{$next$}
</blog>

Joel Spolsky
Monday, October 21, 2002

It's happening because you have two spaces between those sentences. Whenever you type two spaces, CityDesk turns one of them into a &nbsp; so that it will render as two spaces in HTML.

Try editing the teaser for that article, deleting both spaces, and typing a single space.

Darren Collins
Monday, October 21, 2002

Thanks for all the help.

The CDATA solves the xml problem, but it puts &nbsp; in the text.

I finally had to go back and edit all the teasers to have one space after a period.

There are multiple authors to this blog, and many of us were taught to put two spaces after a period. While the CMoS has changed their opinion, old habits die hard.

http://www.press.uchicago.edu/Misc/Chicago/cmosfaq/cmosfaq.OneSpaceorTwo.html

Thanks again to all.
R.

raghu ramachandran
Tuesday, October 22, 2002

*  Recent Topics

*  Fog Creek Home