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 &


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
> http://www.w3.org/Addressing/.

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:

  my.cgi?company=AT%26T

Because the & is significant in a URL (it's used to separate
parameters).
  
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:

  my.cgi?company=AT%26T&date=2002-05-17

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

  document('my.cgi?company=AT%26T&date=2002-05-17')

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

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

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

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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]