[Xitami] GSL &(symbol); expansion feature

Francis Turner xitami@lists.xitami.org
Wed, 21 Nov 2001 16:51:21 +0100


This is more of an FYI than a bug report or question...

I can't see this documented but some experiemntation and subsequent 
source code examination (smt/formio.c - put_textual() line 850 ish) 
shows that Xitami/GSLgen will replace &(symbol); with the actual symbol 
during its symbol expansion if symbol is gt , lt , amp or quot. So any 
xml file with &gt; , &lt; , &amp; or &quot; will ouptut <>&" into stdout 
(or wherevere the output is).

Thus if you have a tag
<From>
Francis Turner &lt;francis.turner@freesbee.fr>
</From>

and the script has a line
From: <a href="mailto:$(->From:)">$(->From:)</a>

the output text is
From: <a href="mailto:Francis Turner 
<francis.turner@freesbee.fr>">Francis Turner 
<francis.turner@freesbee.fr></a>

and not as I would have expected
From: <a href="mailto:Francis Turner 
&lt;francis.turner@freesbee.fr>">Francis Turner 
&lt;francis.turner@freesbee.fr></a>

This is good because you can embed html tags within your XML files e.g.
<Contents>
a line of text with a &lt;href='/'>link to the top&lt;/a> in an XML tag
</Contents>

but leads to some interesting required gymnastics if you want to put the 
sequence &(symbol); on the page yourself to keep the users browser 
happy. Going back to the earlier From tag example - if you want to display
Francis Turner &lt;francis.turner@freesbee.fr>
so that the users browser actually displays the email address the tag 
contents needs to be
<From>
Francis Turner &amp;lt;francis.turner@freesbee.fr>
</From>

Share and Enjoy

Francis

-- 
"Education is when you read the fine print; 
  experience is what you get when you don't." Pete Seeger