Patches: Browse | Submit New | Admin

[#23352] Add methods to dump a transformation result

Date:
2008-12-25 15:18
Priority:
3
Submitted By:
Morus Walter (mow)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Add methods to dump a transformation result

Detailed description
I added two instance methods to XSLT::Stylesheet to output the
result of a xslt transformation to a string or an io object.

libxslt provides output functions that take the declaration into
account in xsltutils.c.

I added two instance methods to XSLT::Stylesheet to output the
result of a xslt transformation to a string or an io object.

In case of the string output I left a remark, that the string should
be flagged with the used encoding for ruby 1.9 (I don't know how to 
do that and it does not seem to be done in case of XML::Document.to_s,
but when ruby-libxml/libxslt is used with ruby 1.9 it should be relevant)

The patch contains further changes depending on the parse options
patch for libxml-ruby (#23351).

This affects a few helper functions I added to XSLT::Stylesheet in 
lib/libxslt/stylesheet.rb
I don't know what your policy on this kind of methods is.
They seem helpful to me (the stylesheet creator functions make sure that
apropriate parse options are used) and hide intermediary objects (one
rarely needs the document tree of a stylesheet itself).
But if you prefer to restrict ruby-libxslt to a pure interface to the
C functions, feel free to remove these methods. They are pretty trivial
anyway.

Besides this, the part of tests added rely on the parse options
as they show the problems when not settings options apropriately.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-01-26 17:49
Sender: Morus Walter

I updated the patch to conform to the options syntax in
libxml 0.9.8.

The tests show two errors but that errors also occur in the
unpatched version and should not be connected to the patch.
test_doc_ownership(TestStylesheet)
    [./test/test_stylesheet.rb:79:in `test_doc_ownership'
<156> expected but was <173>.
and
test_stylesheet_ownership(TestStylesheet)
    [./test/test_stylesheet.rb:93:in `test_stylesheet_ownership'
<5993> expected but was <6010>.

The patch should provide a solution for bug 21615.

Attached Files:

Name Description Download
libxslt.diff Download
libxslt.diff revides patch version Download

Changes:

Field Old Value Date By
File Added4308: libxslt.diff2009-01-26 17:49mow
File Added4252: libxslt.diff2008-12-25 15:18mow