Altova Mailing List Archives


RE: how to include an ampersand in an html href using xt and xsl?

From: "John Sidlo" <jsidlo@------------->
To:
Date: 1/18/2000 6:16:00 AM
Eric, thanks for your response. You've confirmed my suspicions/fears.

To the XSL community:
In my opinion this is a flaw in the xslt specification. Most (all?)
existing servers use the ampersand in query string to separate
parameters, and the xslt spec expressly forbids generating an ampersand
in an attribute (see section 16.4 of XSL Transformations).  While it is
fine for the xslt specification to by default require HTML 4.0
conformance, I believe it should allow 'disable-output-escaping="yes"'
within an attribute, especially when so many servers and CGI
implementations require it.

It seems to me the only choice I have is to post-process the html output
string to generate href's with ampersand!

I hasten to add that if I'm wrong about this, I'd love to be corrected
(even chastised)!


> -----Original Message-----
> From: Eric van der Vlist [mailto:vdv@xxxxxxxxxxxx]
> Sent: Tuesday, January 18, 2000 2:58 AM
> To: xsl-list@xxxxxxxxxxxxxxxx; jsidlo@xxxxxxxxxxxxx
> Subject: Re: how to include an ampersand in an html href using xt and
> xsl?
>
>
> John,
>
> This (<a href="foo&amp;bar">xxx</a>) is conform to the HTML 4.0
> recommendation (see B.2.2,
> http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2 ) :
>
> > For example, to use the URI "http://host/?x=1&y=2" as a
> linking URI,
> > it must be written <A href="http://host/?x=1&#38;y=2"> or
> > <A href="http://host/?x=1&amp;y=2">.
>
> Eric
>
> Eric van der Vlist wrote:
> >
> > Ooops, sorry,
> >
> > It's producing "<a href="foo&amp;bar">xxx</a>" !
> >
> > Sorry
> >
> > Eric
> >
> > Eric van der Vlist wrote:
> > >
> > > Hi John,
> > >
> > > ---------------
> > > <xsl:template match="/">
> > > <a>
> > >  <xsl:attribute name="href">foo&amp;bar</xsl:attribute>
> > > </a>
> > > </xsl:template>
> > > ---------------
> > >
> > > Is just working fine (tested against XT) !
> > >
> > > Hope this helps.
> > >
> > > Eric
> > >
> > > John Sidlo wrote:
> > > >
> > > > I'm trying to generate an href like...
> > > >
> > > > <a href="foo&bar">xxx</a>
> > > >
> > > > using xsl similar to...
> > > >
> > > > <a>
> > > >  <xsl:attribute name="href"><xsl:text
> > > > disable-output-escaping="yes">foo&bar</xsl:text>
> > > >  </xsl:attribute>
> > > > </a>
> > > >
> > > > and a variety of permutations on this theme.
> > > >
> > > > Section 16.4 of XSLT "Disabling Output Escaping" seems
> to say that
> > > > putting ampersands in attributes is flat-out illegal!
> ("Thus, it is an
> > > > error to disable output escaping for an ... xsl:text
> element that is
> > > > used ot generate the string-value of a ... attribute node")
> > > >
> > > > But & is a common character in href's.
> > > >
> > > > I must be missing something somewhere.
> > > >
> > > > Thanks in advance for any suggestions.
> > > >
> > > >  XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
> >
> > --
>
> ----------------------------------------------------------------------
--
> > Eric van der Vlist
Dyomedea
> >
> > http://www.dyomedea.com
http://www.ducotede.com
>
> ----------------------------------------------------------------------
--
>
> --
> ----------------------------------------------------------------------
--
> Eric van der Vlist
Dyomedea
>
> http://www.dyomedea.com
http://www.ducotede.com
> ----------------------------------------------------------------------
--

--
------------------------------------------------------------------------
Eric van der Vlist                                              Dyomedea

http://www.dyomedea.com                          http://www.ducotede.com
------------------------------------------------------------------------


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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.