public
Description: ruby libxml library targetting speed and ease of use. provides an hpricot-like interface to xml
Homepage: http://trac.hasno.info/fastxml
Clone URL: git://github.com/segfault/fastxml.git
Search Repo:
adding tests for the xslt support
segfault (author)
Tue Jul 08 14:21:48 -0700 2008
commit  e72f4aca12e7f251be3d7a86ff41a2a41c2f058c
tree    d42b213399b0f6ea6a131f7e7cfacd9174fecd31
parent  3743ad075234ad77e4d34c81771003bd38d4a24e
...
123
124
125
126
 
127
128
 
129
130
131
...
123
124
125
 
126
127
 
128
129
130
131
0
@@ -123,9 +123,9 @@ VALUE fastxml_doc_transform(VALUE self, VALUE xform)
0
 
0
   ret_doc = (xmlDocPtr)xsltApplyStylesheet( xf_data->xslt, my_data->doc, NULL );
0
   ret_str = rb_str_new2( "<shouldNeverBeSeen/>" );
0
- ret = rb_class_new_instance( 1, &ret_str, rb_cFastXmlDoc );
0
+ ret = rb_class_new_instance( 1, &ret_str, rb_cFastXmlDoc ); // provide an xml snipped temporarily
0
   ret_dv = rb_iv_get( ret, "@lxml_doc" );
0
- Data_Get_Struct( ret_dv, fxml_data_t, ret_data );
0
+ Data_Get_Struct( ret_dv, fxml_data_t, ret_data ); // replace the associated doc with the new one from the transform
0
   xmlFree( ret_data->doc );
0
   ret_data->doc = ret_doc;
0
   
...
79
80
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
...
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
0
@@ -79,4 +79,22 @@ describe FastXml::Doc, " functionality" do
0
     rlm.to_s.should == @doc.to_s
0
     rlm.should_not == @doc
0
   end
0
+
0
+ it 'should be able to have an xsl assigned' do
0
+ doc = FastXml( open("./test_data/transform_base.xml") )
0
+ doc.should_not be_nil
0
+ tran = FastXml( open("./test_data/transform.xsl") )
0
+ tran.should_not be_nil
0
+ doc.stylesheet = tran
0
+ doc.stylesheet.should_not be_nil
0
+ end
0
+
0
+ it 'should be able to have an xslt assigned' do
0
+ doc = FastXml( open("./test_data/transform_base.xml") )
0
+ doc.should_not be_nil
0
+ tran = FastXml( open("./test_data/transform.xsl") )
0
+ tran.should_not be_nil
0
+ result = doc.transform( tran )
0
+ result.should_not be_nil
0
+ end
0
 end

Comments

    No one has commented yet.