This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Document() and &


[Charles Knell]

> I hope you don't mind if I jump in on this thread, because I am struggling
> with the same issue, yet the approach of substituting the HTML entity
> & for the literal & is going nowhere.
>
> Below are two examples of a fragment of an HTML element produced by
passing
> in a quoted string as a parameter. The goals is to pass a URL as a
parameter
> to the XSLT and get a valid URL in the output HTML document. In the first
> one, I used '&' in the original string, in the second, I used '&'
>
> As you can see, there is no difference between them. So what part about
> the entity substitution approach am I missing?
>
> <script language="JavaScript"
src="http://my.eis.army.mil/pls/portal30/eis_CLOB.include_JScript?p_tableNam
e=tbl_javascripts_2&amp;p_docName=oQRpt5
>
> <script language="JavaScript"
src="http://my.eis.army.mil/pls/portal30/eis_CLOB.include_JScript?p_tableNam
e=tbl_javascripts_2&amp;p_docName=oQRpt5
>

Well, you have to distinguish two cases:

1) You want to have a valid URL for use in the xslt document() function, or

2) You want to have a valid URL in the HTML output from a stylesheet.

I think you are talking about case 2), are you not?  As I understand things,
you actually ***are*** supposed to escape ampersands in HTML attributes
(just like in XML), but in fact browsers are generally quite tolerant and
are happy to accept unescaped ampersands in hyperlinks.

I just verified this with Internet Explorer to check my memory and both
escaped and unescaped forms worked.  But the unescaped form wouldn't work in
an xml document, of course.

As for passing in strings as parameters, I suppose it would depend on the
processor, but since once the processor has constructed a string from an
attribute value, the ampersand has replaced the character reference, it
makes sense to me that an externally-supplied parameter string wouldn't have
to be escaped (since it hasn't been expressed as xml in the first place).
Or rather, I could see it either way.

Cheers,

Tom P



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]