Re: [xsl] Document() and &

Subject: Re: [xsl] Document() and &
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 17 May 2002 16:37:36 +0100
Hi Stuart,

> Josh, the document() function when passed one string parameter
> interprets that string as URI (that is a URL or URN). You do not
> escape characters in a URI using the character entity references
> defined in HTML 4.01 or XML 1.0 (silly goose).
> In a URI, a character is escaped as a sequence of hexadecimal byte
> values, each of the form %HH. An ampersand is represented in a URI
> with the sequence '%26' (without the single quote marks). That
> should work for you, but if not, tell me what operating system you
> are working with. Read more about URIs at

If I understand what you're saying, it doesn't sound right to me. The
point about escaping characters with the %HH escapes is to escape
URL-significant characters that aren't significant in this particular
URL. For example, if you wanted to submit a form with the value of the
'company' parameter being 'AT&T', then you'd do:


Because the & is significant in a URL (it's used to separate
But if you had another parameter that you wanted to use in the URL,
then you'd separate that from the first with an ampersand; so if there
was one called 'date' with the value '2002-05-17' then the URL is:


So to get that document, you'd use the XPath:


and of course if that XPath is embedded in some XML, then you need to
escape the ampersand character:

    select="document('my.cgi?company=AT%26T&amp;date=2002-05-17')" />

But maybe I'm being a silly goose too...


Jeni Tennison

 XSL-List info and archive:

Current Thread