[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] F & O 3.0 -- serialize() function question

Subject: Re: [xsl] F & O 3.0 -- serialize() function question
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 1 Jun 2014 20:28:48 -0000

The result of the serialize() function is a string (a sequence of characters)
but the Serialization spec defines a process whose output is a sequence of
octets, that is characters in a particular encoding.

To handle this difference, the spec suggests two possible approaches: either
skip the final stage of serialization, which turns characters into octets, or
reverse it, by turning the octets into characters. This is possible because
character encoding (turning characters into octets) is entirely lossless and
therefore reversible. The first approach (skipping the encoding phase) is of
course more efficient, but it might not be possible if the serializer is a
black-box component that doesn't support this mode of operation.

Michael Kay

On 1 Jun 2014, at 19:46, Dimitre Novatchev dnovatchev@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> I am reading the definition of the serialize function() in the XPath
> and XQuery Functions and Operators 3.0 specification,
> http://www.w3.org/TR/xpath-functions-30/#func-serialize
> Having read several times this text, I feel confused:
> "The final stage of serialization, that is, encoding, is skipped. If
> the serializer does not allow this phase to be skipped, then the
> sequence of octets returned by the serializer is decoded into a string
> by reversing the character encoding performed in the final stage."
> If, on one hand "The final stage of serialization, that is, encoding,
> is skipped", then how is it possible to do "reversing the character
> encoding performed in the final stage" ?
> And what could possibly be a "string with reversed character encoding"?
> I am deeply confused.
> Could someone, please, explain this text?
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
> -------------------------------------
> Never fight an inanimate object
> -------------------------------------
> To avoid situations in which you might make mistakes may be the
> biggest mistake of all
> ------------------------------------
> Quality means doing it right when no one is looking.
> -------------------------------------
> You've achieved success in your field when you don't know whether what
> you're doing is work or play
> -------------------------------------
> To achieve the impossible dream, try going to sleep.
> -------------------------------------
> Facts do not cease to exist because they are ignored.
> -------------------------------------
> Typing monkeys will write all Shakespeare's works in 200yrs.Will they
> write all patents, too? :)
> -------------------------------------
> I finally figured out the only reason to be alive is to enjoy it.

Current Thread