[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] 'Problems getting '&' output instead of '&'.
Subject: [xsl] 'Problems getting '&' output instead of '&'. From: "Edward L. Knoll" <ed.knoll@xxxxxxxxxxxxxx> Date: Mon, 06 Jan 2003 09:52:37 -0700 |
I have a XSL stylesheet which is generating HTML targeted at a old server which apparently does not recognize '&', 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 '&' 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 '&' 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.xmlScriptProcessor?actionValue=EMAIL&pageNum=1&sequenceID=5075890"></html:a></html:td> <html:td><html:a href="HTTP://GNSLLOC.PROD.FEDEX.COM/servlet/GNSL.xmlScriptProcessor?actionValue=DOWNLOAD&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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [xml-doc] Newbie- Flow Di, Francis Norton | Thread | RE: [xsl] 'Problems getting '&' out, Julian Reschke |
RE: [xsl] how to get < sign in outp, Passin, Tom | Date | Re: [xsl] types of input..., Jeni Tennison |
Month |