Re: [xslt] XSLT transformation to Plain Text using Python bindingsrequires using children().serialize()?



Hello:

First off, thanks for noticing the lack of saveResultToString()
in the Python binding.  I will most certainly be making use of
that!

Le grande pinguin wrote:
> On Fri, Aug 23, 2002 at 02:19:08PM -0400, Craeg K Strong wrote:
>>Le grande pinguin wrote:
>>>On Thu, Aug 22, 2002 at 09:00:05PM -0400, Craeg K Strong wrote:
>>>>The problem is this:
>>>>
>>>>- the result of applyStylesheet always returns an instance of
>>>>xmlDoc
>>>
>>>Where is the problem? That's what is is supposed to return.
>>
>>I understand, but this is confusing, especially for a newbie.  For example,
>>I use XSLT to generate Python code from XML.  And I am
>>supposed to retrieve my Python code from an object called "xmlDoc"???
>>This is non-intuitive IMO.
> 
> 
> Why? Because, maybe,  you miss an important point? XSLT is, as already
> the name says, a way of _transforming_ xml documents - a transformer,
> nothing more: you put an XML document (_not_ it's serialized bytestream
> representation) in, and you get one out. What, btw, _would_ you expect
> get retrieve? 

>>I also sometimes generate HTML that is not XHTML compliant. This is,
>>of course, not legal XML, and therefore strange to be retrieved
>>from an object called "xmlDoc"  unless "xmlDoc" is meant to be
>>viewed as "a document of some kind produced by libxml"
>>(a rather liberal interpretation...)
> 
> It's not. The purpose of XSLT is the _transformation_ of one XML tree
> to another -- you cannot produce invalid XML (well, of course, you can
> allways fool the system, but don't complain if it breaks). What you get
> back from a transformation is a tree representation, not a serialized
> tree. You are free to serialize it (and Daniel did put some nice and
> very convenient helpers in libxslt).

You are absolutely right.  The serialization step is a separate one from
the transformation step, and the standard specifies that transformation
is done from a source tree to a result tree.

It just so happens that the three or four other processors I have used
combined these steps into a single API, so I forgot that they are actually
completely separate things.

Thanks for the reminder :-}
>>
>>I included my test case (xml, xslt, and python code) in the original message--
>>let me know if you didn't get it via private email, I don't want to
>>spam the list unecessarily...
> 
> 
> This was a rethorical question ... you did forget to put it in.

They are present in the archive version of my message:

http://mail.gnome.org/archives/xslt/2002-August/msg00039.html

perhaps your email server filtered it out, thinking it looked
like a virus?

Anyways, I believe I am all set now, thanks again for the info.

I really appreciate all of your/Daniel/etc. responses to obviously fairly
naive questions..

Regards,

--Craeg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]