xsl-list
[Top] [All Lists]

Re: Converting XML to an Escacped URL

2005-10-30 11:50:57
"Gary" == Gary Stewart <the(_dot_)stewarg(_at_)gmail(_dot_)com> writes:

    Gary> On 30 Oct 2005 18:13:24 +0000, Colin Paul Adams
    Gary> <colin(_at_)colina(_dot_)demon(_dot_)co(_dot_)uk> wrote:

    Gary> Yeah; I am aware of that as a problem. I'm using it for
    Gary> testing really and the documents are quite short. I'll have
    Gary> to get POST working in the near future though :).

    >> Anyway, you have 3 functions in XPath 2.0 for escaping
    >> characters.  I take it you are using XML 1.1?

    Gary> XML 1.0 though I could start using 1.1. Is there a way of
    Gary> getting the nodeset as a string then?

The version of XML is irrelevant for this.
I was wondering if 1.0 element names need escaping at all.
But the text certainly will.

So I think you want a stylesheet that specifies xsl:output
method="text".

Then a template somthing like:

<xsl:template match="/">
data:text/html;charset=US-ASCII;base64,<xsl:apply-templates/>
</xsl:template

Then in subsequent templates write out the base64 encoding (you can
write an xsl:function for this) of each node.

Alternatively, you can omit the base64, and %encode everything with
escape-html-uri (if that's the right function for the data URI
scheme. (The RFC says:

"without ";base64", the data (as a sequence of
   octets) is represented using ASCII encoding for octets inside the
   range of safe URL characters and using the standard %xx hex encoding
   of URLs for octets outside that range."
)
-- 
Colin Adams
Preston Lancashire

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>