[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

'Problems getting '&' output instead of '&'.

Subject: 'Problems getting '&' output instead of '&'.
From: "Edward L. Knoll" <ed.knoll@xxxxxxxxxxxxxx>
Date: Mon, 06 Jan 2003 09:52:37 -0700
html td disable
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.xmlScriptProcessor?actionValue=EMAIL&amp;pageNum=1&amp;sequenceID=5075890"></html:a></html:td>
      <html:td><html:a
href="HTTP://GNSLLOC.PROD.FEDEX.COM/servlet/GNSL.xmlScriptProcessor?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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.