[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] generating ampersand for html "a href="
Subject: RE: [xsl] generating ampersand for html "a href=" From: Robert Gretta <robert.gretta@xxxxxxxx> Date: Wed, 31 Jan 2001 16:38:27 -0600 |
i am but a simple caveman. i got on this bent after it, "&", didn't 'seem' to work in Netscape... but it did in IE... now it 'seems' to be working in Netscape... which is great. (wonder what i was doing wrong...) thanks a bundle. -----Original Message----- From: Clapham, Paul [mailto:pclapham@xxxxxxxxxxxxx] Sent: Wednesday, January 31, 2001 3:37 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] generating ampersand for html "a href=" I hear there's nothing wrong with having & in your link. Does it not work in your browser? Try it. PC2 -----Original Message----- From: Robert Gretta [mailto:robert.gretta@xxxxxxxx] Sent: January 31, 2001 13:19 To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx' Subject: [xsl] generating ampersand for html "a href=" Hello, I've been using xsl about a month and i've come across a case that I wish to generate an html link that looks like. <a href="page?param=val¶m2=val2> I thought that this would be a pretty basic thing. And i have 2 xsl books and various resources but have yet to find a clear answer on how to format such a monster without it getting hairy. So, I've just broken down and decided to ask. I've tried many things to get the "&" to come out not as an "&" but the only thing that succeeds is xsl:value-of with disable-output-escaping. interestingly i have no problem generating <% symbols. here is a code snippet that will better describe my dilemma. <xsl:output method="html" /> <!-- note that output method is HTML --> <xsl:variable name="aand"><![CDATA[&]]></xsl:variable> <xsl:variable name="jsp-begin"><![CDATA[<% ]]></xsl:variable> ... <a href="{$jsp-begin} {$aand}" /> ... the output is: <a href="<% &" /> but i want <a href="<% &" /> I cannot understand why the "<%" comes through and the "&" gets translated... unless this is an Xalan problem. I had hoped that setting the output method=html would not translate the & in a CDATA statement but hey, what do i know? I had created a template to format the href and passed the href in as a parameter when i noticed this quirk. <xsl:template name="format-href"> <xsl:param name="href" ></xsl:param> <a href="$href" /> </xsl:template> the output is: <a href="<% &" /> the way to fix the template is something like the following... which seems like overkill. <xsl:template name="format-href"> <xsl:param name="href" ></xsl:param> <![CDATA[<a href="]]><xsl:value-of select='$href' disable-output-escaping="yes"/><![CDATA[/>]]> </xsl:template> the output is <a href="<%&/"> which is still wrong... or i consider it to be wrong since i think that the CDATA sections should protect the characters from being translated. Q: Is there a better way to build an href and pass it around (xsl:call-template... xsl:with-param) without it being translated? Q: Is there a way to tell the processor not to translate (escape) the CDATA sections? Q: Should I be using a different output method? Q: Should I be using the "cdata-section-elements" attribute of "xsl:output" ? Any help would be appreciated. Thanks, Bobby XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] generating ampersand for , Clapham, Paul | Thread | [xsl] XSLTUK conference/tutorial: l, Sebastian Rahtz,,, |
RE: [xsl] Paradigm clash between XM, Benjamin Franz | Date | RE: [xsl] XSLT and Unicode characte, Dave Gomboc |
Month |
Keywords