Re: How should I output "<", "&" ?

Subject: Re: How should I output "<", "&" ?
From: Chris Maden <crism@xxxxxxxxxxx>
Date: Wed, 28 Oct 1998 15:16:17 -0500 (EST)
[Kenneth Li]
> <xsl:for-each select="LMP/STOCKQUOTERS">
> <COL>
> <VAR NAME="DEST"
> VALUE="GetQuoteDetail.puml?FUNCTION=GetQuoteDetail&STOCK=MSFT
> &EXCHANGE=NASDAQ"/>
> </COL>
> </xsl:for-each>
> 
> The question is:
> 
> When I use James Clark's XT&XP to parse the file, I am told that I
> can not use "<", ">" and "&".

That is correct.

> But following is OK:
> 
> xsl:for-each select="LMP/STOCKQUOTERS">
> <COL>
> &lt;VAR NAME="DEST"
> VALUE="GetQuoteDetail.puml?FUNCTION=GetQuoteDetail&amp;STOCK=MSFT
> &EXCHANGE=NASDAQ"/&gt;
> </COL>
> </xsl:for-each>
> 
> But I really want to use the first one.

Why?  Do you have an entity called STOCK or EXCHANGE?  If not, then
that's *not* what you want to use.  It's not a matter of opinion;
&STOCK is an SGML reference to the entity STOCK (it's not even legal
XML if the entity exists, because it would need a semicolon).

HTML browsers' acceptance of the first form is a bug, not a feature,
and the use of ampersands to separate query parameters has been
deprecated since before HTML 2.0 for precisely this reason.

-Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread