RE: [xsl] 'Problems getting '&' output instead of '&'.

Subject: RE: [xsl] 'Problems getting '&' output instead of '&'.
From: "Julian Reschke" <julian.reschke@xxxxxx>
Date: Mon, 6 Jan 2003 18:33:07 +0100
Leaving the question of whether to d-o-e or not to d-o-e aside for a moment:

1) Are you 100% (!!) sure that you have a user agent that doesn't correctly
parse "&amp;" inside attribute values? Hint: you may want to check with
static content. If the answer is yes, report a bug against that client.

2) It seems that you want to work around a possible client bug by sending
malformed HTML to *all* clients. I think this is an extremely bad idea. It
may "fix" the issue with one broken client, but may cause different issues
with conforming clients. Is this really what you want?

Julian

--
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Edward L.
> Knoll
> Sent: Monday, January 06, 2003 5:53 PM
> To: XSL Post
> Subject: [xsl] 'Problems getting '&' output instead of '&amp;'.
>
>
> I have a XSL stylesheet which is generating HTML targeted at a old
> server which apparently does not recognize '&amp;', because we're having
> problems getting  parameters passes to a servlet and the only thing
> we've been able to come up with seems to be that we have '&amp;' in the
> URL instead of '&'.  I've been though several of the old threads related
> to disable-output-escaping and issues with ampersand and have yet to
> find something that works.
>
> I suspect my initial problem is that I have variables which represent
> common content which is output multiple times during processing.  Part
> of this common content are these URLs.  Given what I've read, the reason
> I'm not successful in the 'disable-output-escaping' is because the
> variable represents a results-tree-fragment and the
> disable-output-escaping won't work unless I was "serializing to
> output".  If someone could confirm this I'd appreciate it.
>
> It's my second problem which is really bothering me.  We were doing our
> XML to HTML transformation in two passes: XML to XHTML, then XHTML to
> HTML (now being merged into a single pass for performance reasons).  The
> second pass transformation was a very simple transformation to remove
> the "html:" namespace prefixes from the tags and to have the XSLT
> processor output HTML instead of XML.  I modified the templates in this
> second stage transformation to disable-output-escaping when I output
> element attributes.  I would have thought this would cause the '&amp;'
> terms from the input XHTML to be transformed to '&' in the output HTML;
> it's not happening and I'm hoping someone can give me an explanation
> why.  I need a more complete understanding of when
> disable-output-escaping works and when it doesn't.  Note that I know the
> XSLT processor I'm using (Xalan C++ 1.4) "works", because I have another
> stylesheet which uses it successfully.
>
> Thanks,
> Ed Knoll
>
> p.s. Those with the "disable-output-escaping" chip on their shoulder
> leave the sermonizing behind.  I'm doing real work in the real word
> (e.g. in much less than ideal circumstances).
>
>
> ----- XHTML to HTML style sheet
> ---------------------------------------------------
>
> <xsl:template match="/">
>    <xsl:apply-templates />
> </xsl:template>
>
> <xsl:template match="html:*">
>    <xsl:element name="{local-name()}">
>       <xsl:for-each select="@*">
>          <xsl:attribute name="{local-name()}">
>             <xsl:value-of select="." disable-output-escaping="yes" />
>          </xsl:attribute>
>       </xsl:for-each>
>       <xsl:apply-templates />
>    </xsl:element>
> </xsl:template>
>
> <xsl:template match="comment()">
>    <xsl:comment><xsl:value-of select="."/></xsl:comment>
>    <xsl:value-of select="$LineBreak" />
> </xsl:template>
>
>
> <xsl:template match="*|@*|text()">
>    <xsl:copy>
>       <xsl:apply-templates />
>    </xsl:copy>
> </xsl:template>
>
>
> ------ An (edited) sample input example.
>
> <html:table>
>    <html:tr>
>       <html:td><html:a target="newwin"
> onclick="HTTP://GNSLLOC.PROD.FEDEX.COM/servlet/GNSL.xmlScriptProce
> ssor?actionValue=EMAIL&amp;pageNum=1&amp;sequenceID=5075890"></htm
> l:a></html:td>
>       <html:td><html:a
> href="HTTP://GNSLLOC.PROD.FEDEX.COM/servlet/GNSL.xmlScriptProcesso
> r?actionValue=DOWNLOAD&amp;sequenceID=5075890"></html:a></html:td>
>    </html:tr>
> </html:table>
>
>
> --
> Edward L. Knoll   Phone (work)     : (719)484-2717
>                   e-mail (work)    : ed.knoll@xxxxxxxxxxxxxx
>                   e-mail (business): eknoll@xxxxxxxxxx
>                   e-mail (personal): edward@xxxxxxxxxxx
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread